1
2
3
4
5
6
7 package unix
8
9 import (
10 "internal/abi"
11 "syscall"
12 "unsafe"
13 )
14
15
16 func syscall_syscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)
17
18 func libc_faccessat_trampoline()
19
20
21
22 func faccessat(dirfd int, path string, mode uint32, flags int) error {
23 p, err := syscall.BytePtrFromString(path)
24 if err != nil {
25 return err
26 }
27 _, _, errno := syscall_syscall6(abi.FuncPCABI0(libc_faccessat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(p)), uintptr(mode), uintptr(flags), 0, 0)
28 if errno != 0 {
29 return errno
30 }
31 return err
32 }
33
34 func Eaccess(path string, mode uint32) error {
35 return faccessat(AT_FDCWD, path, mode, AT_EACCESS)
36 }
37
View as plain text