Re: setproctitle() no longer used?

From: Vince Vielhaber <vev(at)michvhf(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: The Hermit Hacker <scrappy(at)hub(dot)org>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: setproctitle() no longer used?
Date: 2000-05-11 00:07:30
Message-ID: Pine.BSF.4.21.0005102006360.33388-100000@paprika.michvhf.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 10 May 2000, Bruce Momjian wrote:

> > On Wed, 10 May 2000, Bruce Momjian wrote:
> >
> > > > > So if you use -lutil, the argv[0] trick works, and if you don't, it
> > > > > doesn't? If so, we can get that into the FreeBSD template.
> > > >
> > > > 'splain the "argv[0] trick" briefly.
> > >
> > > It is a nifty BSD one. If you assign argv[0] in the program to a
> > > string, it shows in ps.
> > >
> > > argv[0] = "new ps string";
> > >
> > > The Linux method is:
> > >
> > > strcpy(argv[0], "new ps string");
> > >
> > > In the second case, you are actually writing into the environment area
> > > use to store args. Not real great, but it works on Linux.
> >
> > This does not:
> >
> > #include <stdio.h>
> > #include <sys/types.h>
> > #include <libutil.h>
> >
> >
> > int main(int numargs, char *argv[])
> > {
> > int ii;
> >
> > argv[0] = "Postgres Power!";
> >
> > for(ii=0;ii<100;ii++) sleep(1);
> >
> > return 0;
> > }
> >
> > $ cc test.c -lutil -o test
> > $ ./test
> >
> > making it strcpy(argv[0],"Postgres Power!"); didn't either.
> >
> > But:
> >
> > making it: setproctitle("Postgres Power!"); gives this:
> >
> > 34273 p3 S 0:00.00 test: Postgres Power! (test)
>
> Well, that's interesting. Our issue with setproctitle is how fast it
> is. Every query changes its proctitle, so it has to be fast. Tom want
> to have setproctitle on backend startup, then use the fast method on
> platforms that support it.
>
> Does the existing postgres ps title code work on your Linux?

I'm assuming you're not asking me..

Vince.
--
==========================================================================
Vince Vielhaber -- KA8CSH email: vev(at)michvhf(dot)com http://www.pop4.net
128K ISDN from $22.00/mo - 56K Dialup from $16.00/mo at Pop4 Networking
Online Campground Directory http://www.camping-usa.com
Online Giftshop Superstore http://www.cloudninegifts.com
==========================================================================

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alfred Perlstein 2000-05-11 00:10:43 Re: Unable to get acceptable performance from EXCEPT
Previous Message Bruce Momjian 2000-05-10 23:56:22 Re: setproctitle() no longer used?