[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Nbd] [PATCH] nbd-server: add setproctitle support



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.

> 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.


-- 
ldv

Attachment: pgpWIYCMNXejN.pgp
Description: PGP signature


Reply to: