MCPcopy Create free account
hub / github.com/ashvardanian/less_slow.cpp / fetch_linux_kernel_version

Function fetch_linux_kernel_version

less_slow.cpp:6952–6959  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6950#include <sys/mman.h> // `mmap`, `munmap`
6951
6952std::pair<int, int> fetch_linux_kernel_version() {
6953 struct utsname buffer;
6954 if (uname(&buffer) < 0) throw std::runtime_error("Failed to fetch Linux kernel version");
6955 int major = 0, minor = 0;
6956 // Attempt to parse something like "5.19.0-38-generic" into major=5, minor=19
6957 std::sscanf(buffer.release, "%d.%d", &major, &minor);
6958 return {major, minor};
6959}
6960
6961/**
6962 * @brief Memory allocator, sharing the same memory region between the kernel and user-space.

Callers 3

rpc_uring55Function · 0.85
rpc_uring60Function · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected