MCPcopy Create free account
hub / github.com/Codesire-Deng/co_context / check_kernel_version

Function check_kernel_version

extern/liburingcxx/example/httpd.cpp:75–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75int check_kernel_version() {
76 struct utsname buffer;
77 char *p;
78 long ver[16];
79 int i = 0;
80
81 if (uname(&buffer) != 0) {
82 perror("uname");
83 exit(EXIT_FAILURE);
84 }
85
86 p = buffer.release;
87
88 while (*p) {
89 if (isdigit(*p)) {
90 ver[i] = strtol(p, &p, 10);
91 i++;
92 } else {
93 p++;
94 }
95 }
96 printf(
97 "Minimum kernel version required is: %d.%d\n", MIN_KERNEL_VERSION,
98 MIN_MAJOR_VERSION
99 );
100 if (ver[0] > MIN_KERNEL_VERSION
101 || (ver[0] == MIN_KERNEL_VERSION && ver[1] >= MIN_MAJOR_VERSION)) {
102 printf("Your kernel version is: %ld.%ld\n", ver[0], ver[1]);
103 return 0;
104 }
105 fprintf(stderr, "Error: your kernel version is: %ld.%ld\n", ver[0], ver[1]);
106 return 1;
107}
108
109void check_for_index_file() {
110 struct stat st;

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected