mirror of
https://github.com/golang/sys.git
synced 2026-02-08 19:56:04 +03:00
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>
This commit is contained in:
committed by
Tobias Klauser
parent
c663848e9a
commit
157a740278
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user