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