Re: [Nbd] [PATCH] nbd-server: add setproctitle support
- To: "Dmitry V. Levin" <ldv@...1147...>
- Cc: nbd-general@lists.sourceforge.net
- Subject: Re: [Nbd] [PATCH] nbd-server: add setproctitle support
- From: Wouter Verhelst <w@...112...>
- Date: Tue, 3 Jul 2012 14:48:15 -0600
- Message-id: <20120703204815.GA1986@...3...>
- In-reply-to: <20120627234255.GB5528@...1147...>
- References: <20120624230806.GC28298@...1147...> <20120627230830.GC7082@...3...> <20120627234255.GB5528@...1147...>
On Thu, Jun 28, 2012 at 03:42:56AM +0400, Dmitry V. Levin wrote:
> On Thu, Jun 28, 2012 at 01:08:30AM +0200, Wouter Verhelst wrote:
> > On Mon, Jun 25, 2012 at 03:08:06AM +0400, Dmitry V. Levin wrote:
> > > +#if USE_SETPROCTITLE
> > > +# ifdef HAVE_SETPROCTITLE_H
> > > +# include <setproctitle.h>
> > > +# endif
> > > +#endif
> >
> > This means <setproctitle.h> is only included if we have it, and the user
> > asked us to compile it in.
> [...]
> > > +#if USE_SETPROCTITLE
> > > + setproctitle("%s", client->clientname);
> > > +#endif
> >
> > This means we try to compile it in if the user asked us to do so,
> > regardless of whether the header is available.
>
> setproctitle != setproctitle.h
>
> There are more than one implementation of setproctitle interface. The
> setproctitle signatures are compatible, but header file names may differ.
>
> For example, *BSD implement it within libc with prototype defined in
> system header files (e.g. NetBSD in stdlib.h, FreeBSD in unistd.h):
> http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/lib/libc/gen/setproctitle.3
> http://www.freebsd.org/cgi/man.cgi?query=setproctitle&sektion=3
>
> The setproctitle implementation I use is
> http://git.altlinux.org/people/ldv/packages/?p=setproctitle.git;a=tree;f=setproctitle
> This is a library I maintain with setproctitle prototype defined in
> setproctitle.h header file.
I see.
In that case, is that packaged in the common distributions? If so, I suppose it
makes sense; but I'm not sure I should introduce
> > Additionally, I'm not convinced we need a compile-time option for this.
> > What's your reason for doing it that way?
>
> This is the most conservative way to introduce a new feature I could think
> of: one has to specify --with-setproctitle to use setproctitle even if
> operating system supports setproctitle interface.
There's no need to be conservative when introducing minor new things,
IMO. Additionally, if there indeed is an issue, it's usually best to add
the possibility to disable it at runtime, rather than at build time.
Either you implement it, or you don't. Compile-time options aren't very
useful, since most people will get a compiled version from their
distribution anyway.
Except if you're running gentoo or some such, of course, but even then
for a server as minor as nbd-server and a feature as small as this, I'm
not convinced this would make much of a difference.
--
The volume of a pizza of thickness a and radius z can be described by
the following formula:
pi zz a
Reply to: