
Well, that would explain that, now, wouldn't it?  did we remove this
somewhere along the way? *raised eyebrow*

pgsql% find . -name "*.[ch]" -exec grep setproctitle {} \; -print
pgsql% pwd
/pgsql/src/pgsql/src
pgsql% 


Marc G. Fournier                   ICQ#7615664               IRC Nick: Scrappy
Systems Administrator @ hub.org 
primary: scrappy@hub.org           secondary: scrappy@{freebsd|postgresql}.org 


Wed, 10 May 2000 08:57:12 -0300 (ADT)
The Hermit Hacker <scrappy@hub.org>
setproctitle() no longer used?
The Hermit Hacker writes:

> Well, that would explain that, now, wouldn't it?  did we remove this
> somewhere along the way? *raised eyebrow*

There was no setproctitle in 6.5.* either.

I'm guessing that the argv[0] = "the string you want" method no longer
works in FreeBSD 4.0??? In any case, as per previous discussion, I did
write up a more portable and robust setproctitle-like implementation for
our use (which actually uses setproctitle if available), so if this is the
problem it's at least being worked on.

> pgsql% find . -name "*.[ch]" -exec grep setproctitle {} \; -print
> pgsql% pwd
> /pgsql/src/pgsql/src
> pgsql% 

-- 
Peter Eisentraut                  Sernanders vï¿½g 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden


Wed, 10 May 2000 23:25:15 +0200 (CEST)
Peter Eisentraut <peter_e@gmx.net>
Re: setproctitle() no longer used?
[Charset ISO-8859-1 unsupported, filtering to ASCII...]
> The Hermit Hacker writes:
> 
> > Well, that would explain that, now, wouldn't it?  did we remove this
> > somewhere along the way? *raised eyebrow* 
> 
> There was no setproctitle in 6.5.* either.
> 
> I'm guessing that the argv[0] = "the string you want" method no longer
> works in FreeBSD 4.0??? In any case, as per previous discussion, I did

I am quite surprised.  I though all BSD's allows this.  It is done using
kvm.  I am not sure the ps thing works in the backend process is swapped
out.

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Wed, 10 May 2000 17:35:25 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: setproctitle() no longer used?
On Wed, 10 May 2000, Peter Eisentraut wrote:

> The Hermit Hacker writes:
> 
> > Well, that would explain that, now, wouldn't it?  did we remove this
> > somewhere along the way? *raised eyebrow*
> 
> There was no setproctitle in 6.5.* either.
> 
> I'm guessing that the argv[0] = "the string you want" method no longer
> works in FreeBSD 4.0??? In any case, as per previous discussion, I did
> write up a more portable and robust setproctitle-like implementation for
> our use (which actually uses setproctitle if available), so if this is the
> problem it's at least being worked on.

D'oh, okay...I ended up going through the v6.5.* source code too, and
couldn't find it there.  I forget how Bruce had implemented it using
argv[0], and yes, it is definitely broken on FreeBSD 4.0 ...

I'll look at doing the change here locally, since I know
setproctitle() does work, as I find it invaluable to know what is running,
and where ...



Wed, 10 May 2000 19:16:54 -0300 (ADT)
The Hermit Hacker <scrappy@hub.org>
Re: setproctitle() no longer used?
> D'oh, okay...I ended up going through the v6.5.* source code too, and
> couldn't find it there.  I forget how Bruce had implemented it using
> argv[0], and yes, it is definitely broken on FreeBSD 4.0 ...
> 
> I'll look at doing the change here locally, since I know
> setproctitle() does work, as I find it invaluable to know what is running,
> and where ...

Can you find out if it is broken, or they have stopped supporting it in
FreeBSD.

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Wed, 10 May 2000 18:30:17 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: setproctitle() no longer used?
On Wed, 10 May 2000, Bruce Momjian wrote:

> > D'oh, okay...I ended up going through the v6.5.* source code too, and
> > couldn't find it there.  I forget how Bruce had implemented it using
> > argv[0], and yes, it is definitely broken on FreeBSD 4.0 ...
> > 
> > I'll look at doing the change here locally, since I know
> > setproctitle() does work, as I find it invaluable to know what is running,
> > and where ...
> 
> Can you find out if it is broken, or they have stopped supporting it in
> FreeBSD.

In 4.0-Rel they're not saying it's gone or going away, just that you 
need to link with -lutil if you use it.  They also state that there's
no standard but that they believe they're using the predominant
convention.

Vince.
-- 
==========================================================================
Vince Vielhaber -- KA8CSH    email: vev@michvhf.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
==========================================================================




