diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-10-02 13:31:39 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-10-02 13:31:39 -0300 |
commit | 7c557369dab9802084eac4f1fa50bfe9c268a037 (patch) | |
tree | 542a3ab89c733da22052790408fd2c5005c27c60 | |
parent | 1a4c647e7b47d904f183d3083bd6068ed8bfb011 (diff) | |
download | python-linux-procfs-7c557369dab9802084eac4f1fa50bfe9c268a037.tar.gz |
cmdline: Document it
Reported-by: Guy Streeter <streeter@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rwxr-xr-x | procfs/procfs.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/procfs/procfs.py b/procfs/procfs.py index 10aad28..fdacba4 100755 --- a/procfs/procfs.py +++ b/procfs/procfs.py @@ -351,7 +351,7 @@ class process: /home/acme >>> print firefox_process["environ"]["MAIL"] /var/spool/mail/acme - >>> + >>> """ self.environ = {} f = file("/proc/%d/environ" % self.pid) @@ -636,6 +636,25 @@ class interrupts: return irqs class cmdline: + """ + Parses the kernel command line (/proc/cmdline), turning it into a dictionary." + + Useful to figure out if some kernel boolean knob has been turned on, as well + as to find the value associated to other kernel knobs. + + It can also be used to find out about parameters passed to the init process, + such as 'BOOT_IMAGE', etc. + + E.g.: + >>> import procfs + >>> kcmd = procfs.cmdline() + >>> print kcmd.keys() + ['LANG', 'BOOT_IMAGE', 'quiet', 'rhgb', 'rd.lvm.lv', 'ro', 'root'] + >>> print kcmd["BOOT_IMAGE"] + /vmlinuz-4.3.0-rc1+ + >>> + """ + def __init__(self): self.options = {} self.parse() |