oss-sec mailing list archives
Re: [patch] proc.5: tell how to parse /proc/*/stat correctly
From: Steffen Nurpmeso <steffen () sdaoden eu>
Date: Wed, 28 Dec 2022 19:02:56 +0100
Shawn Webb wrote in <20221228152458.6xyksrxunukjrtzx@mutt-hbsd>: |On Tue, Dec 27, 2022 at 04:44:49PM -0800, Lyndon Nerenberg (VE7TFX/VE6BBM) \ |wrote: |> Dominique Martinet writes: |>> But, really, I just don't see how this can practically be said to \ |>> be parsable... |> |> In its current form it never will be. The solution is to place |> this variable-length field last. Then you can "cut -d ' ' -f 51-" |> to get the command+args part (assuming I counted all those fields |> correctly ...) |> |> Of course, this breaks backwards compatability. | |It would also break forwards compatibility in the case new fields |needed to be added. | |The only solution would be a libxo-style feature wherein a |machine-parseable format is exposed by virtue of a file extension. | |Examples: | |1. /proc/pid/stats.json |2. /proc/pid/stats.xml |3. /proc/pid/stats.yaml_shouldnt_be_a_thing Or, rather, in my thought, because this gets too crowded, let procfs only show /proc/pid/stats but let it be opened with whatever extension, and "let it dynamically check for an according creator". Ie like Apple has those packages which you could look into. Or simply offer stats.0 where \0 is the field separator(, and \0\0 is the last entry). One could even dream of KEY=VALUE\0 pairs, like state=R\0 Then not even the order matters no more, and there would be a bit of self-description without a documentation. (Ach!! If the IETF would go that route more often. Sigh.) --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:
- Re: [patch] proc.5: tell how to parse /proc/*/stat correctly, (continued)
- Re: [patch] proc.5: tell how to parse /proc/*/stat correctly John Helmert III (Dec 28)
- Re: [patch] proc.5: tell how to parse /proc/*/stat correctly Shawn Webb (Dec 28)
- Re: [patch] proc.5: tell how to parse /proc/*/stat correctly Alejandro Colomar (Dec 28)
- Re: [patch] proc.5: tell how to parse /proc/*/stat correctly Theodore Ts'o (Dec 29)
- Re: [patch] proc.5: tell how to parse /proc/*/stat correctly Demi Marie Obenour (Dec 29)
- Re: [patch] proc.5: tell how to parse /proc/*/stat correctly Alan Coopersmith (Dec 29)
- Re: [patch] proc.5: tell how to parse /proc/*/stat correctly Steffen Nurpmeso (Dec 29)
- Re: [patch] proc.5: tell how to parse /proc/*/stat correctly David A. Wheeler (Dec 29)
- Re: [patch] proc.5: tell how to parse /proc/*/stat correctly Jeffrey Walton (Dec 29)
- Re: [patch] proc.5: tell how to parse /proc/*/stat correctly Steffen Nurpmeso (Dec 29)
- Re: [patch] proc.5: tell how to parse /proc/*/stat correctly Steffen Nurpmeso (Dec 28)
- RE: [patch] proc.5: tell how to parse /proc/*/stat correctly David Laight (Dec 31)
- Re: [patch] proc.5: tell how to parse /proc/*/stat correctly Solar Designer (Dec 31)
- Message not available
- Re: [patch] proc.5: tell how to parse /proc/*/stat correctly Jakub Wilk (Dec 30)