diff --git a/unix/syscall_darwin_amd64.go b/unix/syscall_darwin_amd64.go index db5a02dc..7adb98de 100644 --- a/unix/syscall_darwin_amd64.go +++ b/unix/syscall_darwin_amd64.go @@ -11,6 +11,8 @@ import ( "unsafe" ) +//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) + func Getpagesize() int { return 4096 } func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } diff --git a/unix/types_darwin.go b/unix/types_darwin.go index 2bb15cb8..11532618 100644 --- a/unix/types_darwin.go +++ b/unix/types_darwin.go @@ -241,3 +241,10 @@ type BpfHdr C.struct_bpf_hdr // Terminal handling type Termios C.struct_termios + +// fchmodat-like syscalls. + +const ( + AT_FDCWD = C.AT_FDCWD + AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW +) diff --git a/unix/zsyscall_darwin_amd64.go b/unix/zsyscall_darwin_amd64.go index e28b044e..74606b2f 100644 --- a/unix/zsyscall_darwin_amd64.go +++ b/unix/zsyscall_darwin_amd64.go @@ -1415,6 +1415,22 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func gettimeofday(tp *Timeval) (sec int64, usec int32, err error) { r0, r1, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) sec = int64(r0) diff --git a/unix/ztypes_darwin_amd64.go b/unix/ztypes_darwin_amd64.go index 6bedd16f..04465787 100644 --- a/unix/ztypes_darwin_amd64.go +++ b/unix/ztypes_darwin_amd64.go @@ -455,3 +455,8 @@ type Termios struct { Ispeed uint64 Ospeed uint64 } + +const ( + AT_FDCWD = -0x2 + AT_SYMLINK_NOFOLLOW = 0x20 +)