Wed, 10 May 2000 18:59:38 -0400 (EDT)
Vince Vielhaber <vev@michvhf.com>
Re: setproctitle() no longer used?
> On Wed, 10 May 2000, Bruce Momjian wrote:
> 
> > > D'oh, okay...I ended up going through the v6.5.* source code too, and
> > > couldn't find it there.  I forget how Bruce had implemented it using
> > > argv[0], and yes, it is definitely broken on FreeBSD 4.0 ...
> > > 
> > > I'll look at doing the change here locally, since I know
> > > setproctitle() does work, as I find it invaluable to know what is running,
> > > and where ...
> > 
> > Can you find out if it is broken, or they have stopped supporting it in
> > FreeBSD.
> 
> In 4.0-Rel they're not saying it's gone or going away, just that you 
> need to link with -lutil if you use it.  They also state that there's
> no standard but that they believe they're using the predominant
> convention.

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.

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Wed, 10 May 2000 19:02:20 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: setproctitle() no longer used?
On Wed, 10 May 2000, Bruce Momjian wrote:

> > On Wed, 10 May 2000, Bruce Momjian wrote:
> > 
> > > > D'oh, okay...I ended up going through the v6.5.* source code too, and
> > > > couldn't find it there.  I forget how Bruce had implemented it using
> > > > argv[0], and yes, it is definitely broken on FreeBSD 4.0 ...
> > > > 
> > > > I'll look at doing the change here locally, since I know
> > > > setproctitle() does work, as I find it invaluable to know what is running,
> > > > and where ...
> > > 
> > > Can you find out if it is broken, or they have stopped supporting it in
> > > FreeBSD.
> > 
> > In 4.0-Rel they're not saying it's gone or going away, just that you 
> > need to link with -lutil if you use it.  They also state that there's
> > no standard but that they believe they're using the predominant
> > convention.
> 
> 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.

Vince.
-- 
==========================================================================
Vince Vielhaber -- KA8CSH    email: vev@michvhf.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
==========================================================================




Wed, 10 May 2000 19:06:21 -0400 (EDT)
Vince Vielhaber <vev@michvhf.com>
Re: setproctitle() no longer used?
> > 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.

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Wed, 10 May 2000 19:07:46 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: setproctitle() no longer used?
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)

Vince.
-- 
==========================================================================
Vince Vielhaber -- KA8CSH    email: vev@michvhf.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
==========================================================================




Wed, 10 May 2000 19:48:22 -0400 (EDT)
Vince Vielhaber <vev@michvhf.com>
Re: setproctitle() no longer used?
> 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?

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Wed, 10 May 2000 19:56:22 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: setproctitle() no longer used?
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@michvhf.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
==========================================================================




Wed, 10 May 2000 20:07:30 -0400 (EDT)
Vince Vielhaber <vev@michvhf.com>
Re: setproctitle() no longer used?
> > > 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..

I thought I was.  :-)

I now realize you are running FreeBSD.  Yikes.

So neither works.  Well, that is a problem.  Does the -lutil help?

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Wed, 10 May 2000 20:12:12 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: setproctitle() no longer used?
On Wed, 10 May 2000, Bruce Momjian wrote:

> > > > 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..
> 
> I thought I was.  :-)
> 
> I now realize you are running FreeBSD.  Yikes.
> 
> So neither works.  Well, that is a problem.  Does the -lutil help?
> 
> 

No, I compiled every time with -lutil

Vince.
-- 
==========================================================================
Vince Vielhaber -- KA8CSH    email: vev@michvhf.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
==========================================================================




Wed, 10 May 2000 20:16:39 -0400 (EDT)
Vince Vielhaber <vev@michvhf.com>
Re: setproctitle() no longer used?
> > I thought I was.  :-)
> > 
> > I now realize you are running FreeBSD.  Yikes.
> > 
> > So neither works.  Well, that is a problem.  Does the -lutil help?
> > 
> > 
> 
> No, I compiled every time with -lutil

Oh.  Can you look at the setproctitle code on your platform and see how
it implements it?

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Wed, 10 May 2000 20:21:45 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: setproctitle() no longer used?
On Wed, 10 May 2000, Bruce Momjian wrote:

> > > I thought I was.  :-)
> > > 
> > > I now realize you are running FreeBSD.  Yikes.
> > > 
> > > So neither works.  Well, that is a problem.  Does the -lutil help?
> > > 
> > > 
> > 
> > No, I compiled every time with -lutil
> 
> Oh.  Can you look at the setproctitle code on your platform and see how
> it implements it?

I've attached it since it's small.

Vince.
-- 
==========================================================================
Vince Vielhaber -- KA8CSH    email: vev@michvhf.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
==========================================================================
Wed, 10 May 2000 20:41:10 -0400 (EDT)
Vince Vielhaber <vev@michvhf.com>
Re: setproctitle() no longer used?