delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RP_MATCHES_RCVD,TW_RG,T_TO_NO_BRKTS_FREEMAIL |
X-Spam-Check-By: | sourceware.org |
Message-ID: | <32666054.post@talk.nabble.com> |
Date: | Mon, 17 Oct 2011 03:41:29 -0700 (PDT) |
From: | "jan.kolar" <kolar AT math DOT cas DOT cz> |
To: | cygwin AT cygwin DOT com |
Subject: | Re: /proc/*/cmdline corrupted |
In-Reply-To: | <32665348.post@talk.nabble.com> |
MIME-Version: | 1.0 |
References: | <CAG_2cT=rmeJpmZbYDo7RAwjNcTTDSTH1SMhuzzL9qi09ZJwGyA AT mail DOT gmail DOT com> <32663265 DOT post AT talk DOT nabble DOT com> <CAG_2cTn3km6ASEOK4rEGO=k6Kj=9RYpkRWL=2Beup2fi+hSp0A AT mail DOT gmail DOT com> <32665348 DOT post AT talk DOT nabble DOT com> |
X-IsSubscribed: | yes |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
jan.kolar wrote: > > For example sendmail likes to do that (on Linux): > root 3051 sendmail: accepting connections > smmsp 3061 sendmail: Queue runner AT 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
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |