4
I am developing a node application and there is an option to set the process title (process name). This only sets it in some tools (like ps and top), but not in htop
or netstat
.
I found this article that explained how most applications do it, but it doesn't change in netstat.
That lead me to wonder where those programs are getting the process name. Would they be getting it from /proc/##/cmdline
? (## being the PID of the process)
I figure messing with things in /proc
is a bad idea (and probably not possible), so if this is where those programs are getting it, is there a way to change it?
But why do ps and top have the changed process name, whereas netstat doesn't? – beatgammit – 2011-06-25T07:27:17.067
Apparently a process can change it's name, which changes /proc/PID/cmdline, but the stat entry does not change. So it depends on which place the tool looks to get the name. netstat seems to use the stat entry. – Keith – 2011-06-25T08:03:49.563
Apparently node was changing the values in stat, status, and comm, but not cmdline. I guess programs like htop and netstat read from cmdline. Anyway, thanks for the info! – beatgammit – 2011-06-25T18:32:30.107