MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / getKernelInfo

Method getKernelInfo

libraries/systeminfo/src/sys_apple.cpp:9–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7#include <QDebug>
8
9Sys::KernelInfo Sys::getKernelInfo()
10{
11 Sys::KernelInfo out;
12 struct utsname buf;
13 uname(&buf);
14 out.kernelType = KernelType::Darwin;
15 out.kernelName = buf.sysname;
16 QString release = out.kernelVersion = buf.release;
17
18 // TODO: figure out how to detect cursed-ness (macOS emulated on linux via mad hacks and so on)
19 out.isCursed = false;
20
21 out.kernelMajor = 0;
22 out.kernelMinor = 0;
23 out.kernelPatch = 0;
24 auto sections = release.split('-');
25 if(sections.size() >= 1) {
26 auto versionParts = sections[0].split('.');
27 if(versionParts.size() >= 3) {
28 out.kernelMajor = versionParts[0].toInt();
29 out.kernelMinor = versionParts[1].toInt();
30 out.kernelPatch = versionParts[2].toInt();
31 }
32 else {
33 qWarning() << "Not enough version numbers in " << sections[0] << " found " << versionParts.size();
34 }
35 }
36 else {
37 qWarning() << "Not enough '-' sections in " << release << " found " << sections.size();
38 }
39 return out;
40}
41
42#include <sys/sysctl.h>
43

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected