14#include <sys/sysctl.h>
16#include <sys/utsname.h>
23 ::memset(&un, 0,
sizeof(un));
25 return llvm::VersionTuple();
27 uint32_t major, minor;
28 int status = ::sscanf(un.release,
"%" PRIu32
".%" PRIu32, &major, &minor);
31 return llvm::VersionTuple(major);
33 return llvm::VersionTuple(major, minor);
35 return llvm::VersionTuple();
39 int mib[2] = {CTL_KERN, KERN_OSREV};
41 size_t osrev_len =
sizeof(osrev);
43 if (::sysctl(mib, 2, &osrev, &osrev_len, NULL, 0) == 0)
44 return llvm::formatv(
"{0,8:8}", osrev).str();
51 return g_program_filespec;
static std::optional< std::string > GetOSBuildString()
static llvm::VersionTuple GetOSVersion()
static FileSpec GetProgramFileSpec()
A class that represents a running process on the host machine.