From: Timo Sirainen <tss@iki.fi>
To: linux-kernel@vger.kernel.org
Subject: setproctitle()
Date: Fri, 02 Oct 2009 17:37:29 -0400 [thread overview]
Message-ID: <1254519449.4605.33.camel@timo-desktop> (raw)
[-- Attachment #1: Type: text/plain, Size: 1019 bytes --]
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 *).
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
next reply other threads:[~2009-10-02 22:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-02 21:37 Timo Sirainen [this message]
2009-10-02 22:53 ` setproctitle() Bryan Donlan
2009-10-02 23:41 ` setproctitle() Timo Sirainen
-- strict thread matches above, loose matches on Subject: below --
2014-02-11 21:58 setproctitle() Ruslan Kuprieiev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1254519449.4605.33.camel@timo-desktop \
--to=tss@iki.fi \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox