in reply to Re: How to change process title ?
in thread How to change process title ?

I once spent a lot of time trying to change the process name on Solaris. I discovered that it depended on the version of ps you were using (BSD or not). It is highly system dependent.

Mark

Replies are listed 'Best First'.
Re^3: How to change process title ?
by blazar (Canon) on Oct 18, 2005 at 06:46 UTC
    Indeed I originally read that particular faq while I were regularly on clpmisc, as individual faq entries were randomly posted there. Back then I felt intrigued by the possibility, and I tried it on Linux. I can't remember which {perl,kernel} version it was, but it didn't appear to work.

    Whatever, I don't know about other unices, but under Linux I guess that programs like ps just check /proc/$pid/cmdline, and I doubt (but I'm far from being sure!) that there are other ways to recover the same info.

    Now, as of my experiment of yesterday, it seems that at least with recent enough perls and kernels (5.8.7 and 2.6.13 respectively, here) assigning to $0 actually writes into /proc/self/cmdline:

    $ perl -le '$0="foo"; print <>' /proc/self/cmdline foo