Initial implementation of the sys command#7
Merged
jeffmahoney merged 3 commits intocrash-python:crash-wipcrash-python/crash-python:crash-wipfrom Sep 14, 2016
Merged
Initial implementation of the sys command#7jeffmahoney merged 3 commits intocrash-python:crash-wipcrash-python/crash-python:crash-wipfrom
jeffmahoney merged 3 commits intocrash-python:crash-wipcrash-python/crash-python:crash-wipfrom
Conversation
"sys" command will provide many useful information about the dumped system. The initial implementation shows values from struct new_utsname that is accessible via the global variable init_uts_ns.name. All the values will get cached because they might be needed also by other commands. Signed-off-by: Petr Mladek <pmladek@suse.com>
Extend the sys command to print the raw kernel config when called with the "config" parameter. I am sure that the handling of invalid option might be done a better way but I do not know how :-) Signed-off-by: Petr Mladek <pmladek@suse.com>
This patch improves the "sys" command to show the uptime.
For this it creates few more caches.
+ ikconfig_cache holds the values of used config options.
For example: ikconfig_cache["CONFIG_HZ"] = "256"
+ machdep_cache will hold misc machine dependent values in
the expected format. For example, machdep_cache["hz"] = long(256).
+ kernel_cache will hold several detected values. For example,
kernel_cache["uptime"] = "2 days, 13:27:07"
Signed-off-by: Petr Mladek <pmladek@suse.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi Jeff,
this pull request adds an initial implementation of the sys (pysys) command.
It shows "only" 6 things at the moment:
It shows 5 values when called without any parameter:
(gdb) pysys
UPTIME: 00:03:18
NODENAME: dhcp75
RELEASE: 3.12.60-52.49-default
VERSION: #1 SMP Thu Jun 16 06:31:14 UTC 2016 (427261f)
MACHINE: x86_64
It shows raw kernel config when called with the "config" parameter:
(gdb) pysys config
Automatically generated file; DO NOT EDIT.
Linux/x86_64 3.12.60 Kernel Configuration
CONFIG_64BIT=y
CONFIG_X86_64=y
CONFIG_X86=y
...
IMHO, the more interesting thing is that it reads /proc/config.gz from
the crash dump and parse it. Plus it reads few more values. They all are
put into several caches under crash/cache/sys.py. I guess that they will
be useful for many other commands.
IMPORTANT:
First, this is my first "real" hacking in python. I am sure that many things
might be done a better way. Especially, I am not sure about error
handling.
Second, I tried to design it according to the other files and also according
to the crash tool. I am sure that there might be a better design. Especially,
I am not sure about the hierarchy and handling of the caches.
All in all, feel free to reject this pull request and suggest changes. I am
prepared to rework it completely. I am happy that it works as it works.
But I will be even more happy if the design is well suited for the future
development.
FINAL NOTE:
This is my first pull request from github. I hope that I did not screw it
up too much.
Best Regards,
Petr