This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: setproctitle()
- From: KOSAKI Motohiro <kosaki dot motohiro at jp dot fujitsu dot com>
- To: Timo Sirainen <tss at iki dot fi>
- Cc: kosaki dot motohiro at jp dot fujitsu dot com, libc-alpha at sources dot redhat dot com
- Date: Thu, 1 Oct 2009 08:29:07 +0900 (JST)
- Subject: Re: setproctitle()
- References: <1254344131.4794.1061.camel@timo-desktop>
Hi
> BSDs have:
>
> void setproctitle(const char *fmt, ...);
>
> to change the process title (in ps output). Could this also be added to
> glibc? Or would it be better done by adding a new syscall to Linux
> kernel?
>
> (I know there's a way to already mess around with argv and environ to
> implement it, but it seems pretty dangerous so I haven't dared to use it
> on my actual programs.)
I don't know BSDs setproctitile(). I'd explain the change way of proc
title in linux kernel.
man prctl says
PR_SET_NAME (since Linux 2.6.9)
Set the process name for the calling process, using the value in
the location pointed to by (char *) arg2. The name can be up to 16
bytes long, and should be null terminated if it contains fewer
bytes.
but it isn't correct.
PR_SET_NAME change thread name, but process name.
More unfortunately, it only change task->comm. not change arg[0].
Thus, some command display wrong name...
(ps can display both, switched by command line option)
So, we shouldn't use it.
Perhapls, I can make new syscall (or new prctl type). but I don't know
why the user want to change process title.
Do you have the any information?