Commit 4fd41e49 authored by Ian Lance Taylor's avatar Ian Lance Taylor

syscall: Permit non-blocking syscalls.

Permit system calls to be designated as non-blocking, meaning
that we simply call them without involving the scheduler.

This change by itself is mostly performance neutral.  In
combination with a following change to the net package there
is a performance advantage.

R=rsc, dfc, r2, iant2, rsc1
CC=golang-dev
https://golang.org/cl/4278055
parent e39dc768
...@@ -81,3 +81,27 @@ ok1: ...@@ -81,3 +81,27 @@ ok1:
MOVL DX, 24(SP) // r2 MOVL DX, 24(SP) // r2
MOVL $0, 28(SP) // errno MOVL $0, 28(SP) // errno
RET RET
TEXT ·RawSyscall6(SB),7,$0
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
LEAL 8(SP), SI
LEAL 4(SP), DI
CLD
MOVSL
MOVSL
MOVSL
MOVSL
MOVSL
MOVSL
INT $0x80
JAE ok2
MOVL $-1, 32(SP) // r1
MOVL $-1, 36(SP) // r2
MOVL AX, 40(SP) // errno
RET
ok2:
MOVL AX, 32(SP) // r1
MOVL DX, 36(SP) // r2
MOVL $0, 40(SP) // errno
RET
...@@ -78,3 +78,24 @@ ok1: ...@@ -78,3 +78,24 @@ ok1:
MOVQ DX, 48(SP) // r2 MOVQ DX, 48(SP) // r2
MOVQ $0, 56(SP) // errno MOVQ $0, 56(SP) // errno
RET RET
TEXT ·RawSyscall6(SB),7,$0
MOVQ 16(SP), DI
MOVQ 24(SP), SI
MOVQ 32(SP), DX
MOVQ 40(SP), R10
MOVQ 48(SP), R8
MOVQ 56(SP), R9
MOVQ 8(SP), AX // syscall entry
ADDQ $0x2000000, AX
SYSCALL
JCC ok2
MOVQ $-1, 64(SP) // r1
MOVQ $0, 72(SP) // r2
MOVQ AX, 80(SP) // errno
RET
ok2:
MOVQ AX, 64(SP) // r1
MOVQ DX, 72(SP) // r2
MOVQ $0, 80(SP) // errno
RET
...@@ -81,3 +81,27 @@ ok1: ...@@ -81,3 +81,27 @@ ok1:
MOVL DX, 24(SP) // r2 MOVL DX, 24(SP) // r2
MOVL $0, 28(SP) // errno MOVL $0, 28(SP) // errno
RET RET
TEXT ·RawSyscall6(SB),7,$0
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
LEAL 8(SP), SI
LEAL 4(SP), DI
CLD
MOVSL
MOVSL
MOVSL
MOVSL
MOVSL
MOVSL
INT $0x80
JAE ok2
MOVL $-1, 32(SP) // r1
MOVL $-1, 36(SP) // r2
MOVL AX, 40(SP) // errno
RET
ok2:
MOVL AX, 32(SP) // r1
MOVL DX, 36(SP) // r2
MOVL $0, 40(SP) // errno
RET
...@@ -75,3 +75,23 @@ ok1: ...@@ -75,3 +75,23 @@ ok1:
MOVQ DX, 48(SP) // r2 MOVQ DX, 48(SP) // r2
MOVQ $0, 56(SP) // errno MOVQ $0, 56(SP) // errno
RET RET
TEXT ·RawSyscall6(SB),7,$0
MOVQ 16(SP), DI
MOVQ 24(SP), SI
MOVQ 32(SP), DX
MOVQ 40(SP), R10
MOVQ 48(SP), R8
MOVQ 56(SP), R9
MOVQ 8(SP), AX // syscall entry
SYSCALL
JCC ok2
MOVQ $-1, 64(SP) // r1
MOVQ $0, 72(SP) // r2
MOVQ AX, 80(SP) // errno
RET
ok2:
MOVQ AX, 64(SP) // r1
MOVQ DX, 72(SP) // r2
MOVQ $0, 80(SP) // errno
RET
...@@ -82,6 +82,30 @@ ok1: ...@@ -82,6 +82,30 @@ ok1:
MOVL $0, 28(SP) // errno MOVL $0, 28(SP) // errno
RET RET
// func RawSyscall6(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr);
// Actually RawSyscall5 but the rest of the code expects it to be named RawSyscall6.
TEXT ·RawSyscall6(SB),7,$0
MOVL 4(SP), AX // syscall entry
MOVL 8(SP), BX
MOVL 12(SP), CX
MOVL 16(SP), DX
MOVL 20(SP), SI
MOVL 24(SP), DI
// 28(SP) is ignored
INT $0x80
CMPL AX, $0xfffff001
JLS ok2
MOVL $-1, 32(SP) // r1
MOVL $0, 36(SP) // r2
NEGL AX
MOVL AX, 40(SP) // errno
RET
ok2:
MOVL AX, 32(SP) // r1
MOVL DX, 36(SP) // r2
MOVL $0, 40(SP) // errno
RET
#define SYS_SOCKETCALL 102 /* from zsysnum_linux_386.go */ #define SYS_SOCKETCALL 102 /* from zsysnum_linux_386.go */
// func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, errno int) // func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, errno int)
...@@ -108,6 +132,27 @@ oksock: ...@@ -108,6 +132,27 @@ oksock:
CALL runtime·exitsyscall(SB) CALL runtime·exitsyscall(SB)
RET RET
// func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, errno int)
// Kernel interface gets call sub-number and pointer to a0.
TEXT ·rawsocketcall(SB),7,$0
MOVL $SYS_SOCKETCALL, AX // syscall entry
MOVL 4(SP), BX // socket call number
LEAL 8(SP), CX // pointer to call arguments
MOVL $0, DX
MOVL $0, SI
MOVL $0, DI
INT $0x80
CMPL AX, $0xfffff001
JLS oksock1
MOVL $-1, 32(SP) // n
NEGL AX
MOVL AX, 36(SP) // errno
RET
oksock1:
MOVL AX, 32(SP) // n
MOVL $0, 36(SP) // errno
RET
#define SYS__LLSEEK 140 /* from zsysnum_linux_386.go */ #define SYS__LLSEEK 140 /* from zsysnum_linux_386.go */
// func Seek(fd int, offset int64, whence int) (newoffset int64, errno int) // func Seek(fd int, offset int64, whence int) (newoffset int64, errno int)
// Implemented in assembly to avoid allocation when // Implemented in assembly to avoid allocation when
......
...@@ -83,6 +83,28 @@ ok1: ...@@ -83,6 +83,28 @@ ok1:
MOVQ $0, 56(SP) // errno MOVQ $0, 56(SP) // errno
RET RET
TEXT ·RawSyscall6(SB),7,$0
MOVQ 16(SP), DI
MOVQ 24(SP), SI
MOVQ 32(SP), DX
MOVQ 40(SP), R10
MOVQ 48(SP), R8
MOVQ 56(SP), R9
MOVQ 8(SP), AX // syscall entry
SYSCALL
CMPQ AX, $0xfffffffffffff001
JLS ok2
MOVQ $-1, 64(SP) // r1
MOVQ $0, 72(SP) // r2
NEGQ AX
MOVQ AX, 80(SP) // errno
RET
ok2:
MOVQ AX, 64(SP) // r1
MOVQ DX, 72(SP) // r2
MOVQ $0, 80(SP) // errno
RET
TEXT ·Gettimeofday(SB),7,$0 TEXT ·Gettimeofday(SB),7,$0
MOVQ 8(SP), DI MOVQ 8(SP), DI
MOVQ $0, SI MOVQ $0, SI
......
...@@ -67,6 +67,34 @@ ok6: ...@@ -67,6 +67,34 @@ ok6:
BL runtime·exitsyscall(SB) BL runtime·exitsyscall(SB)
RET RET
// func RawSyscall6(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr);
// Actually RawSyscall5 but the rest of the code expects it to be named RawSyscall6.
TEXT ·RawSyscall6(SB),7,$0
MOVW 4(SP), R7 // syscall entry
MOVW 8(SP), R0
MOVW 12(SP), R1
MOVW 16(SP), R2
MOVW 20(SP), R3
MOVW 24(SP), R4
MOVW 28(SP), R5
SWI $0
MOVW $0xfffff001, R6
CMP R6, R0
BLS ok2
MOVW $-1, R1
MOVW R1, 32(SP) // r1
MOVW $0, R2
MOVW R2, 36(SP) // r2
RSB $0, R0, R0
MOVW R0, 40(SP) // errno
RET
ok2:
MOVW R0, 32(SP) // r1
MOVW R1, 36(SP) // r2
MOVW $0, R0
MOVW R0, 40(SP) // errno
RET
#define SYS__LLSEEK 140 /* from zsysnum_linux_arm.go */ #define SYS__LLSEEK 140 /* from zsysnum_linux_arm.go */
// func Seek(fd int, offset int64, whence int) (newoffset int64, errno int) // func Seek(fd int, offset int64, whence int) (newoffset int64, errno int)
// Implemented in assembly to avoid allocation when // Implemented in assembly to avoid allocation when
......
...@@ -13,6 +13,12 @@ ...@@ -13,6 +13,12 @@
# the (x, y, z int) shorthand is not allowed. # the (x, y, z int) shorthand is not allowed.
# * If the return parameter is an error number, it must be named errno. # * If the return parameter is an error number, it must be named errno.
# A line beginning with //sysnb is like //sys, except that the
# goroutine will not be suspended during the execution of the system
# call. This must only be used for system calls which can never
# block, as otherwise the system call could cause all goroutines to
# hang.
$cmdline = "mksyscall.sh " . join(' ', @ARGV); $cmdline = "mksyscall.sh " . join(' ', @ARGV);
$errors = 0; $errors = 0;
$_32bit = ""; $_32bit = "";
...@@ -61,17 +67,18 @@ while(<>) { ...@@ -61,17 +67,18 @@ while(<>) {
s/\s+/ /g; s/\s+/ /g;
s/^\s+//; s/^\s+//;
s/\s+$//; s/\s+$//;
next if !/^\/\/sys /; my $nonblock = /^\/\/sysnb /;
next if !/^\/\/sys / && !$nonblock;
# Line must be of the form # Line must be of the form
# func Open(path string, mode int, perm int) (fd int, errno int) # func Open(path string, mode int, perm int) (fd int, errno int)
# Split into name, in params, out params. # Split into name, in params, out params.
if(!/^\/\/sys (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(SYS_[A-Z0-9_]+))?$/) { if(!/^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(SYS_[A-Z0-9_]+))?$/) {
print STDERR "$ARGV:$.: malformed //sys declaration\n"; print STDERR "$ARGV:$.: malformed //sys declaration\n";
$errors = 1; $errors = 1;
next; next;
} }
my ($func, $in, $out, $sysname) = ($1, $2, $3, $4); my ($func, $in, $out, $sysname) = ($2, $3, $4, $5);
# Split argument lists on comma. # Split argument lists on comma.
my @in = parseparamlist($in); my @in = parseparamlist($in);
...@@ -119,12 +126,15 @@ while(<>) { ...@@ -119,12 +126,15 @@ while(<>) {
# Determine which form to use; pad args with zeros. # Determine which form to use; pad args with zeros.
my $asm = "Syscall"; my $asm = "Syscall";
if ($nonblock) {
$asm = "RawSyscall";
}
if(@args <= 3) { if(@args <= 3) {
while(@args < 3) { while(@args < 3) {
push @args, "0"; push @args, "0";
} }
} elsif(@args <= 6) { } elsif(@args <= 6) {
$asm = "Syscall6"; $asm .= "6";
while(@args < 6) { while(@args < 6) {
push @args, "0"; push @args, "0";
} }
......
...@@ -27,8 +27,8 @@ func Getwd() (string, int) { return "", ENOTSUP } ...@@ -27,8 +27,8 @@ func Getwd() (string, int) { return "", ENOTSUP }
* Wrapped * Wrapped
*/ */
//sys getgroups(ngid int, gid *_Gid_t) (n int, errno int) //sysnb getgroups(ngid int, gid *_Gid_t) (n int, errno int)
//sys setgroups(ngid int, gid *_Gid_t) (errno int) //sysnb setgroups(ngid int, gid *_Gid_t) (errno int)
func Getgroups() (gids []int, errno int) { func Getgroups() (gids []int, errno int) {
n, err := getgroups(0, nil) n, err := getgroups(0, nil)
...@@ -130,7 +130,7 @@ func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, ...@@ -130,7 +130,7 @@ func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int,
return return
} }
//sys pipe() (r int, w int, errno int) //sysnb pipe() (r int, w int, errno int)
func Pipe(p []int) (errno int) { func Pipe(p []int) (errno int) {
if len(p) != 2 { if len(p) != 2 {
...@@ -148,10 +148,10 @@ func Sleep(ns int64) (errno int) { ...@@ -148,10 +148,10 @@ func Sleep(ns int64) (errno int) {
//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, errno int) //sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, errno int)
//sys bind(s int, addr uintptr, addrlen _Socklen) (errno int) //sys bind(s int, addr uintptr, addrlen _Socklen) (errno int)
//sys connect(s int, addr uintptr, addrlen _Socklen) (errno int) //sys connect(s int, addr uintptr, addrlen _Socklen) (errno int)
//sys socket(domain int, typ int, proto int) (fd int, errno int) //sysnb socket(domain int, typ int, proto int) (fd int, errno int)
//sys setsockopt(s int, level int, name int, val uintptr, vallen int) (errno int) //sys setsockopt(s int, level int, name int, val uintptr, vallen int) (errno int)
//sys getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int) //sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int)
//sys getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int) //sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int)
//sys Shutdown(s int, how int) (errno int) //sys Shutdown(s int, how int) (errno int)
// For testing: clients can set this flag to force // For testing: clients can set this flag to force
...@@ -355,7 +355,7 @@ func Socket(domain, typ, proto int) (fd, errno int) { ...@@ -355,7 +355,7 @@ func Socket(domain, typ, proto int) (fd, errno int) {
return return
} }
//sys socketpair(domain int, typ int, proto int, fd *[2]int) (errno int) //sysnb socketpair(domain int, typ int, proto int, fd *[2]int) (errno int)
func Socketpair(domain, typ, proto int) (fd [2]int, errno int) { func Socketpair(domain, typ, proto int) (fd [2]int, errno int) {
errno = socketpair(domain, typ, proto, &fd) errno = socketpair(domain, typ, proto, &fd)
......
...@@ -45,8 +45,8 @@ func Kill(pid int, signum int) (errno int) { return kill(pid, signum, 1) } ...@@ -45,8 +45,8 @@ func Kill(pid int, signum int) (errno int) { return kill(pid, signum, 1) }
//sys Chown(path string, uid int, gid int) (errno int) //sys Chown(path string, uid int, gid int) (errno int)
//sys Chroot(path string) (errno int) //sys Chroot(path string) (errno int)
//sys Close(fd int) (errno int) //sys Close(fd int) (errno int)
//sys Dup(fd int) (nfd int, errno int) //sysnb Dup(fd int) (nfd int, errno int)
//sys Dup2(from int, to int) (errno int) //sysnb Dup2(from int, to int) (errno int)
//sys Exchangedata(path1 string, path2 string, options int) (errno int) //sys Exchangedata(path1 string, path2 string, options int) (errno int)
//sys Exit(code int) //sys Exit(code int)
//sys Fchdir(fd int) (errno int) //sys Fchdir(fd int) (errno int)
...@@ -61,20 +61,20 @@ func Kill(pid int, signum int) (errno int) { return kill(pid, signum, 1) } ...@@ -61,20 +61,20 @@ func Kill(pid int, signum int) (errno int) { return kill(pid, signum, 1) }
//sys Ftruncate(fd int, length int64) (errno int) //sys Ftruncate(fd int, length int64) (errno int)
//sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, errno int) = SYS_GETDIRENTRIES64 //sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, errno int) = SYS_GETDIRENTRIES64
//sys Getdtablesize() (size int) //sys Getdtablesize() (size int)
//sys Getegid() (egid int) //sysnb Getegid() (egid int)
//sys Geteuid() (uid int) //sysnb Geteuid() (uid int)
//sys Getfsstat(buf []Statfs_t, flags int) (n int, errno int) = SYS_GETFSSTAT64 //sys Getfsstat(buf []Statfs_t, flags int) (n int, errno int) = SYS_GETFSSTAT64
//sys Getgid() (gid int) //sysnb Getgid() (gid int)
//sys Getpgid(pid int) (pgid int, errno int) //sysnb Getpgid(pid int) (pgid int, errno int)
//sys Getpgrp() (pgrp int) //sysnb Getpgrp() (pgrp int)
//sys Getpid() (pid int) //sysnb Getpid() (pid int)
//sys Getppid() (ppid int) //sysnb Getppid() (ppid int)
//sys Getpriority(which int, who int) (prio int, errno int) //sys Getpriority(which int, who int) (prio int, errno int)
//sys Getrlimit(which int, lim *Rlimit) (errno int) //sysnb Getrlimit(which int, lim *Rlimit) (errno int)
//sys Getrusage(who int, rusage *Rusage) (errno int) //sysnb Getrusage(who int, rusage *Rusage) (errno int)
//sys Getsid(pid int) (sid int, errno int) //sysnb Getsid(pid int) (sid int, errno int)
//sys Getuid() (uid int) //sysnb Getuid() (uid int)
//sys Issetugid() (tainted bool) //sysnb Issetugid() (tainted bool)
//sys Kqueue() (fd int, errno int) //sys Kqueue() (fd int, errno int)
//sys Lchown(path string, uid int, gid int) (errno int) //sys Lchown(path string, uid int, gid int) (errno int)
//sys Link(path string, link string) (errno int) //sys Link(path string, link string) (errno int)
...@@ -95,18 +95,18 @@ func Kill(pid int, signum int) (errno int) { return kill(pid, signum, 1) } ...@@ -95,18 +95,18 @@ func Kill(pid int, signum int) (errno int) { return kill(pid, signum, 1) }
//sys Seek(fd int, offset int64, whence int) (newoffset int64, errno int) = SYS_LSEEK //sys Seek(fd int, offset int64, whence int) (newoffset int64, errno int) = SYS_LSEEK
//sys Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (errno int) //sys Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (errno int)
//sys Setegid(egid int) (errno int) //sys Setegid(egid int) (errno int)
//sys Seteuid(euid int) (errno int) //sysnb Seteuid(euid int) (errno int)
//sys Setgid(gid int) (errno int) //sysnb Setgid(gid int) (errno int)
//sys Setlogin(name string) (errno int) //sys Setlogin(name string) (errno int)
//sys Setpgid(pid int, pgid int) (errno int) //sysnb Setpgid(pid int, pgid int) (errno int)
//sys Setpriority(which int, who int, prio int) (errno int) //sys Setpriority(which int, who int, prio int) (errno int)
//sys Setprivexec(flag int) (errno int) //sys Setprivexec(flag int) (errno int)
//sys Setregid(rgid int, egid int) (errno int) //sysnb Setregid(rgid int, egid int) (errno int)
//sys Setreuid(ruid int, euid int) (errno int) //sysnb Setreuid(ruid int, euid int) (errno int)
//sys Setrlimit(which int, lim *Rlimit) (errno int) //sysnb Setrlimit(which int, lim *Rlimit) (errno int)
//sys Setsid() (pid int, errno int) //sysnb Setsid() (pid int, errno int)
//sys Settimeofday(tp *Timeval) (errno int) //sysnb Settimeofday(tp *Timeval) (errno int)
//sys Setuid(uid int) (errno int) //sysnb Setuid(uid int) (errno int)
//sys Stat(path string, stat *Stat_t) (errno int) = SYS_STAT64 //sys Stat(path string, stat *Stat_t) (errno int) = SYS_STAT64
//sys Statfs(path string, stat *Statfs_t) (errno int) = SYS_STATFS64 //sys Statfs(path string, stat *Statfs_t) (errno int) = SYS_STATFS64
//sys Symlink(path string, link string) (errno int) //sys Symlink(path string, link string) (errno int)
......
...@@ -23,7 +23,7 @@ func NsecToTimeval(nsec int64) (tv Timeval) { ...@@ -23,7 +23,7 @@ func NsecToTimeval(nsec int64) (tv Timeval) {
return return
} }
//sys gettimeofday(tp *Timeval) (sec int32, usec int32, errno int) //sysnb gettimeofday(tp *Timeval) (sec int32, usec int32, errno int)
func Gettimeofday(tv *Timeval) (errno int) { func Gettimeofday(tv *Timeval) (errno int) {
// The tv passed to gettimeofday must be non-nil // The tv passed to gettimeofday must be non-nil
// but is otherwise unused. The answers come back // but is otherwise unused. The answers come back
......
...@@ -23,7 +23,7 @@ func NsecToTimeval(nsec int64) (tv Timeval) { ...@@ -23,7 +23,7 @@ func NsecToTimeval(nsec int64) (tv Timeval) {
return return
} }
//sys gettimeofday(tp *Timeval) (sec int64, usec int32, errno int) //sysnb gettimeofday(tp *Timeval) (sec int64, usec int32, errno int)
func Gettimeofday(tv *Timeval) (errno int) { func Gettimeofday(tv *Timeval) (errno int) {
// The tv passed to gettimeofday must be non-nil // The tv passed to gettimeofday must be non-nil
// but is otherwise unused. The answers come back // but is otherwise unused. The answers come back
......
...@@ -37,8 +37,8 @@ type SockaddrDatalink struct { ...@@ -37,8 +37,8 @@ type SockaddrDatalink struct {
//sys Chown(path string, uid int, gid int) (errno int) //sys Chown(path string, uid int, gid int) (errno int)
//sys Chroot(path string) (errno int) //sys Chroot(path string) (errno int)
//sys Close(fd int) (errno int) //sys Close(fd int) (errno int)
//sys Dup(fd int) (nfd int, errno int) //sysnb Dup(fd int) (nfd int, errno int)
//sys Dup2(from int, to int) (errno int) //sysnb Dup2(from int, to int) (errno int)
//sys Exit(code int) //sys Exit(code int)
//sys Fchdir(fd int) (errno int) //sys Fchdir(fd int) (errno int)
//sys Fchflags(path string, flags int) (errno int) //sys Fchflags(path string, flags int) (errno int)
...@@ -52,20 +52,20 @@ type SockaddrDatalink struct { ...@@ -52,20 +52,20 @@ type SockaddrDatalink struct {
//sys Ftruncate(fd int, length int64) (errno int) //sys Ftruncate(fd int, length int64) (errno int)
//sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, errno int) //sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, errno int)
//sys Getdtablesize() (size int) //sys Getdtablesize() (size int)
//sys Getegid() (egid int) //sysnb Getegid() (egid int)
//sys Geteuid() (uid int) //sysnb Geteuid() (uid int)
//sys Getfsstat(buf []Statfs_t, flags int) (n int, errno int) //sys Getfsstat(buf []Statfs_t, flags int) (n int, errno int)
//sys Getgid() (gid int) //sysnb Getgid() (gid int)
//sys Getpgid(pid int) (pgid int, errno int) //sysnb Getpgid(pid int) (pgid int, errno int)
//sys Getpgrp() (pgrp int) //sysnb Getpgrp() (pgrp int)
//sys Getpid() (pid int) //sysnb Getpid() (pid int)
//sys Getppid() (ppid int) //sysnb Getppid() (ppid int)
//sys Getpriority(which int, who int) (prio int, errno int) //sys Getpriority(which int, who int) (prio int, errno int)
//sys Getrlimit(which int, lim *Rlimit) (errno int) //sysnb Getrlimit(which int, lim *Rlimit) (errno int)
//sys Getrusage(who int, rusage *Rusage) (errno int) //sysnb Getrusage(who int, rusage *Rusage) (errno int)
//sys Getsid(pid int) (sid int, errno int) //sysnb Getsid(pid int) (sid int, errno int)
//sys Gettimeofday(tv *Timeval) (errno int) //sysnb Gettimeofday(tv *Timeval) (errno int)
//sys Getuid() (uid int) //sysnb Getuid() (uid int)
//sys Issetugid() (tainted bool) //sys Issetugid() (tainted bool)
//sys Kill(pid int, signum int) (errno int) //sys Kill(pid int, signum int) (errno int)
//sys Kqueue() (fd int, errno int) //sys Kqueue() (fd int, errno int)
...@@ -88,18 +88,18 @@ type SockaddrDatalink struct { ...@@ -88,18 +88,18 @@ type SockaddrDatalink struct {
//sys Rmdir(path string) (errno int) //sys Rmdir(path string) (errno int)
//sys Seek(fd int, offset int64, whence int) (newoffset int64, errno int) = SYS_LSEEK //sys Seek(fd int, offset int64, whence int) (newoffset int64, errno int) = SYS_LSEEK
//sys Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (errno int) //sys Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (errno int)
//sys Setegid(egid int) (errno int) //sysnb Setegid(egid int) (errno int)
//sys Seteuid(euid int) (errno int) //sysnb Seteuid(euid int) (errno int)
//sys Setgid(gid int) (errno int) //sysnb Setgid(gid int) (errno int)
//sys Setlogin(name string) (errno int) //sys Setlogin(name string) (errno int)
//sys Setpgid(pid int, pgid int) (errno int) //sysnb Setpgid(pid int, pgid int) (errno int)
//sys Setpriority(which int, who int, prio int) (errno int) //sys Setpriority(which int, who int, prio int) (errno int)
//sys Setregid(rgid int, egid int) (errno int) //sysnb Setregid(rgid int, egid int) (errno int)
//sys Setreuid(ruid int, euid int) (errno int) //sysnb Setreuid(ruid int, euid int) (errno int)
//sys Setrlimit(which int, lim *Rlimit) (errno int) //sysnb Setrlimit(which int, lim *Rlimit) (errno int)
//sys Setsid() (pid int, errno int) //sysnb Setsid() (pid int, errno int)
//sys Settimeofday(tp *Timeval) (errno int) //sysnb Settimeofday(tp *Timeval) (errno int)
//sys Setuid(uid int) (errno int) //sysnb Setuid(uid int) (errno int)
//sys Stat(path string, stat *Stat_t) (errno int) //sys Stat(path string, stat *Stat_t) (errno int)
//sys Statfs(path string, stat *Statfs_t) (errno int) //sys Statfs(path string, stat *Statfs_t) (errno int)
//sys Symlink(path string, link string) (errno int) //sys Symlink(path string, link string) (errno int)
......
...@@ -29,7 +29,7 @@ func Openat(dirfd int, path string, flags int, mode uint32) (fd int, errno int) ...@@ -29,7 +29,7 @@ func Openat(dirfd int, path string, flags int, mode uint32) (fd int, errno int)
return openat(dirfd, path, flags|O_LARGEFILE, mode) return openat(dirfd, path, flags|O_LARGEFILE, mode)
} }
//sys pipe(p *[2]_C_int) (errno int) //sysnb pipe(p *[2]_C_int) (errno int)
func Pipe(p []int) (errno int) { func Pipe(p []int) (errno int) {
if len(p) != 2 { if len(p) != 2 {
return EINVAL return EINVAL
...@@ -688,10 +688,10 @@ func Reboot(cmd int) (errno int) { ...@@ -688,10 +688,10 @@ func Reboot(cmd int) (errno int) {
//sys Chroot(path string) (errno int) //sys Chroot(path string) (errno int)
//sys Close(fd int) (errno int) //sys Close(fd int) (errno int)
//sys Creat(path string, mode uint32) (fd int, errno int) //sys Creat(path string, mode uint32) (fd int, errno int)
//sys Dup(oldfd int) (fd int, errno int) //sysnb Dup(oldfd int) (fd int, errno int)
//sys Dup2(oldfd int, newfd int) (fd int, errno int) //sysnb Dup2(oldfd int, newfd int) (fd int, errno int)
//sys EpollCreate(size int) (fd int, errno int) //sysnb EpollCreate(size int) (fd int, errno int)
//sys EpollCtl(epfd int, op int, fd int, event *EpollEvent) (errno int) //sysnb EpollCtl(epfd int, op int, fd int, event *EpollEvent) (errno int)
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, errno int) //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, errno int)
//sys Exit(code int) = SYS_EXIT_GROUP //sys Exit(code int) = SYS_EXIT_GROUP
//sys Faccessat(dirfd int, path string, mode uint32, flags int) (errno int) //sys Faccessat(dirfd int, path string, mode uint32, flags int) (errno int)
...@@ -704,18 +704,18 @@ func Reboot(cmd int) (errno int) { ...@@ -704,18 +704,18 @@ func Reboot(cmd int) (errno int) {
//sys Fdatasync(fd int) (errno int) //sys Fdatasync(fd int) (errno int)
//sys Fsync(fd int) (errno int) //sys Fsync(fd int) (errno int)
//sys Getdents(fd int, buf []byte) (n int, errno int) = SYS_GETDENTS64 //sys Getdents(fd int, buf []byte) (n int, errno int) = SYS_GETDENTS64
//sys Getpgid(pid int) (pgid int, errno int) //sysnb Getpgid(pid int) (pgid int, errno int)
//sys Getpgrp() (pid int) //sysnb Getpgrp() (pid int)
//sys Getpid() (pid int) //sysnb Getpid() (pid int)
//sys Getppid() (ppid int) //sysnb Getppid() (ppid int)
//sys Getrlimit(resource int, rlim *Rlimit) (errno int) //sysnb Getrlimit(resource int, rlim *Rlimit) (errno int)
//sys Getrusage(who int, rusage *Rusage) (errno int) //sysnb Getrusage(who int, rusage *Rusage) (errno int)
//sys Gettid() (tid int) //sysnb Gettid() (tid int)
//sys InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, errno int) //sys InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, errno int)
//sys InotifyInit() (fd int, errno int) //sysnb InotifyInit() (fd int, errno int)
//sys InotifyInit1(flags int) (fd int, errno int) //sysnb InotifyInit1(flags int) (fd int, errno int)
//sys InotifyRmWatch(fd int, watchdesc uint32) (success int, errno int) //sysnb InotifyRmWatch(fd int, watchdesc uint32) (success int, errno int)
//sys Kill(pid int, sig int) (errno int) //sysnb Kill(pid int, sig int) (errno int)
//sys Klogctl(typ int, buf []byte) (n int, errno int) = SYS_SYSLOG //sys Klogctl(typ int, buf []byte) (n int, errno int) = SYS_SYSLOG
//sys Link(oldpath string, newpath string) (errno int) //sys Link(oldpath string, newpath string) (errno int)
//sys Mkdir(path string, mode uint32) (errno int) //sys Mkdir(path string, mode uint32) (errno int)
...@@ -733,19 +733,19 @@ func Reboot(cmd int) (errno int) { ...@@ -733,19 +733,19 @@ func Reboot(cmd int) (errno int) {
//sys Rmdir(path string) (errno int) //sys Rmdir(path string) (errno int)
//sys Setdomainname(p []byte) (errno int) //sys Setdomainname(p []byte) (errno int)
//sys Sethostname(p []byte) (errno int) //sys Sethostname(p []byte) (errno int)
//sys Setpgid(pid int, pgid int) (errno int) //sysnb Setpgid(pid int, pgid int) (errno int)
//sys Setrlimit(resource int, rlim *Rlimit) (errno int) //sysnb Setrlimit(resource int, rlim *Rlimit) (errno int)
//sys Setsid() (pid int, errno int) //sysnb Setsid() (pid int, errno int)
//sys Settimeofday(tv *Timeval) (errno int) //sysnb Settimeofday(tv *Timeval) (errno int)
//sys Setuid(uid int) (errno int) //sysnb Setuid(uid int) (errno int)
//sys Symlink(oldpath string, newpath string) (errno int) //sys Symlink(oldpath string, newpath string) (errno int)
//sys Sync() //sys Sync()
//sys Sysinfo(info *Sysinfo_t) (errno int) //sysnb Sysinfo(info *Sysinfo_t) (errno int)
//sys Tee(rfd int, wfd int, len int, flags int) (n int64, errno int) //sys Tee(rfd int, wfd int, len int, flags int) (n int64, errno int)
//sys Tgkill(tgid int, tid int, sig int) (errno int) //sysnb Tgkill(tgid int, tid int, sig int) (errno int)
//sys Times(tms *Tms) (ticks uintptr, errno int) //sysnb Times(tms *Tms) (ticks uintptr, errno int)
//sys Umask(mask int) (oldmask int) //sysnb Umask(mask int) (oldmask int)
//sys Uname(buf *Utsname) (errno int) //sysnb Uname(buf *Utsname) (errno int)
//sys Unlink(path string) (errno int) //sys Unlink(path string) (errno int)
//sys Unlinkat(dirfd int, path string) (errno int) //sys Unlinkat(dirfd int, path string) (errno int)
//sys Unmount(target string, flags int) (errno int) = SYS_UMOUNT2 //sys Unmount(target string, flags int) (errno int) = SYS_UMOUNT2
......
...@@ -31,10 +31,10 @@ func NsecToTimeval(nsec int64) (tv Timeval) { ...@@ -31,10 +31,10 @@ func NsecToTimeval(nsec int64) (tv Timeval) {
//sys Fchown(fd int, uid int, gid int) (errno int) = SYS_FCHOWN32 //sys Fchown(fd int, uid int, gid int) (errno int) = SYS_FCHOWN32
//sys Fstat(fd int, stat *Stat_t) (errno int) = SYS_FSTAT64 //sys Fstat(fd int, stat *Stat_t) (errno int) = SYS_FSTAT64
//sys Ftruncate(fd int, length int64) (errno int) = SYS_FTRUNCATE64 //sys Ftruncate(fd int, length int64) (errno int) = SYS_FTRUNCATE64
//sys Getegid() (egid int) = SYS_GETEGID32 //sysnb Getegid() (egid int) = SYS_GETEGID32
//sys Geteuid() (euid int) = SYS_GETEUID32 //sysnb Geteuid() (euid int) = SYS_GETEUID32
//sys Getgid() (gid int) = SYS_GETGID32 //sysnb Getgid() (gid int) = SYS_GETGID32
//sys Getuid() (uid int) = SYS_GETUID32 //sysnb Getuid() (uid int) = SYS_GETUID32
//sys Ioperm(from int, num int, on int) (errno int) //sys Ioperm(from int, num int, on int) (errno int)
//sys Iopl(level int) (errno int) //sys Iopl(level int) (errno int)
//sys Lchown(path string, uid int, gid int) (errno int) = SYS_LCHOWN32 //sys Lchown(path string, uid int, gid int) (errno int) = SYS_LCHOWN32
...@@ -43,17 +43,17 @@ func NsecToTimeval(nsec int64) (tv Timeval) { ...@@ -43,17 +43,17 @@ func NsecToTimeval(nsec int64) (tv Timeval) {
//sys Pwrite(fd int, p []byte, offset int64) (n int, errno int) = SYS_PWRITE64 //sys Pwrite(fd int, p []byte, offset int64) (n int, errno int) = SYS_PWRITE64
//sys Setfsgid(gid int) (errno int) = SYS_SETFSGID32 //sys Setfsgid(gid int) (errno int) = SYS_SETFSGID32
//sys Setfsuid(uid int) (errno int) = SYS_SETFSUID32 //sys Setfsuid(uid int) (errno int) = SYS_SETFSUID32
//sys Setgid(gid int) (errno int) = SYS_SETGID32 //sysnb Setgid(gid int) (errno int) = SYS_SETGID32
//sys Setregid(rgid int, egid int) (errno int) = SYS_SETREGID32 //sysnb Setregid(rgid int, egid int) (errno int) = SYS_SETREGID32
//sys Setresgid(rgid int, egid int, sgid int) (errno int) = SYS_SETRESGID32 //sysnb Setresgid(rgid int, egid int, sgid int) (errno int) = SYS_SETRESGID32
//sys Setresuid(ruid int, euid int, suid int) (errno int) = SYS_SETRESUID32 //sysnb Setresuid(ruid int, euid int, suid int) (errno int) = SYS_SETRESUID32
//sys Setreuid(ruid int, euid int) (errno int) = SYS_SETREUID32 //sysnb Setreuid(ruid int, euid int) (errno int) = SYS_SETREUID32
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, errno int) //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, errno int)
//sys Stat(path string, stat *Stat_t) (errno int) = SYS_STAT64 //sys Stat(path string, stat *Stat_t) (errno int) = SYS_STAT64
//sys SyncFileRange(fd int, off int64, n int64, flags int) (errno int) //sys SyncFileRange(fd int, off int64, n int64, flags int) (errno int)
//sys Truncate(path string, length int64) (errno int) = SYS_TRUNCATE64 //sys Truncate(path string, length int64) (errno int) = SYS_TRUNCATE64
//sys getgroups(n int, list *_Gid_t) (nn int, errno int) = SYS_GETGROUPS32 //sysnb getgroups(n int, list *_Gid_t) (nn int, errno int) = SYS_GETGROUPS32
//sys setgroups(n int, list *_Gid_t) (errno int) = SYS_SETGROUPS32 //sysnb setgroups(n int, list *_Gid_t) (errno int) = SYS_SETGROUPS32
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, errno int) = SYS__NEWSELECT //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, errno int) = SYS__NEWSELECT
// Underlying system call writes to newoffset via pointer. // Underlying system call writes to newoffset via pointer.
...@@ -61,8 +61,8 @@ func NsecToTimeval(nsec int64) (tv Timeval) { ...@@ -61,8 +61,8 @@ func NsecToTimeval(nsec int64) (tv Timeval) {
func Seek(fd int, offset int64, whence int) (newoffset int64, errno int) func Seek(fd int, offset int64, whence int) (newoffset int64, errno int)
// Vsyscalls on amd64. // Vsyscalls on amd64.
//sys Gettimeofday(tv *Timeval) (errno int) //sysnb Gettimeofday(tv *Timeval) (errno int)
//sys Time(t *Time_t) (tt Time_t, errno int) //sysnb Time(t *Time_t) (tt Time_t, errno int)
// On x86 Linux, all the socket calls go through an extra indirection, // On x86 Linux, all the socket calls go through an extra indirection,
// I think because the 5-register system call interface can't handle // I think because the 5-register system call interface can't handle
...@@ -93,6 +93,7 @@ const ( ...@@ -93,6 +93,7 @@ const (
) )
func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, errno int) func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, errno int)
func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, errno int)
func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, errno int) { func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, errno int) {
fd, errno = socketcall(_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0) fd, errno = socketcall(_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
...@@ -100,17 +101,17 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, errno int) { ...@@ -100,17 +101,17 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, errno int) {
} }
func getsockname(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int) { func getsockname(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int) {
_, errno = socketcall(_GETSOCKNAME, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0) _, errno = rawsocketcall(_GETSOCKNAME, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
return return
} }
func getpeername(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int) { func getpeername(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int) {
_, errno = socketcall(_GETPEERNAME, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0) _, errno = rawsocketcall(_GETPEERNAME, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
return return
} }
func socketpair(domain int, typ int, flags int, fd *[2]int) (errno int) { func socketpair(domain int, typ int, flags int, fd *[2]int) (errno int) {
_, errno = socketcall(_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(flags), uintptr(unsafe.Pointer(fd)), 0, 0) _, errno = rawsocketcall(_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(flags), uintptr(unsafe.Pointer(fd)), 0, 0)
return return
} }
...@@ -125,7 +126,7 @@ func connect(s int, addr uintptr, addrlen _Socklen) (errno int) { ...@@ -125,7 +126,7 @@ func connect(s int, addr uintptr, addrlen _Socklen) (errno int) {
} }
func socket(domain int, typ int, proto int) (fd int, errno int) { func socket(domain int, typ int, proto int) (fd int, errno int) {
fd, errno = socketcall(_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto), 0, 0, 0) fd, errno = rawsocketcall(_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto), 0, 0, 0)
return return
} }
......
...@@ -9,10 +9,10 @@ package syscall ...@@ -9,10 +9,10 @@ package syscall
//sys Fstat(fd int, stat *Stat_t) (errno int) //sys Fstat(fd int, stat *Stat_t) (errno int)
//sys Fstatfs(fd int, buf *Statfs_t) (errno int) //sys Fstatfs(fd int, buf *Statfs_t) (errno int)
//sys Ftruncate(fd int, length int64) (errno int) //sys Ftruncate(fd int, length int64) (errno int)
//sys Getegid() (egid int) //sysnb Getegid() (egid int)
//sys Geteuid() (euid int) //sysnb Geteuid() (euid int)
//sys Getgid() (gid int) //sysnb Getgid() (gid int)
//sys Getuid() (uid int) //sysnb Getuid() (uid int)
//sys Ioperm(from int, num int, on int) (errno int) //sys Ioperm(from int, num int, on int) (errno int)
//sys Iopl(level int) (errno int) //sys Iopl(level int) (errno int)
//sys Lchown(path string, uid int, gid int) (errno int) //sys Lchown(path string, uid int, gid int) (errno int)
...@@ -24,11 +24,11 @@ package syscall ...@@ -24,11 +24,11 @@ package syscall
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, errno int) //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, errno int)
//sys Setfsgid(gid int) (errno int) //sys Setfsgid(gid int) (errno int)
//sys Setfsuid(uid int) (errno int) //sys Setfsuid(uid int) (errno int)
//sys Setgid(gid int) (errno int) //sysnb Setgid(gid int) (errno int)
//sys Setregid(rgid int, egid int) (errno int) //sysnb Setregid(rgid int, egid int) (errno int)
//sys Setresgid(rgid int, egid int, sgid int) (errno int) //sysnb Setresgid(rgid int, egid int, sgid int) (errno int)
//sys Setresuid(ruid int, euid int, suid int) (errno int) //sysnb Setresuid(ruid int, euid int, suid int) (errno int)
//sys Setreuid(ruid int, euid int) (errno int) //sysnb Setreuid(ruid int, euid int) (errno int)
//sys Shutdown(fd int, how int) (errno int) //sys Shutdown(fd int, how int) (errno int)
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, errno int) //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, errno int)
//sys Stat(path string, stat *Stat_t) (errno int) //sys Stat(path string, stat *Stat_t) (errno int)
...@@ -38,13 +38,13 @@ package syscall ...@@ -38,13 +38,13 @@ package syscall
//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, errno int) //sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, errno int)
//sys bind(s int, addr uintptr, addrlen _Socklen) (errno int) //sys bind(s int, addr uintptr, addrlen _Socklen) (errno int)
//sys connect(s int, addr uintptr, addrlen _Socklen) (errno int) //sys connect(s int, addr uintptr, addrlen _Socklen) (errno int)
//sys getgroups(n int, list *_Gid_t) (nn int, errno int) //sysnb getgroups(n int, list *_Gid_t) (nn int, errno int)
//sys setgroups(n int, list *_Gid_t) (errno int) //sysnb setgroups(n int, list *_Gid_t) (errno int)
//sys setsockopt(s int, level int, name int, val uintptr, vallen int) (errno int) //sys setsockopt(s int, level int, name int, val uintptr, vallen int) (errno int)
//sys socket(domain int, typ int, proto int) (fd int, errno int) //sysnb socket(domain int, typ int, proto int) (fd int, errno int)
//sys socketpair(domain int, typ int, proto int, fd *[2]int) (errno int) //sysnb socketpair(domain int, typ int, proto int, fd *[2]int) (errno int)
//sys getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int) //sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int)
//sys getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int) //sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int)
//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, errno int) //sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, errno int)
//sys sendto(s int, buf []byte, flags int, to uintptr, addrlen _Socklen) (errno int) //sys sendto(s int, buf []byte, flags int, to uintptr, addrlen _Socklen) (errno int)
//sys recvmsg(s int, msg *Msghdr, flags int) (n int, errno int) //sys recvmsg(s int, msg *Msghdr, flags int) (n int, errno int)
......
...@@ -55,15 +55,15 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, errno int) ...@@ -55,15 +55,15 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, errno int)
//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, errno int) //sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, errno int)
//sys bind(s int, addr uintptr, addrlen _Socklen) (errno int) //sys bind(s int, addr uintptr, addrlen _Socklen) (errno int)
//sys connect(s int, addr uintptr, addrlen _Socklen) (errno int) //sys connect(s int, addr uintptr, addrlen _Socklen) (errno int)
//sys getgroups(n int, list *_Gid_t) (nn int, errno int) = SYS_GETGROUPS32 //sysnb getgroups(n int, list *_Gid_t) (nn int, errno int) = SYS_GETGROUPS32
//sys setgroups(n int, list *_Gid_t) (errno int) = SYS_SETGROUPS32 //sysnb setgroups(n int, list *_Gid_t) (errno int) = SYS_SETGROUPS32
//sys setsockopt(s int, level int, name int, val uintptr, vallen int) (errno int) //sys setsockopt(s int, level int, name int, val uintptr, vallen int) (errno int)
//sys socket(domain int, typ int, proto int) (fd int, errno int) //sysnb socket(domain int, typ int, proto int) (fd int, errno int)
//sys getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int) //sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int)
//sys getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int) //sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int)
//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, errno int) //sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, errno int)
//sys sendto(s int, buf []byte, flags int, to uintptr, addrlen _Socklen) (errno int) //sys sendto(s int, buf []byte, flags int, to uintptr, addrlen _Socklen) (errno int)
//sys socketpair(domain int, typ int, flags int, fd *[2]int) (errno int) //sysnb socketpair(domain int, typ int, flags int, fd *[2]int) (errno int)
//sys recvmsg(s int, msg *Msghdr, flags int) (n int, errno int) //sys recvmsg(s int, msg *Msghdr, flags int) (n int, errno int)
//sys sendmsg(s int, msg *Msghdr, flags int) (errno int) //sys sendmsg(s int, msg *Msghdr, flags int) (errno int)
...@@ -72,21 +72,21 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, errno int) ...@@ -72,21 +72,21 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, errno int)
//sys Fstat(fd int, stat *Stat_t) (errno int) = SYS_FSTAT64 //sys Fstat(fd int, stat *Stat_t) (errno int) = SYS_FSTAT64
//sys Fstatfs(fd int, buf *Statfs_t) (errno int) = SYS_FSTATFS64 //sys Fstatfs(fd int, buf *Statfs_t) (errno int) = SYS_FSTATFS64
//sys Ftruncate(fd int, length int64) (errno int) = SYS_FTRUNCATE64 //sys Ftruncate(fd int, length int64) (errno int) = SYS_FTRUNCATE64
//sys Getegid() (egid int) //sysnb Getegid() (egid int)
//sys Geteuid() (euid int) //sysnb Geteuid() (euid int)
//sys Getgid() (gid int) //sysnb Getgid() (gid int)
//sys Getuid() (uid int) //sysnb Getuid() (uid int)
//sys Lchown(path string, uid int, gid int) (errno int) //sys Lchown(path string, uid int, gid int) (errno int)
//sys Listen(s int, n int) (errno int) //sys Listen(s int, n int) (errno int)
//sys Lstat(path string, stat *Stat_t) (errno int) = SYS_LSTAT64 //sys Lstat(path string, stat *Stat_t) (errno int) = SYS_LSTAT64
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, errno int) = SYS__NEWSELECT //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, errno int) = SYS__NEWSELECT
//sys Setfsgid(gid int) (errno int) //sys Setfsgid(gid int) (errno int)
//sys Setfsuid(uid int) (errno int) //sys Setfsuid(uid int) (errno int)
//sys Setgid(gid int) (errno int) //sysnb Setgid(gid int) (errno int)
//sys Setregid(rgid int, egid int) (errno int) //sysnb Setregid(rgid int, egid int) (errno int)
//sys Setresgid(rgid int, egid int, sgid int) (errno int) //sysnb Setresgid(rgid int, egid int, sgid int) (errno int)
//sys Setresuid(ruid int, euid int, suid int) (errno int) //sysnb Setresuid(ruid int, euid int, suid int) (errno int)
//sys Setreuid(ruid int, euid int) (errno int) //sysnb Setreuid(ruid int, euid int) (errno int)
//sys Shutdown(fd int, how int) (errno int) //sys Shutdown(fd int, how int) (errno int)
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, errno int) //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, errno int)
//sys Stat(path string, stat *Stat_t) (errno int) = SYS_STAT64 //sys Stat(path string, stat *Stat_t) (errno int) = SYS_STAT64
...@@ -94,8 +94,8 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, errno int) ...@@ -94,8 +94,8 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, errno int)
//sys Truncate(path string, length int64) (errno int) = SYS_TRUNCATE64 //sys Truncate(path string, length int64) (errno int) = SYS_TRUNCATE64
// Vsyscalls on amd64. // Vsyscalls on amd64.
//sys Gettimeofday(tv *Timeval) (errno int) //sysnb Gettimeofday(tv *Timeval) (errno int)
//sys Time(t *Time_t) (tt Time_t, errno int) //sysnb Time(t *Time_t) (tt Time_t, errno int)
// TODO(kaib): add support for tracing // TODO(kaib): add support for tracing
func (r *PtraceRegs) PC() uint64 { return 0 } func (r *PtraceRegs) PC() uint64 { return 0 }
......
...@@ -13,6 +13,7 @@ var ( ...@@ -13,6 +13,7 @@ var (
func Syscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) func Syscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr)
func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr)
func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
func Errstr(errno int) string { func Errstr(errno int) string {
if errno < 0 || errno >= int(len(errors)) { if errno < 0 || errno >= int(len(errors)) {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment