jan.kolar wrote: > > For example sendmail likes to do that (on Linux): > root 3051 sendmail: accepting connections > smmsp 3061 sendmail: Queue runner@00:01:00 for > /var/spool/clientmqueue > root 14631 sendmail: server [1.46.244.248] cmd read > root 15254 sendmail: ./p9CDUban025571 mail3.cae3.com.: user > open > entries of sendmail are not nullterminated (!). > Others have set (on Linux) a number of NULL pointers: > 0000000 i n i t [ 3 ] \0 \0 \0 \0 \0 \0 \0 \0 > \0 \0 > 0000000 l p d W a i t i n g \0 \0 \0 >
This was on Linux host.a.b.c. 2.6.18-194.26.1.el5-ipx #1 SMP Wed Dec 8 20:08:05 CET 2010 x86_64 x86_64 x86_64 GNU/Linux Corinna Vinschen-2 wrote > On Linux, /proc/$PID/cmdline always contains the full command line as > it has been when the process got started, irrespectively of changes > after process startup. It looks like the loader creates a copy of the > argv array before calling main. Yes, I agree. A simple C program behaves like that. I did not know how exactly sendmail, lpd, init and other achieve the change. Also perl allows to set $0 with appropriate effect (but not $1). So, Q: how they do that ? A:" It depends " :-) See http://cvs.rutgers.edu/cgi-bin/viewvc.cgi/tags/start/postman1.11/PsTitle.cc?revision=1806&view=markup where (probably) cygwin is SPT_CHANGEARGV and Linux is SPT_REUSEARGV. (And blind xterm modifies its command line in the case SPT_CHANGEARGV. Do the same other programs using XmParseCommand(), or do they first make a working copy of argv pointer array?) This works on Linux to change /proc/<cmd>/cmdline: main (int argc, char **argv) { int i; argv[0][0]='A'; for (i=1; i<argc; i++) argv[i][0]= 'A'+i ; // ! bad for "", much bad if last arg is "" sleep(30); } ./a.out 1 2 3 4 5 & ps -fC a.out A/a.out B C D E F Thanks for the timeout on proc-IPC ! JK -- View this message in context: http://old.nabble.com/-proc-*-cmdline-corrupted-tp32639066p32666054.html Sent from the Cygwin list mailing list archive at Nabble.com. -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple