Skip site navigation (1) Skip section navigation (2)

Re: setproctitle()

From: The Hermit Hacker <scrappy(at)hub(dot)org>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: setproctitle()
Date: 2000-05-23 23:07:00
Message-ID: Pine.BSF.4.21.0005232003050.243-100000@thelab.hub.org (view raw or flat)
Thread:
Lists: 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
...



In response to

Responses

pgsql-hackers by date

Next:From: Bruce MomjianDate: 2000-05-23 23:28:33
Subject: Re: setproctitle()
Previous:From: The Hermit HackerDate: 2000-05-23 22:55:23
Subject: MySQL now supports transactions ...

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group