setproctitle() and /usr/ucb/ps
Miroslaw Luc
mirecki at nask.pl
Sun Dec 18 22:51:08 UTC 2005
On Fri, 9 Dec 2005, Russ Allbery wrote:
> Miroslaw Luc <mirecki at nask.pl> writes:
>
> > Solaris 8,9; INN 2.4.
> > setproctitle() does not work correctly with /usr/ucb/ps:
>
> Hm, do we really want to go to this much trouble
It's not a trouble IMHO.
> to support a weird and semi-broken feature when using the obsolete
> version of ps on Solaris?
Weird and semi-broken...? It's a BSD/SunOS compatibility tool:)
> I suppose you felt it was important enough to develop a patch....
/bin/ps can't show the current argv, so I got angry and started digging.
> Anyway, my main worry about this is that while all this may work on
> Solaris, does it work on platforms other than Solaris?
I think each Unix-like OS places the argv/envp strings on the stack in
the same way: argv0,..,argvn,envp0,..,envpn. If not, we can do some
additional checks. For example:
[...]
for (i=0; envp[i]; i++)
if (title_end + 2 == envp[i]) /* Just to be sure... */
title_end = envp[i] + strlen(envp[i]) - 1;
insteed of:
for (i=0; envp[i]; i++)
title_end += strlen(envp[i]) + 1;
> In particular, does this still work on Linux?
Just tested - it looks... not too bad:) ps ax - ok; but ps axw displays
too many spaces (envp strings filled with spaces). Unnecessary spaces at
the end of the argv/envp...? BTW, this piece of lib/setprocetitle.c is not
a part of my pseudo-patch:) I will try to take a look at it later.
-Mirek
More information about the inn-workers
mailing list