1
2
3
4
5
6 package unix
7
8 import (
9 "unsafe"
10 )
11
12
13
14 func fcntl(fd int, cmd int, arg int) (val int, err error) {
15 r0, _, e1 := syscall_syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg))
16 val = int(r0)
17 if e1 != 0 {
18 err = errnoErr(e1)
19 }
20 return
21 }
22
23
24
25 func read(fd int, p []byte) (n int, err error) {
26 var _p0 unsafe.Pointer
27 if len(p) > 0 {
28 _p0 = unsafe.Pointer(&p[0])
29 } else {
30 _p0 = unsafe.Pointer(&_zero)
31 }
32 r0, _, e1 := syscall_syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p)))
33 n = int(r0)
34 if e1 != 0 {
35 err = errnoErr(e1)
36 }
37 return
38 }
39
40
41
42 func write(fd int, p []byte) (n int, err error) {
43 var _p0 unsafe.Pointer
44 if len(p) > 0 {
45 _p0 = unsafe.Pointer(&p[0])
46 } else {
47 _p0 = unsafe.Pointer(&_zero)
48 }
49 r0, _, e1 := syscall_syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)))
50 n = int(r0)
51 if e1 != 0 {
52 err = errnoErr(e1)
53 }
54 return
55 }
56
57
58
59 func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) {
60 r0, _, e1 := syscall_syscall(SYS___ACCEPT_A, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
61 fd = int(r0)
62 if e1 != 0 {
63 err = errnoErr(e1)
64 }
65 return
66 }
67
68
69
70 func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
71 _, _, e1 := syscall_syscall(SYS___BIND_A, uintptr(s), uintptr(addr), uintptr(addrlen))
72 if e1 != 0 {
73 err = errnoErr(e1)
74 }
75 return
76 }
77
78
79
80 func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
81 _, _, e1 := syscall_syscall(SYS___CONNECT_A, uintptr(s), uintptr(addr), uintptr(addrlen))
82 if e1 != 0 {
83 err = errnoErr(e1)
84 }
85 return
86 }
87
88
89
90 func getgroups(n int, list *_Gid_t) (nn int, err error) {
91 r0, _, e1 := syscall_rawsyscall(SYS_GETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0)
92 nn = int(r0)
93 if e1 != 0 {
94 err = errnoErr(e1)
95 }
96 return
97 }
98
99
100
101 func setgroups(n int, list *_Gid_t) (err error) {
102 _, _, e1 := syscall_rawsyscall(SYS_SETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0)
103 if e1 != 0 {
104 err = errnoErr(e1)
105 }
106 return
107 }
108
109
110
111 func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) {
112 _, _, e1 := syscall_syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
113 if e1 != 0 {
114 err = errnoErr(e1)
115 }
116 return
117 }
118
119
120
121 func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) {
122 _, _, e1 := syscall_syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0)
123 if e1 != 0 {
124 err = errnoErr(e1)
125 }
126 return
127 }
128
129
130
131 func socket(domain int, typ int, proto int) (fd int, err error) {
132 r0, _, e1 := syscall_rawsyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto))
133 fd = int(r0)
134 if e1 != 0 {
135 err = errnoErr(e1)
136 }
137 return
138 }
139
140
141
142 func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) {
143 _, _, e1 := syscall_rawsyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0)
144 if e1 != 0 {
145 err = errnoErr(e1)
146 }
147 return
148 }
149
150
151
152 func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
153 _, _, e1 := syscall_rawsyscall(SYS___GETPEERNAME_A, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
154 if e1 != 0 {
155 err = errnoErr(e1)
156 }
157 return
158 }
159
160
161
162 func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
163 _, _, e1 := syscall_rawsyscall(SYS___GETSOCKNAME_A, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
164 if e1 != 0 {
165 err = errnoErr(e1)
166 }
167 return
168 }
169
170
171
172 func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) {
173 var _p0 unsafe.Pointer
174 if len(p) > 0 {
175 _p0 = unsafe.Pointer(&p[0])
176 } else {
177 _p0 = unsafe.Pointer(&_zero)
178 }
179 r0, _, e1 := syscall_syscall6(SYS___RECVFROM_A, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
180 n = int(r0)
181 if e1 != 0 {
182 err = errnoErr(e1)
183 }
184 return
185 }
186
187
188
189 func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) {
190 var _p0 unsafe.Pointer
191 if len(buf) > 0 {
192 _p0 = unsafe.Pointer(&buf[0])
193 } else {
194 _p0 = unsafe.Pointer(&_zero)
195 }
196 _, _, e1 := syscall_syscall6(SYS___SENDTO_A, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen))
197 if e1 != 0 {
198 err = errnoErr(e1)
199 }
200 return
201 }
202
203
204
205 func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) {
206 r0, _, e1 := syscall_syscall(SYS___RECVMSG_A, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags))
207 n = int(r0)
208 if e1 != 0 {
209 err = errnoErr(e1)
210 }
211 return
212 }
213
214
215
216 func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) {
217 r0, _, e1 := syscall_syscall(SYS___SENDMSG_A, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags))
218 n = int(r0)
219 if e1 != 0 {
220 err = errnoErr(e1)
221 }
222 return
223 }
224
225
226
227 func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) {
228 r0, _, e1 := syscall_syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos))
229 ret = uintptr(r0)
230 if e1 != 0 {
231 err = errnoErr(e1)
232 }
233 return
234 }
235
236
237
238 func munmap(addr uintptr, length uintptr) (err error) {
239 _, _, e1 := syscall_syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0)
240 if e1 != 0 {
241 err = errnoErr(e1)
242 }
243 return
244 }
245
246
247
248 func ioctl(fd int, req int, arg uintptr) (err error) {
249 _, _, e1 := syscall_syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
250 if e1 != 0 {
251 err = errnoErr(e1)
252 }
253 return
254 }
255
256
257
258 func ioctlPtr(fd int, req int, arg unsafe.Pointer) (err error) {
259 _, _, e1 := syscall_syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
260 if e1 != 0 {
261 err = errnoErr(e1)
262 }
263 return
264 }
265
266
267
268 func Access(path string, mode uint32) (err error) {
269 var _p0 *byte
270 _p0, err = BytePtrFromString(path)
271 if err != nil {
272 return
273 }
274 _, _, e1 := syscall_syscall(SYS___ACCESS_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
275 if e1 != 0 {
276 err = errnoErr(e1)
277 }
278 return
279 }
280
281
282
283 func Chdir(path string) (err error) {
284 var _p0 *byte
285 _p0, err = BytePtrFromString(path)
286 if err != nil {
287 return
288 }
289 _, _, e1 := syscall_syscall(SYS___CHDIR_A, uintptr(unsafe.Pointer(_p0)), 0, 0)
290 if e1 != 0 {
291 err = errnoErr(e1)
292 }
293 return
294 }
295
296
297
298 func Chown(path string, uid int, gid int) (err error) {
299 var _p0 *byte
300 _p0, err = BytePtrFromString(path)
301 if err != nil {
302 return
303 }
304 _, _, e1 := syscall_syscall(SYS___CHOWN_A, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
305 if e1 != 0 {
306 err = errnoErr(e1)
307 }
308 return
309 }
310
311
312
313 func Chmod(path string, mode uint32) (err error) {
314 var _p0 *byte
315 _p0, err = BytePtrFromString(path)
316 if err != nil {
317 return
318 }
319 _, _, e1 := syscall_syscall(SYS___CHMOD_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
320 if e1 != 0 {
321 err = errnoErr(e1)
322 }
323 return
324 }
325
326
327
328 func Creat(path string, mode uint32) (fd int, err error) {
329 var _p0 *byte
330 _p0, err = BytePtrFromString(path)
331 if err != nil {
332 return
333 }
334 r0, _, e1 := syscall_syscall(SYS___CREAT_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
335 fd = int(r0)
336 if e1 != 0 {
337 err = errnoErr(e1)
338 }
339 return
340 }
341
342
343
344 func Dup(oldfd int) (fd int, err error) {
345 r0, _, e1 := syscall_syscall(SYS_DUP, uintptr(oldfd), 0, 0)
346 fd = int(r0)
347 if e1 != 0 {
348 err = errnoErr(e1)
349 }
350 return
351 }
352
353
354
355 func Dup2(oldfd int, newfd int) (err error) {
356 _, _, e1 := syscall_syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
357 if e1 != 0 {
358 err = errnoErr(e1)
359 }
360 return
361 }
362
363
364
365 func Errno2() (er2 int) {
366 uer2, _, _ := syscall_syscall(SYS___ERRNO2, 0, 0, 0)
367 er2 = int(uer2)
368 return
369 }
370
371
372
373 func Err2ad() (eadd *int) {
374 ueadd, _, _ := syscall_syscall(SYS___ERR2AD, 0, 0, 0)
375 eadd = (*int)(unsafe.Pointer(ueadd))
376 return
377 }
378
379
380
381 func Exit(code int) {
382 syscall_syscall(SYS_EXIT, uintptr(code), 0, 0)
383 return
384 }
385
386
387
388 func Fchdir(fd int) (err error) {
389 _, _, e1 := syscall_syscall(SYS_FCHDIR, uintptr(fd), 0, 0)
390 if e1 != 0 {
391 err = errnoErr(e1)
392 }
393 return
394 }
395
396
397
398 func Fchmod(fd int, mode uint32) (err error) {
399 _, _, e1 := syscall_syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0)
400 if e1 != 0 {
401 err = errnoErr(e1)
402 }
403 return
404 }
405
406
407
408 func Fchown(fd int, uid int, gid int) (err error) {
409 _, _, e1 := syscall_syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid))
410 if e1 != 0 {
411 err = errnoErr(e1)
412 }
413 return
414 }
415
416
417
418 func FcntlInt(fd uintptr, cmd int, arg int) (retval int, err error) {
419 r0, _, e1 := syscall_syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg))
420 retval = int(r0)
421 if e1 != 0 {
422 err = errnoErr(e1)
423 }
424 return
425 }
426
427
428
429 func fstat(fd int, stat *Stat_LE_t) (err error) {
430 _, _, e1 := syscall_syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
431 if e1 != 0 {
432 err = errnoErr(e1)
433 }
434 return
435 }
436
437
438
439 func Fstatvfs(fd int, stat *Statvfs_t) (err error) {
440 _, _, e1 := syscall_syscall(SYS_FSTATVFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
441 if e1 != 0 {
442 err = errnoErr(e1)
443 }
444 return
445 }
446
447
448
449 func Fsync(fd int) (err error) {
450 _, _, e1 := syscall_syscall(SYS_FSYNC, uintptr(fd), 0, 0)
451 if e1 != 0 {
452 err = errnoErr(e1)
453 }
454 return
455 }
456
457
458
459 func Ftruncate(fd int, length int64) (err error) {
460 _, _, e1 := syscall_syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0)
461 if e1 != 0 {
462 err = errnoErr(e1)
463 }
464 return
465 }
466
467
468
469 func Getpagesize() (pgsize int) {
470 r0, _, _ := syscall_syscall(SYS_GETPAGESIZE, 0, 0, 0)
471 pgsize = int(r0)
472 return
473 }
474
475
476
477 func Mprotect(b []byte, prot int) (err error) {
478 var _p0 unsafe.Pointer
479 if len(b) > 0 {
480 _p0 = unsafe.Pointer(&b[0])
481 } else {
482 _p0 = unsafe.Pointer(&_zero)
483 }
484 _, _, e1 := syscall_syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot))
485 if e1 != 0 {
486 err = errnoErr(e1)
487 }
488 return
489 }
490
491
492
493 func Msync(b []byte, flags int) (err error) {
494 var _p0 unsafe.Pointer
495 if len(b) > 0 {
496 _p0 = unsafe.Pointer(&b[0])
497 } else {
498 _p0 = unsafe.Pointer(&_zero)
499 }
500 _, _, e1 := syscall_syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags))
501 if e1 != 0 {
502 err = errnoErr(e1)
503 }
504 return
505 }
506
507
508
509 func Poll(fds []PollFd, timeout int) (n int, err error) {
510 var _p0 unsafe.Pointer
511 if len(fds) > 0 {
512 _p0 = unsafe.Pointer(&fds[0])
513 } else {
514 _p0 = unsafe.Pointer(&_zero)
515 }
516 r0, _, e1 := syscall_syscall(SYS_POLL, uintptr(_p0), uintptr(len(fds)), uintptr(timeout))
517 n = int(r0)
518 if e1 != 0 {
519 err = errnoErr(e1)
520 }
521 return
522 }
523
524
525
526 func Times(tms *Tms) (ticks uintptr, err error) {
527 r0, _, e1 := syscall_syscall(SYS_TIMES, uintptr(unsafe.Pointer(tms)), 0, 0)
528 ticks = uintptr(r0)
529 if e1 != 0 {
530 err = errnoErr(e1)
531 }
532 return
533 }
534
535
536
537 func W_Getmntent(buff *byte, size int) (lastsys int, err error) {
538 r0, _, e1 := syscall_syscall(SYS_W_GETMNTENT, uintptr(unsafe.Pointer(buff)), uintptr(size), 0)
539 lastsys = int(r0)
540 if e1 != 0 {
541 err = errnoErr(e1)
542 }
543 return
544 }
545
546
547
548 func W_Getmntent_A(buff *byte, size int) (lastsys int, err error) {
549 r0, _, e1 := syscall_syscall(SYS___W_GETMNTENT_A, uintptr(unsafe.Pointer(buff)), uintptr(size), 0)
550 lastsys = int(r0)
551 if e1 != 0 {
552 err = errnoErr(e1)
553 }
554 return
555 }
556
557
558
559 func mount_LE(path string, filesystem string, fstype string, mtm uint32, parmlen int32, parm string) (err error) {
560 var _p0 *byte
561 _p0, err = BytePtrFromString(path)
562 if err != nil {
563 return
564 }
565 var _p1 *byte
566 _p1, err = BytePtrFromString(filesystem)
567 if err != nil {
568 return
569 }
570 var _p2 *byte
571 _p2, err = BytePtrFromString(fstype)
572 if err != nil {
573 return
574 }
575 var _p3 *byte
576 _p3, err = BytePtrFromString(parm)
577 if err != nil {
578 return
579 }
580 _, _, e1 := syscall_syscall6(SYS___MOUNT_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(mtm), uintptr(parmlen), uintptr(unsafe.Pointer(_p3)))
581 if e1 != 0 {
582 err = errnoErr(e1)
583 }
584 return
585 }
586
587
588
589 func unmount(filesystem string, mtm int) (err error) {
590 var _p0 *byte
591 _p0, err = BytePtrFromString(filesystem)
592 if err != nil {
593 return
594 }
595 _, _, e1 := syscall_syscall(SYS___UMOUNT_A, uintptr(unsafe.Pointer(_p0)), uintptr(mtm), 0)
596 if e1 != 0 {
597 err = errnoErr(e1)
598 }
599 return
600 }
601
602
603
604 func Chroot(path string) (err error) {
605 var _p0 *byte
606 _p0, err = BytePtrFromString(path)
607 if err != nil {
608 return
609 }
610 _, _, e1 := syscall_syscall(SYS___CHROOT_A, uintptr(unsafe.Pointer(_p0)), 0, 0)
611 if e1 != 0 {
612 err = errnoErr(e1)
613 }
614 return
615 }
616
617
618
619 func Uname(buf *Utsname) (err error) {
620 _, _, e1 := syscall_rawsyscall(SYS___UNAME_A, uintptr(unsafe.Pointer(buf)), 0, 0)
621 if e1 != 0 {
622 err = errnoErr(e1)
623 }
624 return
625 }
626
627
628
629 func Gethostname(buf []byte) (err error) {
630 var _p0 unsafe.Pointer
631 if len(buf) > 0 {
632 _p0 = unsafe.Pointer(&buf[0])
633 } else {
634 _p0 = unsafe.Pointer(&_zero)
635 }
636 _, _, e1 := syscall_syscall(SYS___GETHOSTNAME_A, uintptr(_p0), uintptr(len(buf)), 0)
637 if e1 != 0 {
638 err = errnoErr(e1)
639 }
640 return
641 }
642
643
644
645 func Getegid() (egid int) {
646 r0, _, _ := syscall_rawsyscall(SYS_GETEGID, 0, 0, 0)
647 egid = int(r0)
648 return
649 }
650
651
652
653 func Geteuid() (uid int) {
654 r0, _, _ := syscall_rawsyscall(SYS_GETEUID, 0, 0, 0)
655 uid = int(r0)
656 return
657 }
658
659
660
661 func Getgid() (gid int) {
662 r0, _, _ := syscall_rawsyscall(SYS_GETGID, 0, 0, 0)
663 gid = int(r0)
664 return
665 }
666
667
668
669 func Getpid() (pid int) {
670 r0, _, _ := syscall_rawsyscall(SYS_GETPID, 0, 0, 0)
671 pid = int(r0)
672 return
673 }
674
675
676
677 func Getpgid(pid int) (pgid int, err error) {
678 r0, _, e1 := syscall_rawsyscall(SYS_GETPGID, uintptr(pid), 0, 0)
679 pgid = int(r0)
680 if e1 != 0 {
681 err = errnoErr(e1)
682 }
683 return
684 }
685
686
687
688 func Getppid() (pid int) {
689 r0, _, _ := syscall_rawsyscall(SYS_GETPPID, 0, 0, 0)
690 pid = int(r0)
691 return
692 }
693
694
695
696 func Getpriority(which int, who int) (prio int, err error) {
697 r0, _, e1 := syscall_syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0)
698 prio = int(r0)
699 if e1 != 0 {
700 err = errnoErr(e1)
701 }
702 return
703 }
704
705
706
707 func Getrlimit(resource int, rlim *Rlimit) (err error) {
708 _, _, e1 := syscall_rawsyscall(SYS_GETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
709 if e1 != 0 {
710 err = errnoErr(e1)
711 }
712 return
713 }
714
715
716
717 func getrusage(who int, rusage *rusage_zos) (err error) {
718 _, _, e1 := syscall_rawsyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
719 if e1 != 0 {
720 err = errnoErr(e1)
721 }
722 return
723 }
724
725
726
727 func Getsid(pid int) (sid int, err error) {
728 r0, _, e1 := syscall_rawsyscall(SYS_GETSID, uintptr(pid), 0, 0)
729 sid = int(r0)
730 if e1 != 0 {
731 err = errnoErr(e1)
732 }
733 return
734 }
735
736
737
738 func Getuid() (uid int) {
739 r0, _, _ := syscall_rawsyscall(SYS_GETUID, 0, 0, 0)
740 uid = int(r0)
741 return
742 }
743
744
745
746 func Kill(pid int, sig Signal) (err error) {
747 _, _, e1 := syscall_rawsyscall(SYS_KILL, uintptr(pid), uintptr(sig), 0)
748 if e1 != 0 {
749 err = errnoErr(e1)
750 }
751 return
752 }
753
754
755
756 func Lchown(path string, uid int, gid int) (err error) {
757 var _p0 *byte
758 _p0, err = BytePtrFromString(path)
759 if err != nil {
760 return
761 }
762 _, _, e1 := syscall_syscall(SYS___LCHOWN_A, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
763 if e1 != 0 {
764 err = errnoErr(e1)
765 }
766 return
767 }
768
769
770
771 func Link(path string, link string) (err error) {
772 var _p0 *byte
773 _p0, err = BytePtrFromString(path)
774 if err != nil {
775 return
776 }
777 var _p1 *byte
778 _p1, err = BytePtrFromString(link)
779 if err != nil {
780 return
781 }
782 _, _, e1 := syscall_syscall(SYS___LINK_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
783 if e1 != 0 {
784 err = errnoErr(e1)
785 }
786 return
787 }
788
789
790
791 func Listen(s int, n int) (err error) {
792 _, _, e1 := syscall_syscall(SYS_LISTEN, uintptr(s), uintptr(n), 0)
793 if e1 != 0 {
794 err = errnoErr(e1)
795 }
796 return
797 }
798
799
800
801 func lstat(path string, stat *Stat_LE_t) (err error) {
802 var _p0 *byte
803 _p0, err = BytePtrFromString(path)
804 if err != nil {
805 return
806 }
807 _, _, e1 := syscall_syscall(SYS___LSTAT_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
808 if e1 != 0 {
809 err = errnoErr(e1)
810 }
811 return
812 }
813
814
815
816 func Mkdir(path string, mode uint32) (err error) {
817 var _p0 *byte
818 _p0, err = BytePtrFromString(path)
819 if err != nil {
820 return
821 }
822 _, _, e1 := syscall_syscall(SYS___MKDIR_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
823 if e1 != 0 {
824 err = errnoErr(e1)
825 }
826 return
827 }
828
829
830
831 func Mkfifo(path string, mode uint32) (err error) {
832 var _p0 *byte
833 _p0, err = BytePtrFromString(path)
834 if err != nil {
835 return
836 }
837 _, _, e1 := syscall_syscall(SYS___MKFIFO_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
838 if e1 != 0 {
839 err = errnoErr(e1)
840 }
841 return
842 }
843
844
845
846 func Mknod(path string, mode uint32, dev int) (err error) {
847 var _p0 *byte
848 _p0, err = BytePtrFromString(path)
849 if err != nil {
850 return
851 }
852 _, _, e1 := syscall_syscall(SYS___MKNOD_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev))
853 if e1 != 0 {
854 err = errnoErr(e1)
855 }
856 return
857 }
858
859
860
861 func Pread(fd int, p []byte, offset int64) (n int, err error) {
862 var _p0 unsafe.Pointer
863 if len(p) > 0 {
864 _p0 = unsafe.Pointer(&p[0])
865 } else {
866 _p0 = unsafe.Pointer(&_zero)
867 }
868 r0, _, e1 := syscall_syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0)
869 n = int(r0)
870 if e1 != 0 {
871 err = errnoErr(e1)
872 }
873 return
874 }
875
876
877
878 func Pwrite(fd int, p []byte, offset int64) (n int, err error) {
879 var _p0 unsafe.Pointer
880 if len(p) > 0 {
881 _p0 = unsafe.Pointer(&p[0])
882 } else {
883 _p0 = unsafe.Pointer(&_zero)
884 }
885 r0, _, e1 := syscall_syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0)
886 n = int(r0)
887 if e1 != 0 {
888 err = errnoErr(e1)
889 }
890 return
891 }
892
893
894
895 func Readlink(path string, buf []byte) (n int, err error) {
896 var _p0 *byte
897 _p0, err = BytePtrFromString(path)
898 if err != nil {
899 return
900 }
901 var _p1 unsafe.Pointer
902 if len(buf) > 0 {
903 _p1 = unsafe.Pointer(&buf[0])
904 } else {
905 _p1 = unsafe.Pointer(&_zero)
906 }
907 r0, _, e1 := syscall_syscall(SYS___READLINK_A, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)))
908 n = int(r0)
909 if e1 != 0 {
910 err = errnoErr(e1)
911 }
912 return
913 }
914
915
916
917 func Rename(from string, to string) (err error) {
918 var _p0 *byte
919 _p0, err = BytePtrFromString(from)
920 if err != nil {
921 return
922 }
923 var _p1 *byte
924 _p1, err = BytePtrFromString(to)
925 if err != nil {
926 return
927 }
928 _, _, e1 := syscall_syscall(SYS___RENAME_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
929 if e1 != 0 {
930 err = errnoErr(e1)
931 }
932 return
933 }
934
935
936
937 func Rmdir(path string) (err error) {
938 var _p0 *byte
939 _p0, err = BytePtrFromString(path)
940 if err != nil {
941 return
942 }
943 _, _, e1 := syscall_syscall(SYS___RMDIR_A, uintptr(unsafe.Pointer(_p0)), 0, 0)
944 if e1 != 0 {
945 err = errnoErr(e1)
946 }
947 return
948 }
949
950
951
952 func Seek(fd int, offset int64, whence int) (off int64, err error) {
953 r0, _, e1 := syscall_syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence))
954 off = int64(r0)
955 if e1 != 0 {
956 err = errnoErr(e1)
957 }
958 return
959 }
960
961
962
963 func Setpriority(which int, who int, prio int) (err error) {
964 _, _, e1 := syscall_syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio))
965 if e1 != 0 {
966 err = errnoErr(e1)
967 }
968 return
969 }
970
971
972
973 func Setpgid(pid int, pgid int) (err error) {
974 _, _, e1 := syscall_rawsyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0)
975 if e1 != 0 {
976 err = errnoErr(e1)
977 }
978 return
979 }
980
981
982
983 func Setrlimit(resource int, lim *Rlimit) (err error) {
984 _, _, e1 := syscall_rawsyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(lim)), 0)
985 if e1 != 0 {
986 err = errnoErr(e1)
987 }
988 return
989 }
990
991
992
993 func Setregid(rgid int, egid int) (err error) {
994 _, _, e1 := syscall_rawsyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0)
995 if e1 != 0 {
996 err = errnoErr(e1)
997 }
998 return
999 }
1000
1001
1002
1003 func Setreuid(ruid int, euid int) (err error) {
1004 _, _, e1 := syscall_rawsyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0)
1005 if e1 != 0 {
1006 err = errnoErr(e1)
1007 }
1008 return
1009 }
1010
1011
1012
1013 func Setsid() (pid int, err error) {
1014 r0, _, e1 := syscall_rawsyscall(SYS_SETSID, 0, 0, 0)
1015 pid = int(r0)
1016 if e1 != 0 {
1017 err = errnoErr(e1)
1018 }
1019 return
1020 }
1021
1022
1023
1024 func Setuid(uid int) (err error) {
1025 _, _, e1 := syscall_syscall(SYS_SETUID, uintptr(uid), 0, 0)
1026 if e1 != 0 {
1027 err = errnoErr(e1)
1028 }
1029 return
1030 }
1031
1032
1033
1034 func Setgid(uid int) (err error) {
1035 _, _, e1 := syscall_syscall(SYS_SETGID, uintptr(uid), 0, 0)
1036 if e1 != 0 {
1037 err = errnoErr(e1)
1038 }
1039 return
1040 }
1041
1042
1043
1044 func Shutdown(fd int, how int) (err error) {
1045 _, _, e1 := syscall_syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0)
1046 if e1 != 0 {
1047 err = errnoErr(e1)
1048 }
1049 return
1050 }
1051
1052
1053
1054 func stat(path string, statLE *Stat_LE_t) (err error) {
1055 var _p0 *byte
1056 _p0, err = BytePtrFromString(path)
1057 if err != nil {
1058 return
1059 }
1060 _, _, e1 := syscall_syscall(SYS___STAT_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(statLE)), 0)
1061 if e1 != 0 {
1062 err = errnoErr(e1)
1063 }
1064 return
1065 }
1066
1067
1068
1069 func Symlink(path string, link string) (err error) {
1070 var _p0 *byte
1071 _p0, err = BytePtrFromString(path)
1072 if err != nil {
1073 return
1074 }
1075 var _p1 *byte
1076 _p1, err = BytePtrFromString(link)
1077 if err != nil {
1078 return
1079 }
1080 _, _, e1 := syscall_syscall(SYS___SYMLINK_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
1081 if e1 != 0 {
1082 err = errnoErr(e1)
1083 }
1084 return
1085 }
1086
1087
1088
1089 func Sync() {
1090 syscall_syscall(SYS_SYNC, 0, 0, 0)
1091 return
1092 }
1093
1094
1095
1096 func Truncate(path string, length int64) (err error) {
1097 var _p0 *byte
1098 _p0, err = BytePtrFromString(path)
1099 if err != nil {
1100 return
1101 }
1102 _, _, e1 := syscall_syscall(SYS___TRUNCATE_A, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0)
1103 if e1 != 0 {
1104 err = errnoErr(e1)
1105 }
1106 return
1107 }
1108
1109
1110
1111 func Tcgetattr(fildes int, termptr *Termios) (err error) {
1112 _, _, e1 := syscall_syscall(SYS_TCGETATTR, uintptr(fildes), uintptr(unsafe.Pointer(termptr)), 0)
1113 if e1 != 0 {
1114 err = errnoErr(e1)
1115 }
1116 return
1117 }
1118
1119
1120
1121 func Tcsetattr(fildes int, when int, termptr *Termios) (err error) {
1122 _, _, e1 := syscall_syscall(SYS_TCSETATTR, uintptr(fildes), uintptr(when), uintptr(unsafe.Pointer(termptr)))
1123 if e1 != 0 {
1124 err = errnoErr(e1)
1125 }
1126 return
1127 }
1128
1129
1130
1131 func Umask(mask int) (oldmask int) {
1132 r0, _, _ := syscall_syscall(SYS_UMASK, uintptr(mask), 0, 0)
1133 oldmask = int(r0)
1134 return
1135 }
1136
1137
1138
1139 func Unlink(path string) (err error) {
1140 var _p0 *byte
1141 _p0, err = BytePtrFromString(path)
1142 if err != nil {
1143 return
1144 }
1145 _, _, e1 := syscall_syscall(SYS___UNLINK_A, uintptr(unsafe.Pointer(_p0)), 0, 0)
1146 if e1 != 0 {
1147 err = errnoErr(e1)
1148 }
1149 return
1150 }
1151
1152
1153
1154 func Utime(path string, utim *Utimbuf) (err error) {
1155 var _p0 *byte
1156 _p0, err = BytePtrFromString(path)
1157 if err != nil {
1158 return
1159 }
1160 _, _, e1 := syscall_syscall(SYS___UTIME_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(utim)), 0)
1161 if e1 != 0 {
1162 err = errnoErr(e1)
1163 }
1164 return
1165 }
1166
1167
1168
1169 func open(path string, mode int, perm uint32) (fd int, err error) {
1170 var _p0 *byte
1171 _p0, err = BytePtrFromString(path)
1172 if err != nil {
1173 return
1174 }
1175 r0, _, e1 := syscall_syscall(SYS___OPEN_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
1176 fd = int(r0)
1177 if e1 != 0 {
1178 err = errnoErr(e1)
1179 }
1180 return
1181 }
1182
1183
1184
1185 func remove(path string) (err error) {
1186 var _p0 *byte
1187 _p0, err = BytePtrFromString(path)
1188 if err != nil {
1189 return
1190 }
1191 _, _, e1 := syscall_syscall(SYS_REMOVE, uintptr(unsafe.Pointer(_p0)), 0, 0)
1192 if e1 != 0 {
1193 err = errnoErr(e1)
1194 }
1195 return
1196 }
1197
1198
1199
1200 func waitpid(pid int, wstatus *_C_int, options int) (wpid int, err error) {
1201 r0, _, e1 := syscall_syscall(SYS_WAITPID, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options))
1202 wpid = int(r0)
1203 if e1 != 0 {
1204 err = errnoErr(e1)
1205 }
1206 return
1207 }
1208
1209
1210
1211 func gettimeofday(tv *timeval_zos) (err error) {
1212 _, _, e1 := syscall_rawsyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0)
1213 if e1 != 0 {
1214 err = errnoErr(e1)
1215 }
1216 return
1217 }
1218
1219
1220
1221 func pipe(p *[2]_C_int) (err error) {
1222 _, _, e1 := syscall_rawsyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0)
1223 if e1 != 0 {
1224 err = errnoErr(e1)
1225 }
1226 return
1227 }
1228
1229
1230
1231 func utimes(path string, timeval *[2]Timeval) (err error) {
1232 var _p0 *byte
1233 _p0, err = BytePtrFromString(path)
1234 if err != nil {
1235 return
1236 }
1237 _, _, e1 := syscall_syscall(SYS___UTIMES_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0)
1238 if e1 != 0 {
1239 err = errnoErr(e1)
1240 }
1241 return
1242 }
1243
1244
1245
1246 func Select(nmsgsfds int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (ret int, err error) {
1247 r0, _, e1 := syscall_syscall6(SYS_SELECT, uintptr(nmsgsfds), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0)
1248 ret = int(r0)
1249 if e1 != 0 {
1250 err = errnoErr(e1)
1251 }
1252 return
1253 }
1254
View as plain text