-
-
Notifications
You must be signed in to change notification settings - Fork 440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#480] SysarchMeter to view kernel version/arch info #493
Conversation
I've updated all the The
Does that affect any of the |
Thank you for writing this PR. On first glance the code looks good and reasonable with a few details to still polish. As I'm a bit short on time right now, just a rough overview of what I saw; will take another look later.
Feel free to squash and amend your commits on your branch as needed. Having things in as few independent commits as reasonable, without loosing logical separation of steps is much preferred. |
Sure. Just feel free to implement the meter for the "unsupported" platform by hard-coding something like
Nope. For all practical purposes we can assume FWIW: I'll happily review a PR with a minimal patch to make this work by the first person to demonstrate via video how he got the code compiling on plain 4.3BSD with an C99 compliant compiler … ;-) |
I'm still stuck in 2020 xD, but I changed the files to have 2021.
Now
Changed to Edit: I also updated |
None of this will change during the runtime of htop. So get the data once and be good with it? |
Okay, that means I will need to use static const int SysArchMeter_attributes[] = {HOSTNAME};
// use has_data to check if other variables have been loaded
static struct utsname uname_info;
static char distro_info[256];
static int uname_result;
static bool has_data = false; Is there a way to do this without |
The LSB information /may/ change*. but even then it would suffice fetching it once every 5 minutes. *When the package |
Thank you for your guidance @BenBE!
I'll push from my local system after confirming preferences on the last one. |
Just once. If Ubuntu fixes a typo in their LSB package we can live with htop needing a restart. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks, good. Thank you!
@fasterit, @ginggs, @natoscott: Maybe add |
Small note on the output of |
|
Please no. Parse the prefixes as we do in htop in virtually anything the kernel exposes in /proc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can do without the lsb_valid
check and also keep the flexibility, that not every distribution release may have a codename assigned.
At start, SysArchMeter calls the uname function to obtain the kernel version and architecture. If available, the distro version is obtained by calling lsb_release. The obtained values are stored in static variables and used when updating the meter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Thank you very much for your work on this feature.
Always glad to see new people with their contributions and ideas. :) |
SysarchMeter
calls theuname
function to obtain the kernel version andarchitecture in a
utsname
variable. If theversion
data of theutsname
is not empty, the distro version is also printed.SysarchMeter
follows the style ofHostnameMeter
(uses the same attributes) andDiskIOMeter
(usessnprintf
to print to buffer).Used
astyle -r -xb -s3 -p -xg -c -k1 -W1 \*.c \*.h
to format the two newly added files.Sample Screenshot: