Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Initial implementation of the sys command#7

Merged
jeffmahoney merged 3 commits intocrash-python:crash-wipcrash-python/crash-python:crash-wipfrom
pmladek:command-syspmladek/crash-python:command-sysCopy head branch name to clipboard
Sep 14, 2016
Merged

Initial implementation of the sys command#7
jeffmahoney merged 3 commits intocrash-python:crash-wipcrash-python/crash-python:crash-wipfrom
pmladek:command-syspmladek/crash-python:command-sysCopy head branch name to clipboard

Conversation

@pmladek
Copy link
Contributor

@pmladek pmladek commented Jul 1, 2016

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

pmladek added 3 commits July 1, 2016 13:51
"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>
@jeffmahoney jeffmahoney merged commit 4ccb3cc into crash-python:crash-wip Sep 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.