[PATCH v2] kernel32: Use setprogname(3) to set the program name if available.

Ken Thomases ken at codeweavers.com
Mon Jul 11 23:50:57 CDT 2016


On Jul 7, 2016, at 6:02 PM, Ken Thomases <ken at codeweavers.com> wrote:
> 
> Also, why should set_process_name() shift the strings up within the (supposedly contiguous) string buffer?  For the HAVE_SETPROCTITLE, it doesn't do that.  Prior to Chip's commit, it didn't do that on macOS.  So, Theodore's original question, "Why wouldn’t setprogname(argv[1]) be adequate?", is pretty close.  It should have been, "Why wouldn’t setprogname(argv[1]) followed by shifting the elements of argv up one be adequate?"
> 
> I'm not even sure why the string buffer is shifted for Linux.  It looks like it's leftover logic that's no longer relevant (having to do with vdm?).

OK, I have figured out what I was missing.  Much to my surprise, modifying the argv strings buffer is actually the means by which the command shown by, for example, ps is modified.  The prctl() call on Linux affects a different value (the "comm" field rather than "command").

I have submitted a patch to address the other shortcomings of the current code.

-Ken




More information about the wine-devel mailing list