Re: linux-kernel-digest V1 #2839 (writable /proc/<pid>/cmdli

Peeter Joot (peeterj@ca.ibm.com)
Mon, 16 Nov 1998 17:39:16 -0500


Hi Andy,

The sendmail solution that uses kmem is only for SCO if I read the code right.
On linux all that is required is coping a new string into argv[0]. This is
much simpler then messing around with /proc at least in our case (db2) where we
have a multi-process based system rather than a multi-thread based solution.

But, your point about threads is a good one, because argv[0] would be shared
for all threads and a writable /proc/<pid>/cmdline could be used to rename the
ps output for different threads/clones, and overwriting argv[0] wouldn't work
in this case.

Peeter

IINUS1.SMTP4@D03AU015 on 11/16/98 05:23:00 AM
Please respond to IINUS1.SMTP4 @ VM
To: Peeter Joot/Toronto/IBM@IBMCA
cc:
Subject: Re: linux-kernel-digest V1 #2839

> it is already possible (see sendmail's function setproctitle in src/con=
f.c):
>
> 277 ? S 0:00 sendmail: accepting connections on port 25

The sendmail solution (kludge? at least on Linux :) requires write access=
to /dev/kmem which only
root can do. It would be a lot cleaner if you could indeed modify the cmd=
line via the /proc
filesystem. I really like the idea, especially when programming with thre=
ads; ps should be more
useful if you could easily "rename" threads without root privileges. It =
sure beats seeing 20 ps
entries with the original command line..

> - --
> Pavel Jan=EDk ml.
> Pavel.Janik@inet.cz

Andy

--
Andy Lo A Foe, arloafoe@cs.vu.nl |  Linux v2.1.128  | PII 266
http://www.cs.vu.nl/~arloafoe    | GSM: 0622-440695 | Bebox 133
http://orbital.xs4all.nl/andy    |   ICQ: 7472949   | IRCNet: Adnans

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/