[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1254519449.4605.33.camel@timo-desktop>
Date: Fri, 02 Oct 2009 17:37:29 -0400
From: Timo Sirainen <tss@....fi>
To: linux-kernel@...r.kernel.org
Subject: setproctitle()
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 *).
Download attachment "signature.asc" of type "application/pgp-signature" (198 bytes)
Powered by blists - more mailing lists