[lkml]   [2004]   [Aug]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: setproctitle
    Hi William :)

* William Lee Irwin III <> dixit:
> > In proc/base.c you can read about 'setproctitle(3)', that is, in
> > library space (user space), not kernel space, but AFAIK only FreeBSD
> > has setproctitle :?
> Observe the following, from fs/proc/base.c:
> The command-line arguments are being fetched from the process address
> space, i.e. simply editing argv[] in userspace will have the desired
> effect. Though this code is butt ugly.

The problem with this is that is non-portable. Not all Unices
(AFAIK) have this behaviour. The portable solution for changing
argv[0] is to use ONLY the space currently allocated to argv[0]. I
mean, you take argv[0], do a strlen() and overwrite only strlen bytes
of it. The problem with this is that you cannot write an arbitrary
string there. If all Unices provide 'setproctitle' that problem

Anyway is cool to know that, under Linux, I can change the
argv[0] with no problems.

Thanks for the help :)

Raúl Núñez de Arenas Coronado

Linux Registered User 88736 &
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 14:05    [W:0.054 / U:75.364 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site