This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: setproctitle()


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?




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]