From owner-freebsd-fs Sat Aug 18 17:49: 1 2001 Delivered-To: freebsd-fs@freebsd.org Received: from capybara.eecs.harvard.edu (capybara.eecs.harvard.edu [140.247.62.36]) by hub.freebsd.org (Postfix) with ESMTP id 5EEEA37B407 for ; Sat, 18 Aug 2001 17:48:58 -0700 (PDT) (envelope-from ellard@eecs.harvard.edu) Received: from localhost (ellard@localhost) by capybara.eecs.harvard.edu (8.11.3/8.11.3) with ESMTP id f7J0o1V75644; Sat, 18 Aug 2001 20:50:03 -0400 (EDT) (envelope-from ellard@eecs.harvard.edu) X-Authentication-Warning: capybara.eecs.harvard.edu: ellard owned process doing -bs Date: Sat, 18 Aug 2001 20:50:01 -0400 (EDT) From: Dan Ellard To: Josef Karthauser Cc: , Dan Ellard Subject: Re: parsing problem with /proc/N/status In-Reply-To: <20010817102549.A712@tao.org.uk> Message-ID: <20010818204221.I75599-100000@capybara.eecs.harvard.edu> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-fs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Fri, 17 Aug 2001, Josef Karthauser wrote: > I've raised PR29682 about a problem parsing /proc/N/status (procfs) in > -current. The problem occurs when process names contain spaces, like > all of the 'irqN: xxx' ones do. Is there a procfs guru here that would > mind taking a look for me? I'm nearly as far as possible from being a guru in this area... But after reading through the man page, it looks like the only field you need to worry about containing spaces is the first field. If this is true, then if you parse the string *backwards*, after you've plucked out all the other fields, whatever remains is the command name. (The value from procfs should consist of 11+x tokens (where x > 0). The last 11 match up with the last 11 fields, and the first x get combined to form the command name.) -Dan To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-fs" in the body of the message