oss-sec mailing list archives

Re: [patch] proc.5: tell how to parse /proc/*/stat correctly


From: Steffen Nurpmeso <steffen () sdaoden eu>
Date: Thu, 29 Dec 2022 18:44:47 +0100

Alan Coopersmith wrote in
 <b31213da-5ea2-d1f8-dcb2-2917b787ce89 () oracle com>:
 |On 12/28/22 08:47, Demi Marie Obenour wrote:
 |> A binary format would be even better.  No risk of ambiguity.
 |
 |That is how the Solaris (and now illumos) /proc has always worked - fewer
 |parsing problems, but you need to use tools to handle the contents, not
 |just cat/less/etc.
 |
 |https://docs.oracle.com/cd/E88353_01/html/E37852/proc-5.html

I personally find it highly beneficial to grasp informations meant
for human consumption with UNIX text tools.
..And still blinded by Pike's "just make it a string".

If you have an FS="\0" compatible awk(1) (not nawk, not busybox
awk (yet)) it is very easy to parse such text files.

P.S.: CBOR .. if you want JSON.  (The NetBSD folks got that long
before it was hip, where i saw it first.)

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Current thread: