lkml.org 
[lkml]   [1996]   [Jul]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Subject[ANSWER] Re: /proc/<pid>/cmdline
Date
From

a.kruczkowski@ic.ac.uk (Mr A.M. Kruczkowski) writes to linux-kernel:

> A brief observation that on my system, cat of /proc/<pid>/cmdline
> gives the cmdline minus spaces between the arguments. Is this
> correct, is my system in need of an upgrade somewhere, or is it an
> error?

No -- they're actually delimited by null characters, which don't
appear as anything when output to your screen. If you "cat
/proc/<pid>/cmdline | less" you'll see things more clearly.

Just about anything, including a space, can be a valid character
_within_ an argument, so only a null can properly delimit two
arguments -- that's why they're used instead of spaces.

Consider the following command:

grep "foo bar" baz

You couldn't accurately represent that in /proc/<pid>/cmdline if
spaces delimited arguments.

-Peter

PS: I'm not sure this thread belonged in linux-kernel to begin with;
move further discussion to email, please.



\
 
 \ /
  Last update: 2005-03-22 13:38    [W:0.090 / U:0.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site