On Mon, 5 Feb 2001, Bruce Evans wrote:

> On Sun, 4 Feb 2001, Andrzej Bialecki wrote:
> 
> > According to procfs(5), the status line contains several well-defined
> > fields separated by spaces. However, the kernel thread names look like
> > 'swi5: task queue' and 'swi1: net', which results in variable number of
> > space-separated fields. As a consequence, some software that parses this
> > line gives incorrect results.
> 
> I think procfs never actually implemented this.  Program names may
> have spaces in them too.  Of course, the line is too hard to parse if
> the first "field" has spaces in it.  Only MAXCOMLEN and NAME_MAX
> prevent the command name being the contents of another process's
> status line :-).

Ok, then how should this be fixed?

We could escape the space characters with something:

swi5:$task$queue 14 0 0 0 -1,-1 noflags 981365276,40 0,0 0,0 nochan 0 0 0,0 -

and for command name 'my$prog':

my$$prog 334 1 332 0 -1,-1 noflags 981361691,37404 0,0 0,5748 select 0 0 0,0 -

or similar...

The commands with $ in them are much less likely than the names with
spaces, which on -current are guaranteed to occur.

Andrzej Bialecki

//  <[EMAIL PROTECTED]> WebGiro AB, Sweden (http://www.webgiro.com)
// -------------------------------------------------------------------
// ------ FreeBSD: The Power to Serve. http://www.freebsd.org --------
// --- Small & Embedded FreeBSD: http://www.freebsd.org/~picobsd/ ----




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to