X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Mon, 17 Oct 2011 10:30:16 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: /proc/*/cmdline corrupted Message-ID: <20111017083016.GD30527@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <32663265 DOT post AT talk DOT nabble DOT com> <32665088 DOT post AT talk DOT nabble DOT com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <32665088.post@talk.nabble.com> User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Oct 17 00:41, jan.kolar wrote: > > > > defaria wrote: > > > > Why wouldn't exec(1) be responsible for setting up /proc and therefore > > fill in cmdline with effectively $0 *before* the program itself ever got > > around to calling XrmParseCommand? (I'm not well versed in the > > underlying mechanics here and I have not reviewed the code but I would > > have thought that something like exec would have examined argv/argc > > before the program was ever able to modify it). > > > > The command line is in the memory space of the process. > Exec does set it at the beginning but the program can change it. > > On ancient unix, program 'ps' was looking in the memory of each process > (and therefore it was running setuid root). > On modern unix, kernel provides /proc filesystem whose implementation > is looking into (I suppose) the memory of each process. > On cygwin, the library cygwin1.dll (it is 2011 this year) provides > filesystem, whose implementation > asks each other cygwin process about content of command line. > In the process, a separate thread created by cygwin1.dll assemblies the > answer. > > * Might be, it would be reasonable to set a suitable timeoutsfor IPC > connected to /proc > so that programs likes procps (I do not know about ps) will not get stack > instead of reporting problem, when there is non-responding process, In CVS the /proc communication pipe has a timeout value of 0.5 secs already. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- 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