From 196b9ba8737a10c9253b04174f25881e562da5b8 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Mon, 31 Aug 2020 11:03:35 +0200 Subject: [PATCH] unix: re-add SYS___SYSCTL on darwin CL 250437 removed all SYS_* consts on darwin as direct syscalls are no longer supported on this platform. However, some external packages (e.g. github.com/shirou/gopsutil) still seem to rely on SYS___SYSCTL being defined to implement their own sysctl wrappers. Re-add SYS___SYSCTL to avoid breaking these packages. Change-Id: I1ef1c05ba47a4b89be61ee8919d1651b7531d9c7 Reviewed-on: https://go-review.googlesource.com/c/sys/+/251738 Run-TryBot: Tobias Klauser TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- unix/syscall_darwin.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/unix/syscall_darwin.go b/unix/syscall_darwin.go index 0cf31acf..e2a05eed 100644 --- a/unix/syscall_darwin.go +++ b/unix/syscall_darwin.go @@ -49,6 +49,11 @@ type SockaddrDatalink struct { raw RawSockaddrDatalink } +// Some external packages rely on SYS___SYSCTL being defined to implement their +// own sysctl wrappers. Provide it here, even though direct syscalls are no +// longer supported on darwin. +const SYS___SYSCTL = 202 + // Translate "kern.hostname" to []_C_int{0,1,2,3}. func nametomib(name string) (mib []_C_int, err error) { const siz = unsafe.Sizeof(mib[0])