2 ms·
For that you write to /proc/self/comm, that's where top gets it from.
by GoblinSlayer 2y ago
For that you write to /proc/self/comm, that's where top gets it from.
- saagarjha 2y agoHmm, htop then? Whatever is reading /proc/self/cmdline
- gobblegobble2 2y agoIt may work for top, but not ps among others. The only reliable way is clobbering argv. That's just the way it is. In my opinion, glibc should finally provide setproctitle(), so programs like postgresql or chrome (https://source.chromium.org/chromium/chromium/src/+/main:base/process/set_process_title_linux.cc;l=77 https://source.chromium.org/chromium/chromium/src/+/main:bas...) don't have to resort to argv hacks.
- GoblinSlayer 2y agoThere's prctl https://man7.org/linux/man-pages/man2/PR_SET_NAME.2const.html https://man7.org/linux/man-pages/man2/PR_SET_NAME.2const.htm... that writes to /proc/self/comm
- eadler 2y agoThis isn't true for the majority of operating systems.