News for hackers. Stuff that matters.
Re:C stdlib isn't threadsafe and even safe Rust didn't save us by GoblinSlayer on Thursday January 23, 2025 @04:45AM (#42802432)
For that you write to /proc/self/comm, that's where top gets it from.
Re:C stdlib isn't threadsafe and even safe Rust didn't save us by gobblegobble2 on Thursday January 23, 2025 @07:15AM (#42803242)
It 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:bas...) don't have to resort to argv hacks.
Re:C stdlib isn't threadsafe and even safe Rust didn't save us by GoblinSlayer on Friday January 24, 2025 @10:29AM (#42814018)
There's prctl https://man7.org/linux/man-pages/man2/PR_SET_NAME.2const.htm... that writes to /proc/self/comm
Re:C stdlib isn't threadsafe and even safe Rust didn't save us by saagarjha on Thursday January 23, 2025 @05:03AM (#42802516)
Hmm, htop then? Whatever is reading /proc/self/cmdline
Re:C stdlib isn't threadsafe and even safe Rust didn't save us by eadler on Thursday January 23, 2025 @10:56AM (#42805170)
This isn't true for the majority of operating systems.