From 157a740278f41cac851f88b8aebe047c6fc2414f Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Fri, 28 Aug 2020 14:07:00 +0200 Subject: [PATCH] unix: fix build with Go 1.12 on darwin CL 250437 broke the build with Go 1.12 on darwin, due to SYS_GETDIRENTRIES64 being removed. However, this is still needed to implement Getdirentries for Go 1.12 because it does not provide syscall_syscallPtr for fdopendir. Thus, add _SYS_GETDIRENTRIES64 as an unexported const. Change-Id: I52b420095deeb50d7fac002702dfce01cbf34bb7 Reviewed-on: https://go-review.googlesource.com/c/sys/+/251317 Run-TryBot: Tobias Klauser TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- unix/syscall_darwin.1_12.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/unix/syscall_darwin.1_12.go b/unix/syscall_darwin.1_12.go index 6a15cba6..b31ef035 100644 --- a/unix/syscall_darwin.1_12.go +++ b/unix/syscall_darwin.1_12.go @@ -10,6 +10,8 @@ import ( "unsafe" ) +const _SYS_GETDIRENTRIES64 = 344 + func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { // To implement this using libSystem we'd need syscall_syscallPtr for // fdopendir. However, syscallPtr was only added in Go 1.13, so we fall @@ -20,7 +22,7 @@ func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { } else { p = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_GETDIRENTRIES64, uintptr(fd), uintptr(p), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) + r0, _, e1 := Syscall6(_SYS_GETDIRENTRIES64, uintptr(fd), uintptr(p), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) n = int(r0) if e1 != 0 { return n, errnoErr(e1)