lkml.org 
[lkml]   [2009]   [Oct]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Subjectsetproctitle()
From
Date
I'd like to get BSD's setproctitle() implemented for glibc so that more
programs could start using it. The current method of messing around with
argv and environment to implement it is horribly ugly, fragile and I
find it dangerous enough that I haven't dared to use it in my programs.

Any chance of making all this easier so it could actually be implemented
in a generic and safe way in glibc?

I guess there are several different ways it could be done. My first idea
was to have some magic value in beginning of cmdline (\0 followed by a
few characters) followed by a pointer to the actual string. But that's a
bit ugly and userspace can't easily figure out if this is supported by
kernel.

So the second idea, perhaps this will work? Reserve space for the
pointer between arg_end and env_start. If it's NULL, use the old way. If
it's non-NULL, use it for the cmdline. Userspace can check if this is
supported by seeing if environ[0] - (argv[argc-1] + strlen(argv[argc-1])
+ 1) == sizeof(void *).
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2009-10-03 00:03    [W:0.189 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site