1
2
3
4
5
6 package unix
7
8 import (
9 "syscall"
10 "unsafe"
11 )
12
13 var _ syscall.Errno
14
15
16
17 func fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) {
18 _, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask), uintptr(dirFd), uintptr(unsafe.Pointer(pathname)), 0)
19 if e1 != 0 {
20 err = errnoErr(e1)
21 }
22 return
23 }
24
25
26
27 func Fallocate(fd int, mode uint32, off int64, len int64) (err error) {
28 _, _, e1 := Syscall6(SYS_FALLOCATE, uintptr(fd), uintptr(mode), uintptr(off), uintptr(len), 0, 0)
29 if e1 != 0 {
30 err = errnoErr(e1)
31 }
32 return
33 }
34
35
36
37 func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) {
38 r0, _, e1 := Syscall6(SYS_TEE, uintptr(rfd), uintptr(wfd), uintptr(len), uintptr(flags), 0, 0)
39 n = int64(r0)
40 if e1 != 0 {
41 err = errnoErr(e1)
42 }
43 return
44 }
45
46
47
48 func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
49 var _p0 unsafe.Pointer
50 if len(events) > 0 {
51 _p0 = unsafe.Pointer(&events[0])
52 } else {
53 _p0 = unsafe.Pointer(&_zero)
54 }
55 r0, _, e1 := Syscall6(SYS_EPOLL_PWAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0)
56 n = int(r0)
57 if e1 != 0 {
58 err = errnoErr(e1)
59 }
60 return
61 }
62
63
64
65 func Fadvise(fd int, offset int64, length int64, advice int) (err error) {
66 _, _, e1 := Syscall6(SYS_FADVISE64, uintptr(fd), uintptr(offset), uintptr(length), uintptr(advice), 0, 0)
67 if e1 != 0 {
68 err = errnoErr(e1)
69 }
70 return
71 }
72
73
74
75 func Fchown(fd int, uid int, gid int) (err error) {
76 _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid))
77 if e1 != 0 {
78 err = errnoErr(e1)
79 }
80 return
81 }
82
83
84
85 func Fstat(fd int, stat *Stat_t) (err error) {
86 _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
87 if e1 != 0 {
88 err = errnoErr(e1)
89 }
90 return
91 }
92
93
94
95 func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) {
96 var _p0 *byte
97 _p0, err = BytePtrFromString(path)
98 if err != nil {
99 return
100 }
101 _, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0)
102 if e1 != 0 {
103 err = errnoErr(e1)
104 }
105 return
106 }
107
108
109
110 func Fstatfs(fd int, buf *Statfs_t) (err error) {
111 _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(buf)), 0)
112 if e1 != 0 {
113 err = errnoErr(e1)
114 }
115 return
116 }
117
118
119
120 func Ftruncate(fd int, length int64) (err error) {
121 _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0)
122 if e1 != 0 {
123 err = errnoErr(e1)
124 }
125 return
126 }
127
128
129
130 func Getegid() (egid int) {
131 r0, _ := RawSyscallNoError(SYS_GETEGID, 0, 0, 0)
132 egid = int(r0)
133 return
134 }
135
136
137
138 func Geteuid() (euid int) {
139 r0, _ := RawSyscallNoError(SYS_GETEUID, 0, 0, 0)
140 euid = int(r0)
141 return
142 }
143
144
145
146 func Getgid() (gid int) {
147 r0, _ := RawSyscallNoError(SYS_GETGID, 0, 0, 0)
148 gid = int(r0)
149 return
150 }
151
152
153
154 func Getrlimit(resource int, rlim *Rlimit) (err error) {
155 _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
156 if e1 != 0 {
157 err = errnoErr(e1)
158 }
159 return
160 }
161
162
163
164 func Getuid() (uid int) {
165 r0, _ := RawSyscallNoError(SYS_GETUID, 0, 0, 0)
166 uid = int(r0)
167 return
168 }
169
170
171
172 func Listen(s int, n int) (err error) {
173 _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(n), 0)
174 if e1 != 0 {
175 err = errnoErr(e1)
176 }
177 return
178 }
179
180
181
182 func MemfdSecret(flags int) (fd int, err error) {
183 r0, _, e1 := Syscall(SYS_MEMFD_SECRET, uintptr(flags), 0, 0)
184 fd = int(r0)
185 if e1 != 0 {
186 err = errnoErr(e1)
187 }
188 return
189 }
190
191
192
193 func pread(fd int, p []byte, offset int64) (n int, err error) {
194 var _p0 unsafe.Pointer
195 if len(p) > 0 {
196 _p0 = unsafe.Pointer(&p[0])
197 } else {
198 _p0 = unsafe.Pointer(&_zero)
199 }
200 r0, _, e1 := Syscall6(SYS_PREAD64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0)
201 n = int(r0)
202 if e1 != 0 {
203 err = errnoErr(e1)
204 }
205 return
206 }
207
208
209
210 func pwrite(fd int, p []byte, offset int64) (n int, err error) {
211 var _p0 unsafe.Pointer
212 if len(p) > 0 {
213 _p0 = unsafe.Pointer(&p[0])
214 } else {
215 _p0 = unsafe.Pointer(&_zero)
216 }
217 r0, _, e1 := Syscall6(SYS_PWRITE64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0)
218 n = int(r0)
219 if e1 != 0 {
220 err = errnoErr(e1)
221 }
222 return
223 }
224
225
226
227 func Seek(fd int, offset int64, whence int) (off int64, err error) {
228 r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence))
229 off = int64(r0)
230 if e1 != 0 {
231 err = errnoErr(e1)
232 }
233 return
234 }
235
236
237
238 func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
239 r0, _, e1 := Syscall6(SYS_SENDFILE, uintptr(outfd), uintptr(infd), uintptr(unsafe.Pointer(offset)), uintptr(count), 0, 0)
240 written = int(r0)
241 if e1 != 0 {
242 err = errnoErr(e1)
243 }
244 return
245 }
246
247
248
249 func setfsgid(gid int) (prev int, err error) {
250 r0, _, e1 := Syscall(SYS_SETFSGID, uintptr(gid), 0, 0)
251 prev = int(r0)
252 if e1 != 0 {
253 err = errnoErr(e1)
254 }
255 return
256 }
257
258
259
260 func setfsuid(uid int) (prev int, err error) {
261 r0, _, e1 := Syscall(SYS_SETFSUID, uintptr(uid), 0, 0)
262 prev = int(r0)
263 if e1 != 0 {
264 err = errnoErr(e1)
265 }
266 return
267 }
268
269
270
271 func Shutdown(fd int, how int) (err error) {
272 _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0)
273 if e1 != 0 {
274 err = errnoErr(e1)
275 }
276 return
277 }
278
279
280
281 func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) {
282 r0, _, e1 := Syscall6(SYS_SPLICE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags))
283 n = int64(r0)
284 if e1 != 0 {
285 err = errnoErr(e1)
286 }
287 return
288 }
289
290
291
292 func Statfs(path string, buf *Statfs_t) (err error) {
293 var _p0 *byte
294 _p0, err = BytePtrFromString(path)
295 if err != nil {
296 return
297 }
298 _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0)
299 if e1 != 0 {
300 err = errnoErr(e1)
301 }
302 return
303 }
304
305
306
307 func SyncFileRange(fd int, off int64, n int64, flags int) (err error) {
308 _, _, e1 := Syscall6(SYS_SYNC_FILE_RANGE, uintptr(fd), uintptr(off), uintptr(n), uintptr(flags), 0, 0)
309 if e1 != 0 {
310 err = errnoErr(e1)
311 }
312 return
313 }
314
315
316
317 func Truncate(path string, length int64) (err error) {
318 var _p0 *byte
319 _p0, err = BytePtrFromString(path)
320 if err != nil {
321 return
322 }
323 _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0)
324 if e1 != 0 {
325 err = errnoErr(e1)
326 }
327 return
328 }
329
330
331
332 func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) {
333 r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
334 fd = int(r0)
335 if e1 != 0 {
336 err = errnoErr(e1)
337 }
338 return
339 }
340
341
342
343 func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
344 _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen))
345 if e1 != 0 {
346 err = errnoErr(e1)
347 }
348 return
349 }
350
351
352
353 func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
354 _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen))
355 if e1 != 0 {
356 err = errnoErr(e1)
357 }
358 return
359 }
360
361
362
363 func getgroups(n int, list *_Gid_t) (nn int, err error) {
364 r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0)
365 nn = int(r0)
366 if e1 != 0 {
367 err = errnoErr(e1)
368 }
369 return
370 }
371
372
373
374 func setgroups(n int, list *_Gid_t) (err error) {
375 _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0)
376 if e1 != 0 {
377 err = errnoErr(e1)
378 }
379 return
380 }
381
382
383
384 func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) {
385 _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
386 if e1 != 0 {
387 err = errnoErr(e1)
388 }
389 return
390 }
391
392
393
394 func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) {
395 _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0)
396 if e1 != 0 {
397 err = errnoErr(e1)
398 }
399 return
400 }
401
402
403
404 func socket(domain int, typ int, proto int) (fd int, err error) {
405 r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto))
406 fd = int(r0)
407 if e1 != 0 {
408 err = errnoErr(e1)
409 }
410 return
411 }
412
413
414
415 func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) {
416 _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0)
417 if e1 != 0 {
418 err = errnoErr(e1)
419 }
420 return
421 }
422
423
424
425 func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
426 _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
427 if e1 != 0 {
428 err = errnoErr(e1)
429 }
430 return
431 }
432
433
434
435 func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
436 _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
437 if e1 != 0 {
438 err = errnoErr(e1)
439 }
440 return
441 }
442
443
444
445 func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) {
446 var _p0 unsafe.Pointer
447 if len(p) > 0 {
448 _p0 = unsafe.Pointer(&p[0])
449 } else {
450 _p0 = unsafe.Pointer(&_zero)
451 }
452 r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
453 n = int(r0)
454 if e1 != 0 {
455 err = errnoErr(e1)
456 }
457 return
458 }
459
460
461
462 func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) {
463 var _p0 unsafe.Pointer
464 if len(buf) > 0 {
465 _p0 = unsafe.Pointer(&buf[0])
466 } else {
467 _p0 = unsafe.Pointer(&_zero)
468 }
469 _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen))
470 if e1 != 0 {
471 err = errnoErr(e1)
472 }
473 return
474 }
475
476
477
478 func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) {
479 r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags))
480 n = int(r0)
481 if e1 != 0 {
482 err = errnoErr(e1)
483 }
484 return
485 }
486
487
488
489 func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) {
490 r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags))
491 n = int(r0)
492 if e1 != 0 {
493 err = errnoErr(e1)
494 }
495 return
496 }
497
498
499
500 func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) {
501 r0, _, e1 := Syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset))
502 xaddr = uintptr(r0)
503 if e1 != 0 {
504 err = errnoErr(e1)
505 }
506 return
507 }
508
509
510
511 func Gettimeofday(tv *Timeval) (err error) {
512 _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0)
513 if e1 != 0 {
514 err = errnoErr(e1)
515 }
516 return
517 }
518
519
520
521 func kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) {
522 var _p0 *byte
523 _p0, err = BytePtrFromString(cmdline)
524 if err != nil {
525 return
526 }
527 _, _, e1 := Syscall6(SYS_KEXEC_FILE_LOAD, uintptr(kernelFd), uintptr(initrdFd), uintptr(cmdlineLen), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
528 if e1 != 0 {
529 err = errnoErr(e1)
530 }
531 return
532 }
533
534
535
536 func riscvHWProbe(pairs []RISCVHWProbePairs, cpuCount uintptr, cpus *CPUSet, flags uint) (err error) {
537 var _p0 unsafe.Pointer
538 if len(pairs) > 0 {
539 _p0 = unsafe.Pointer(&pairs[0])
540 } else {
541 _p0 = unsafe.Pointer(&_zero)
542 }
543 _, _, e1 := Syscall6(SYS_RISCV_HWPROBE, uintptr(_p0), uintptr(len(pairs)), uintptr(cpuCount), uintptr(unsafe.Pointer(cpus)), uintptr(flags), 0)
544 if e1 != 0 {
545 err = errnoErr(e1)
546 }
547 return
548 }
549
View as plain text