1
2
3
4
5
6
7 package unix
8
9 import (
10 "internal/abi"
11 "syscall"
12 "unsafe"
13 )
14
15 func libc_readlinkat_trampoline()
16
17
18
19 func Readlinkat(dirfd int, path string, buf []byte) (int, error) {
20 p0, err := syscall.BytePtrFromString(path)
21 if err != nil {
22 return 0, err
23 }
24 var p1 unsafe.Pointer
25 if len(buf) > 0 {
26 p1 = unsafe.Pointer(&buf[0])
27 } else {
28 p1 = unsafe.Pointer(&_zero)
29 }
30 n, _, errno := syscall_syscall6(abi.FuncPCABI0(libc_readlinkat_trampoline),
31 uintptr(dirfd),
32 uintptr(unsafe.Pointer(p0)),
33 uintptr(p1),
34 uintptr(len(buf)),
35 0,
36 0)
37 if errno != 0 {
38 return 0, errno
39 }
40 return int(n), nil
41 }
42
43 func libc_mkdirat_trampoline()
44
45
46
47 func Mkdirat(dirfd int, path string, mode uint32) error {
48 p, err := syscall.BytePtrFromString(path)
49 if err != nil {
50 return err
51 }
52 _, _, errno := syscall_syscall(abi.FuncPCABI0(libc_mkdirat_trampoline),
53 uintptr(dirfd),
54 uintptr(unsafe.Pointer(p)),
55 uintptr(mode))
56 if errno != 0 {
57 return errno
58 }
59 return nil
60 }
61
View as plain text