You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
util-linux/lib/linux_version.c

25 lines
403 B

#include <stdio.h>
#include <sys/utsname.h>
#include "linux_version.h"
int
get_linux_version (void)
{
static int kver = -1;
struct utsname uts;
int major;
int minor;
int teeny;
if (kver != -1)
return kver;
if (uname (&uts))
kver = 0;
else if (sscanf (uts.release, "%d.%d.%d", &major, &minor, &teeny) != 3)
kver = 0;
else
kver = KERNEL_VERSION (major, minor, teeny);
return kver;
}