Skip site navigation (1)Skip section navigation (2)
Date:      18 Aug 2001 00:13:59 +0200
From:      Dag-Erling Smorgrav <des@ofug.org>
To:        Josef Karthauser <joe@tao.org.uk>
Cc:        freebsd-fs@FreeBSD.ORG
Subject:   Re: parsing problem with /proc/N/status
Message-ID:  <xzpofpecp20.fsf@flood.ping.uio.no>
In-Reply-To: <20010817102549.A712@tao.org.uk>
References:  <20010817102549.A712@tao.org.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
Josef Karthauser <joe@tao.org.uk> writes:
> 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 not a guru, but I'm the closest thing to a maintainer procfs has
at the moment.  The problem you describe is not limited to -CURRENT,
nor to interrupt threads:

des@xxxxx ~% uname -a
FreeBSD xxxxx.xxxx.xxx.xx 3.5-STABLE FreeBSD 3.5-STABLE #1: Fri Apr 27 09:54:47 CEST 2001     des@xxxxx.xxxx.xxx.xx:/usr/src/sys/compile/XXXXX  i386
des@xxxxx ~% cp /bin/cat 'c a t'
des@xxxxx ~% ./c\ a\ t /proc/curproc/status
c a t 80330 75065 80330 75065 5,1 ctty 998085659,268032 0,0 0,0 nochan 2602 2602 12602,12602,12602,0,69,4711,11000,11002,11381,99

There is no good solution.  The ideal fix would be to use NUL
characters instead of spaces to separate the fields (as is done for
cmdline), but that would (obviously) break backwards compatibility.
Replacing spaces with underscores like your patch does is a hack (and
only a partial hack at that - the process name might contain a
newline).  If we have to go down that road, I'd rather just encode
whitespace and unprintables in octal notation (like ls -B does).

DES
-- 
Dag-Erling Smorgrav - des@ofug.org

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-fs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzpofpecp20.fsf>