[Qemu-devel] [PATCH] Overwrite argv to set process title, eliminating 16-character prctl() limit.

2010-11-22 Thread John Morrissey
Linux seems to maintain the length of the original args, even when the new args are shorter and NULL-terminated, so the trailing whitespace in ps(1) output is probably unavoidable. I've seen the same result with other daemons that overwrite argv. Keeps the call to prctl(), since some tools get

[Qemu-devel] [PATCH] Overwrite argv to set process title, eliminating 16-character prctl() limit.

2010-11-07 Thread John Morrissey
Linux seems to maintain the length of the original args, even when the new args are shorter and NULL-terminated, so the trailing whitespace in ps(1) output is probably unavoidable. I've seen the same result with other daemons that overwrite argv. Signed-off-by: John Morrissey j...@horde.net ---

Re: [Qemu-devel] [PATCH] Overwrite argv to set process title, eliminating 16-character prctl() limit.

2010-11-07 Thread Andreas Färber
Am 07.11.2010 um 16:44 schrieb John Morrissey: Linux seems to maintain the length of the original args, even when the new args are shorter and NULL-terminated, so the trailing whitespace in ps(1) output is probably unavoidable. I've seen the same result with other daemons that overwrite

Re: [Qemu-devel] [PATCH] Overwrite argv to set process title, eliminating 16-character prctl() limit.

2010-11-07 Thread Torsten Förtsch
Hi, On Sunday, November 07, 2010 16:44:12 John Morrissey wrote: -if (prctl(PR_SET_NAME, name)) { -perror(unable to change process name); -exit(1); -} + +last_argv_byte = argv[argc - 1] + strlen(argv[argc - 1]); + +len = snprintf(argv[0], last_argv_byte -