1
2
3
4
5
6
7 package unix
8
9 import (
10 "syscall"
11 "unsafe"
12 )
13
14 func faccessat(dirfd int, path string, mode uint32, flags int) error {
15 p, err := syscall.BytePtrFromString(path)
16 if err != nil {
17 return err
18 }
19 _, _, errno := syscall.Syscall6(syscall.SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(p)), uintptr(mode), uintptr(flags), 0, 0)
20 if errno != 0 {
21 return errno
22 }
23 return err
24 }
25
26 func Eaccess(path string, mode uint32) error {
27 return faccessat(AT_FDCWD, path, mode, AT_EACCESS)
28 }
29
View as plain text