aboutsummaryrefslogtreecommitdiff
path: root/core/sys
diff options
context:
space:
mode:
authorJeroen van Rijn <Kelimion@users.noreply.github.com>2022-09-02 02:14:48 +0200
committerJeroen van Rijn <Kelimion@users.noreply.github.com>2022-09-02 02:14:48 +0200
commit45691a462282016368d1740fccb4488a331ca172 (patch)
tree2fd09804ce8a439e0f34b98c08691fddcebae595 /core/sys
parent9e47c72b98b63a7c3780bf5e62203f537cac40b5 (diff)
[sys/info] Add sysctl MIBs for MacOS.
Diffstat (limited to 'core/sys')
-rw-r--r--core/sys/info/platform_darwin.odin31
1 files changed, 27 insertions, 4 deletions
diff --git a/core/sys/info/platform_darwin.odin b/core/sys/info/platform_darwin.odin
index f0b572d2b..21153a6ad 100644
--- a/core/sys/info/platform_darwin.odin
+++ b/core/sys/info/platform_darwin.odin
@@ -13,9 +13,6 @@ init_os_version :: proc "c" () {
init_ram :: proc() {
// Retrieve RAM info using `sysinfo`
- CTL_HW :: 6
- HW_MEMSIZE :: 24
-
mib := []i32{CTL_HW, HW_MEMSIZE}
mem_size: i64
ok := sysctl(mib, &mem_size)
@@ -34,4 +31,30 @@ sysctl :: proc(mib: []i32, val: ^$T) -> (ok: bool) {
uintptr(0), uintptr(0),
)
return res == 0
-} \ No newline at end of file
+}
+
+// See sysctl.h for xnu/dwrwin for details
+CTL_KERN :: 1
+ KERN_OSTYPE :: 1 /* string: system version */
+ KERN_OSRELEASE :: 2 /* string: system release */
+ KERN_OSREV :: 3 /* int: system revision */
+ KERN_VERSION :: 4 /* string: compile time info */
+ KERN_OSRELDATE :: 26 /* int: OS release date */
+ KERN_OSVERSION :: 65 /* for build number i.e. 9A127 */
+CTL_VM :: 2
+CTL_VFS :: 3
+CTL_NET :: 4
+CTL_DEBUG :: 5
+CTL_HW :: 6
+ HW_MACHINE :: 1 /* string: machine class */
+ HW_MODEL :: 2 /* string: specific machine model */
+ HW_NCPU :: 3 /* int: number of cpus */
+ HW_BYTEORDER :: 4 /* int: machine byte order */
+ HW_MACHINE_ARCH :: 12 /* string: machine architecture */
+ HW_VECTORUNIT :: 13 /* int: has HW vector unit? */
+ HW_MEMSIZE :: 24 /* uint64_t: physical ram size */
+ HW_AVAILCPU :: 25 /* int: number of available CPUs */
+
+CTL_MACHDEP :: 7
+CTL_USER :: 8
+