summaryrefslogtreecommitdiff
path: root/kernel_release.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel_release.c')
-rw-r--r--kernel_release.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/kernel_release.c b/kernel_release.c
new file mode 100644
index 0000000..64f1463
--- /dev/null
+++ b/kernel_release.c
@@ -0,0 +1,16 @@
+#include <sys/utsname.h>
+#include <stdio.h>
+
+#include "util.h"
+
+const char *
+kernel_release(void)
+{
+ struct utsname udata;
+
+ if (uname(&udata) < 0) {
+ return NULL;
+ }
+
+ return bprintf("%s", udata.release);
+}