unix: get mainline kernel version in Ubuntu#4131
Conversation
|
While trying to move forward the proposal in #4101, I noticed this quirk in Ubuntu. Not sure how common is this problem in linux distributions but just in case we want to keep working on this. |
bnoordhuis
left a comment
There was a problem hiding this comment.
LGTM with a suggestion. Good catch.
Debian has a similar issue, the real kernel version is in u.version (uname -v), not in u.release (uname -r)
u.version is fairly free-form. A proper scanner looks like this:
needle = strstr(u.version, "Debian ");
if (needle != NULL)
if (3 == sscanf(needle, "Debian %u.%u.%u", &major, &minor, &patch))
goto calculate_version;
Are you ok if I add this code as well? |
|
Of course! :) |
5819eb6 to
057a8e5
Compare
|
@bnoordhuis I added the Debian check in a new commit (and set yourself as the Author). PTAL. Thanks! |
In Ubuntu, the kernel version reported by `uname()` follows the versioning format that Ubuntu uses for their kernels which does not have a direct correspondence with the mainline kernel version they're based on. Get that version from `/proc/version_signature` as documented in: https://wiki.ubuntu.com/Kernel/FAQ#Kernel.2FFAQ.2FGeneralVersionRunning.How_can_we_determine_the_version_of_the_running_kernel.3F
In Debian, the mainline kernel version is reported via the `uname()` `version` field.
057a8e5 to
d76c515
Compare
In Ubuntu, the kernel version reported by `uname()` follows the versioning format that Ubuntu uses for their kernels which does not have a direct correspondence with the mainline kernel version they're based on. Get that version from `/proc/version_signature` as documented in: https://wiki.ubuntu.com/Kernel/FAQ#Kernel.2FFAQ.2FGeneralVersionRunning.How_can_we_determine_the_version_of_the_running_kernel.3F
In Ubuntu, the kernel version reported by
uname()follows the versioning format that Ubuntu uses for their kernels which does not have a direct correspondence with the mainline kernel version they're based on. Get that version from/proc/version_signatureas documented in:https://wiki.ubuntu.com/Kernel/FAQ#Kernel.2FFAQ.2FGeneralVersionRunning.How_can_we_determine_the_version_of_the_running_kernel.3F