Source file
src/syscall/syscall_linux_arm64.go
1
2
3
4
5 package syscall
6
7 import "unsafe"
8
9 const (
10 _SYS_setgroups = SYS_SETGROUPS
11 _SYS_clone3 = 435
12 _SYS_faccessat2 = 439
13 )
14
15
16
17
18
19
20 func Fstatat(fd int, path string, stat *Stat_t, flags int) error {
21 return fstatat(fd, path, stat, flags)
22 }
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43 func Stat(path string, stat *Stat_t) (err error) {
44 return fstatat(_AT_FDCWD, path, stat, 0)
45 }
46
47 func Lchown(path string, uid int, gid int) (err error) {
48 return Fchownat(_AT_FDCWD, path, uid, gid, _AT_SYMLINK_NOFOLLOW)
49 }
50
51 func Lstat(path string, stat *Stat_t) (err error) {
52 return fstatat(_AT_FDCWD, path, stat, _AT_SYMLINK_NOFOLLOW)
53 }
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74 type sigset_t struct {
75 X__val [16]uint64
76 }
77
78
79
80 func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
81 var ts *Timespec
82 if timeout != nil {
83 ts = &Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000}
84 }
85 return pselect(nfd, r, w, e, ts, nil)
86 }
87
88
89
90 func setTimespec(sec, nsec int64) Timespec {
91 return Timespec{Sec: sec, Nsec: nsec}
92 }
93
94 func setTimeval(sec, usec int64) Timeval {
95 return Timeval{Sec: sec, Usec: usec}
96 }
97
98 func futimesat(dirfd int, path string, tv *[2]Timeval) (err error) {
99 if tv == nil {
100 return utimensat(dirfd, path, nil, 0)
101 }
102
103 ts := []Timespec{
104 NsecToTimespec(TimevalToNsec(tv[0])),
105 NsecToTimespec(TimevalToNsec(tv[1])),
106 }
107 return utimensat(dirfd, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
108 }
109
110 func Time(t *Time_t) (Time_t, error) {
111 var tv Timeval
112 err := Gettimeofday(&tv)
113 if err != nil {
114 return 0, err
115 }
116 if t != nil {
117 *t = Time_t(tv.Sec)
118 }
119 return Time_t(tv.Sec), nil
120 }
121
122 func Utime(path string, buf *Utimbuf) error {
123 tv := []Timeval{
124 {Sec: buf.Actime},
125 {Sec: buf.Modtime},
126 }
127 return Utimes(path, tv)
128 }
129
130 func utimes(path string, tv *[2]Timeval) (err error) {
131 if tv == nil {
132 return utimensat(_AT_FDCWD, path, nil, 0)
133 }
134
135 ts := []Timespec{
136 NsecToTimespec(TimevalToNsec(tv[0])),
137 NsecToTimespec(TimevalToNsec(tv[1])),
138 }
139 return utimensat(_AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
140 }
141
142
143 func Getrlimit(resource int, rlim *Rlimit) error {
144 err := prlimit(0, resource, nil, rlim)
145 if err != ENOSYS {
146 return err
147 }
148 return getrlimit(resource, rlim)
149 }
150
151
152 func setrlimit(resource int, rlim *Rlimit) error {
153 err := prlimit(0, resource, rlim, nil)
154 if err != ENOSYS {
155 return err
156 }
157 return setrlimit1(resource, rlim)
158 }
159
160
161 func rawSetrlimit(resource int, rlim *Rlimit) Errno {
162 _, _, errno := RawSyscall6(SYS_PRLIMIT64, 0, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0, 0, 0)
163 if errno != ENOSYS {
164 return errno
165 }
166 _, _, errno = RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
167 return errno
168 }
169
170 func (r *PtraceRegs) PC() uint64 { return r.Pc }
171
172 func (r *PtraceRegs) SetPC(pc uint64) { r.Pc = pc }
173
174 func (iov *Iovec) SetLen(length int) {
175 iov.Len = uint64(length)
176 }
177
178 func (msghdr *Msghdr) SetControllen(length int) {
179 msghdr.Controllen = uint64(length)
180 }
181
182 func (cmsg *Cmsghdr) SetLen(length int) {
183 cmsg.Len = uint64(length)
184 }
185
186 func InotifyInit() (fd int, err error) {
187 return InotifyInit1(0)
188 }
189
190
191
192 func Pause() error {
193 _, err := ppoll(nil, 0, nil, nil)
194 return err
195 }
196
View as plain text