Setting process command name in forked process

Lavrentiev, Anton (NIH/NLM/NCBI) [C] lavr@ncbi.nlm.nih.gov
Fri Jan 26 15:47:41 GMT 2024


> (I'm assuming it's too late by the time the /proc entry has been set up).

Actually, it's not.  But beware, the suggested solution is absolutely NOT portable:

These are the externals that /proc is referring to...  (Not argc, argv passed to main().)

    extern char** __argv;
    extern int    __argc;

So you can change everything that it shows by reassigning __argv(and/or __argc) with a totally
different set of arguments, or just modify __argv[0], provided that it fits into the space
occupied by the original argument [0].

HTH,

Anton Lavrentiev
Contractor NIH/NLM/NCBI



More information about the Cygwin mailing list