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 <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/unix/syscall_darwin.1_12.go b/unix/syscall_darwin.1_12.go
index 6a15cba..b31ef03 100644
--- a/unix/syscall_darwin.1_12.go
+++ b/unix/syscall_darwin.1_12.go
@@ -10,6 +10,8 @@
"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 @@
} 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)