I would like to provide individual names to the threads in my Rust program. These names should appear in top
/htop
so I can differentiate the thread's job. In Ruby I would modify the argv[0]
entry, or maybe Process.setproctitle("foo")
. My inspiration is from Ruby's Unicorn web server.
The env::args
function returns an Args
value. The Args
value wraps the platform-specific std::sys::args::args()
function which is not reexported for general use. ArgsOs
doesn't have a usable mutator (so yes, the stdlib makes it clear it is immutable).
How do I mutate the arguments some other way? I am happy with a Linux-only solution since that is where the real work will happen. Solutions outside the stdlib are also fine.
What path should I take in order to modify the first argument in the environment of my process?