Re: setproctitle() - Mailing list pgsql-hackers

From The Hermit Hacker
Subject Re: setproctitle()
Date
Msg-id Pine.BSF.4.21.0005232003050.243-100000@thelab.hub.org
Whole thread Raw
In response to setproctitle()  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: setproctitle()
Re: setproctitle()
List pgsql-hackers
On Tue, 23 May 2000, Bruce Momjian wrote:

> Seems BSD/OS 4.01 has setproctitle() in libutil.o, even though there is
> no include file nor manual page.
> 
> I checked the library source, and it is a very light-weight function. 
> It grabs an argv global from crt0.o, and changes the ps args.  Very fast.
> 
> I now see that systems that use setproctitle() seem totally broken for
> updates.  The code says:
> 
>         setproctitle("%s %s %s %s %s", execname, hostname, username, db...
> 
> #define PS_SET_STATUS(status) \
>         do { strcpy(Ps_status_buffer, (status)); } while (0)
> 
> Of course, there is no linkage between Ps_status_buffer and the
> setproctitle args here, so it is no-op.  The fix is to move
> setproctitle() down into PS_SET_STATUS().
> 
> Seems this is Marc's new code:
> 
>     date: 2000/05/12 13:58:24;  author: scrappy;  state: Exp;  lines: +2 -1
>     
>     Add two checks ... one for setproctitle and one for -lutil ...
>     
>     Don't do anything with them at this time, but am working on that ...
> 
> I know we have been talking about using setproctitle() in all cases that
> support it, and in fact we now do that.  What we don't do is use
> setproctitle() to update the status for each query.
> 
> So it seems that he has enabled it on my platform.  Do people want
> setproctitle() to update for every query for 7.01?  I have seen FreeBSD
> and BSDI implementations, and they are both light-weight.
> 
> Comments?

I would like to see it, but not for v7.0.1 ... unless you can figure out a
cleaner way of doing it, the coding changes would be extensive ...

I looked at it, and unless we go with global variables *yeech*, you would
have to pass down the "fixed" part of the setproctitle to sub-functions
(ie. argv[0-4](?)) ... I asked on one of the freebsd lists if anyone could
suggest a way of getting 'argv[0]', but never did hear anything back ...

If you want, you could just added, for v7.0.1, a simple addition of 'if
__FreeBSD__' to the code, so that setproctitle is only used under FreeBSD
...




pgsql-hackers by date:

Previous
From: The Hermit Hacker
Date:
Subject: MySQL now supports transactions ...
Next
From: Alfred Perlstein
Date:
Subject: Re: setproctitle()