Commit da5e962e authored by Russ Cox's avatar Russ Cox

shuffle some Linux system calls around for 386

R=r
DELTA=37  (17 added, 15 deleted, 5 changed)
OCL=30428
CL=30444
parent 8522a478
......@@ -427,7 +427,6 @@ func SetsockoptLinger(fd, level, opt int, l *Linger) (errno int) {
//sys Rename(oldpath string, newpath string) (errno int)
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (errno int)
//sys Rmdir(path string) (errno int)
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, errno int)
//sys Setdomainname(p []byte) (errno int)
//sys Sethostname(p []byte) (errno int)
//sys Setpgid(pid int, pgid int) (errno int)
......
......@@ -58,6 +58,8 @@ func NsecToTimeval(nsec int64) (tv Timeval) {
//sys getgroups(n int, list *_Gid_t) (nn int, errno int) = SYS_GETGROUPS32
//sys 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
// Underlying system call writes to newoffset via pointer.
// Implemented in assembly to avoid allocation.
func Seek(fd int, offset int64, whence int) (newoffset int64, errno int)
......@@ -93,7 +95,7 @@ const (
func socketcall(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) {
fd, errno = socketcall(_SOCKET, 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);
return;
}
......
......@@ -18,6 +18,7 @@ import "syscall"
//sys Listen(s int, n int) (errno int)
//sys Lstat(path string, stat *Stat_t) (errno int)
//sys Seek(fd int, offset int64, whence int) (off int64, errno int) = SYS_LSEEK
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, errno int)
//sys Setfsgid(gid int) (errno int)
//sys Setfsuid(uid int) (errno int)
//sys Setgid(gid int) (errno int)
......
......@@ -395,13 +395,6 @@ func Rmdir(path string) (errno int) {
return;
}
func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, errno int) {
r0, r1, e1 := Syscall6(SYS_SELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0);
n = int(r0);
errno = int(e1);
return;
}
func Setdomainname(p []byte) (errno int) {
var _p0 *byte;
if len(p) > 0 { _p0 = &p[0]; }
......@@ -707,5 +700,12 @@ func setgroups(n int, list *_Gid_t) (errno int) {
return;
}
func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, errno int) {
r0, r1, e1 := Syscall6(SYS__NEWSELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0);
n = int(r0);
errno = int(e1);
return;
}
......@@ -395,13 +395,6 @@ func Rmdir(path string) (errno int) {
return;
}
func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, errno int) {
r0, r1, e1 := Syscall6(SYS_SELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0);
n = int(r0);
errno = int(e1);
return;
}
func Setdomainname(p []byte) (errno int) {
var _p0 *byte;
if len(p) > 0 { _p0 = &p[0]; }
......@@ -655,6 +648,13 @@ func Seek(fd int, offset int64, whence int) (off int64, errno int) {
return;
}
func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, errno int) {
r0, r1, e1 := Syscall6(SYS_SELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0);
n = int(r0);
errno = int(e1);
return;
}
func Setfsgid(gid int) (errno int) {
r0, r1, e1 := Syscall(SYS_SETFSGID, uintptr(gid), 0, 0);
errno = int(e1);
......
......@@ -253,7 +253,7 @@ type Linger struct {
}
type FdSet struct {
__fds_bits [16]int64;
Bits [16]int64;
}
type Sysinfo_t struct {
......@@ -281,7 +281,7 @@ type Utsname struct {
Release [65]int8;
Version [65]int8;
Machine [65]int8;
__domainname [65]int8;
Domainname [65]int8;
}
type Ustat_t struct {
......
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