1
0
mirror of https://github.com/golang/go synced 2024-11-24 11:10:03 -07:00

syscall: Use vsyscall for syscall.Gettimeofday and .Time on linux amd64.

Regenerate zsyscall_linux_*.go files with recent changes to
mksyscall.sh.

Add socketpair to syscall_linux_amd64.go; for some reason it
was in the generated file but not in the source file.

R=rsc, r2
CC=golang-dev
https://golang.org/cl/2190044
This commit is contained in:
Ian Lance Taylor 2010-09-21 06:49:56 -07:00
parent 4659f6de38
commit 7d03d0ec6b
8 changed files with 172 additions and 152 deletions

View File

@ -82,3 +82,26 @@ ok1:
MOVQ DX, 48(SP) // r2
MOVQ $0, 56(SP) // errno
RET
TEXT ·Gettimeofday(SB),7,$0
MOVQ 8(SP), DI
MOVQ $0, SI
MOVQ $0xffffffffff600000, AX
CALL AX
CMPQ AX, $0xfffffffffffff001
JLS ok7
NEGQ AX
MOVQ AX, 16(SP) // errno
RET
ok7:
MOVQ $0, 16(SP) // errno
RET
TEXT ·Time(SB),7,$0
MOVQ 8(SP), DI
MOVQ $0xffffffffff600400, AX
CALL AX
MOVQ AX, 16(SP) // tt
MOVQ $0, 24(SP) // errno
RET

View File

@ -593,7 +593,6 @@ func PtraceDetach(pid int) (errno int) { return ptrace(PTRACE_DETACH, pid, 0, 0)
//sys Getrlimit(resource int, rlim *Rlimit) (errno int)
//sys Getrusage(who int, rusage *Rusage) (errno int)
//sys Gettid() (tid int)
//sys Gettimeofday(tv *Timeval) (errno int)
//sys Kill(pid int, sig int) (errno int)
//sys Klogctl(typ int, buf []byte) (n int, errno int) = SYS_SYSLOG
//sys Link(oldpath string, newpath string) (errno int)
@ -624,7 +623,6 @@ func PtraceDetach(pid int) (errno int) { return ptrace(PTRACE_DETACH, pid, 0, 0)
//sys Sysinfo(info *Sysinfo_t) (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)
//sys Time(t *Time_t) (tt Time_t, errno int)
//sys Times(tms *Tms) (ticks uintptr, errno int)
//sys Truncate(path string, length int64) (errno int)
//sys Umask(mask int) (oldmask int)

View File

@ -55,6 +55,10 @@ func NsecToTimeval(nsec int64) (tv Timeval) {
// Implemented in assembly to avoid allocation.
func Seek(fd int, offset int64, whence int) (newoffset int64, errno int)
// Vsyscalls on amd64.
//sys Gettimeofday(tv *Timeval) (errno int)
//sys Time(t *Time_t) (tt Time_t, errno int)
// On x86 Linux, all the socket calls go through an extra indirection,
// I think because the 5-register system call interface can't handle
// the 6-argument calls like sendto and recvfrom. Instead the

View File

@ -37,6 +37,7 @@ package syscall
//sys setgroups(n int, list *_Gid_t) (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)
//sys socketpair(domain int, typ int, proto int, fd *[2]int) (errno int)
//sys getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int)
//sys 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)
@ -44,6 +45,9 @@ package syscall
func Getpagesize() int { return 4096 }
func Gettimeofday(tv *Timeval) (errno int)
func Time(t *Time_t) (tt Time_t, errno int)
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
func NsecToTimespec(nsec int64) (ts Timespec) {

View File

@ -58,6 +58,10 @@ func NsecToTimeval(nsec int64) (tv Timeval) {
//sys Stat(path string, stat *Stat_t) (errno int) = SYS_STAT64
//sys Statfs(path string, buf *Statfs_t) (errno int) = SYS_STATFS64
// Vsyscalls on amd64.
//sys Gettimeofday(tv *Timeval) (errno int)
//sys Time(t *Time_t) (tt Time_t, errno int)
// TODO(kaib): add support for tracing
func (r *PtraceRegs) PC() uint64 { return 0 }

View File

@ -38,11 +38,11 @@ func futimesat(dirfd int, path *byte, times *[2]Timeval) (errno int) {
}
func Getcwd(buf []byte) (n int, errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = &buf[0]
_p0 = unsafe.Pointer(&buf[0])
}
r0, _, e1 := Syscall(SYS_GETCWD, uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), 0)
r0, _, e1 := Syscall(SYS_GETCWD, uintptr(_p0), uintptr(len(buf)), 0)
n = int(r0)
errno = int(e1)
return
@ -139,11 +139,11 @@ func EpollCtl(epfd int, op int, fd int, event *EpollEvent) (errno int) {
}
func EpollWait(epfd int, events []EpollEvent, msec int) (n int, errno int) {
var _p0 *EpollEvent
var _p0 unsafe.Pointer
if len(events) > 0 {
_p0 = &events[0]
_p0 = unsafe.Pointer(&events[0])
}
r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(unsafe.Pointer(_p0)), uintptr(len(events)), uintptr(msec), 0, 0)
r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0)
n = int(r0)
errno = int(e1)
return
@ -216,11 +216,11 @@ func Ftruncate(fd int, length int64) (errno int) {
}
func Getdents(fd int, buf []byte) (n int, errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = &buf[0]
_p0 = unsafe.Pointer(&buf[0])
}
r0, _, e1 := Syscall(SYS_GETDENTS64, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)))
r0, _, e1 := Syscall(SYS_GETDENTS64, uintptr(fd), uintptr(_p0), uintptr(len(buf)))
n = int(r0)
errno = int(e1)
return
@ -269,12 +269,6 @@ func Gettid() (tid int) {
return
}
func Gettimeofday(tv *Timeval) (errno int) {
_, _, e1 := Syscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0)
errno = int(e1)
return
}
func Kill(pid int, sig int) (errno int) {
_, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(sig), 0)
errno = int(e1)
@ -282,11 +276,11 @@ func Kill(pid int, sig int) (errno int) {
}
func Klogctl(typ int, buf []byte) (n int, errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = &buf[0]
_p0 = unsafe.Pointer(&buf[0])
}
r0, _, e1 := Syscall(SYS_SYSLOG, uintptr(typ), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)))
r0, _, e1 := Syscall(SYS_SYSLOG, uintptr(typ), uintptr(_p0), uintptr(len(buf)))
n = int(r0)
errno = int(e1)
return
@ -341,44 +335,44 @@ func PivotRoot(newroot string, putold string) (errno int) {
}
func Pread(fd int, p []byte, offset int64) (n int, errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = &p[0]
_p0 = unsafe.Pointer(&p[0])
}
r0, _, e1 := Syscall6(SYS_PREAD64, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0)
r0, _, e1 := Syscall6(SYS_PREAD64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0)
n = int(r0)
errno = int(e1)
return
}
func Pwrite(fd int, p []byte, offset int64) (n int, errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = &p[0]
_p0 = unsafe.Pointer(&p[0])
}
r0, _, e1 := Syscall6(SYS_PWRITE64, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0)
r0, _, e1 := Syscall6(SYS_PWRITE64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0)
n = int(r0)
errno = int(e1)
return
}
func Read(fd int, p []byte) (n int, errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = &p[0]
_p0 = unsafe.Pointer(&p[0])
}
r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)))
r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p)))
n = int(r0)
errno = int(e1)
return
}
func Readlink(path string, buf []byte) (n int, errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = &buf[0]
_p0 = unsafe.Pointer(&buf[0])
}
r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)))
r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(_p0), uintptr(len(buf)))
n = int(r0)
errno = int(e1)
return
@ -403,21 +397,21 @@ func Rmdir(path string) (errno int) {
}
func Setdomainname(p []byte) (errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = &p[0]
_p0 = unsafe.Pointer(&p[0])
}
_, _, e1 := Syscall(SYS_SETDOMAINNAME, uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), 0)
_, _, e1 := Syscall(SYS_SETDOMAINNAME, uintptr(_p0), uintptr(len(p)), 0)
errno = int(e1)
return
}
func Sethostname(p []byte) (errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = &p[0]
_p0 = unsafe.Pointer(&p[0])
}
_, _, e1 := Syscall(SYS_SETHOSTNAME, uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), 0)
_, _, e1 := Syscall(SYS_SETHOSTNAME, uintptr(_p0), uintptr(len(p)), 0)
errno = int(e1)
return
}
@ -490,13 +484,6 @@ func Tgkill(tgid int, tid int, sig int) (errno int) {
return
}
func Time(t *Time_t) (tt Time_t, errno int) {
r0, _, e1 := Syscall(SYS_TIME, uintptr(unsafe.Pointer(t)), 0, 0)
tt = Time_t(r0)
errno = int(e1)
return
}
func Times(tms *Tms) (ticks uintptr, errno int) {
r0, _, e1 := Syscall(SYS_TIMES, uintptr(unsafe.Pointer(tms)), 0, 0)
ticks = uintptr(r0)
@ -553,11 +540,11 @@ func Utime(path string, buf *Utimbuf) (errno int) {
}
func Write(fd int, p []byte) (n int, errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = &p[0]
_p0 = unsafe.Pointer(&p[0])
}
r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)))
r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)))
n = int(r0)
errno = int(e1)
return
@ -722,3 +709,16 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err
errno = int(e1)
return
}
func Gettimeofday(tv *Timeval) (errno int) {
_, _, e1 := Syscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0)
errno = int(e1)
return
}
func Time(t *Time_t) (tt Time_t, errno int) {
r0, _, e1 := Syscall(SYS_TIME, uintptr(unsafe.Pointer(t)), 0, 0)
tt = Time_t(r0)
errno = int(e1)
return
}

View File

@ -38,11 +38,11 @@ func futimesat(dirfd int, path *byte, times *[2]Timeval) (errno int) {
}
func Getcwd(buf []byte) (n int, errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = &buf[0]
_p0 = unsafe.Pointer(&buf[0])
}
r0, _, e1 := Syscall(SYS_GETCWD, uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), 0)
r0, _, e1 := Syscall(SYS_GETCWD, uintptr(_p0), uintptr(len(buf)), 0)
n = int(r0)
errno = int(e1)
return
@ -139,11 +139,11 @@ func EpollCtl(epfd int, op int, fd int, event *EpollEvent) (errno int) {
}
func EpollWait(epfd int, events []EpollEvent, msec int) (n int, errno int) {
var _p0 *EpollEvent
var _p0 unsafe.Pointer
if len(events) > 0 {
_p0 = &events[0]
_p0 = unsafe.Pointer(&events[0])
}
r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(unsafe.Pointer(_p0)), uintptr(len(events)), uintptr(msec), 0, 0)
r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0)
n = int(r0)
errno = int(e1)
return
@ -216,11 +216,11 @@ func Ftruncate(fd int, length int64) (errno int) {
}
func Getdents(fd int, buf []byte) (n int, errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = &buf[0]
_p0 = unsafe.Pointer(&buf[0])
}
r0, _, e1 := Syscall(SYS_GETDENTS64, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)))
r0, _, e1 := Syscall(SYS_GETDENTS64, uintptr(fd), uintptr(_p0), uintptr(len(buf)))
n = int(r0)
errno = int(e1)
return
@ -269,12 +269,6 @@ func Gettid() (tid int) {
return
}
func Gettimeofday(tv *Timeval) (errno int) {
_, _, e1 := Syscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0)
errno = int(e1)
return
}
func Kill(pid int, sig int) (errno int) {
_, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(sig), 0)
errno = int(e1)
@ -282,11 +276,11 @@ func Kill(pid int, sig int) (errno int) {
}
func Klogctl(typ int, buf []byte) (n int, errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = &buf[0]
_p0 = unsafe.Pointer(&buf[0])
}
r0, _, e1 := Syscall(SYS_SYSLOG, uintptr(typ), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)))
r0, _, e1 := Syscall(SYS_SYSLOG, uintptr(typ), uintptr(_p0), uintptr(len(buf)))
n = int(r0)
errno = int(e1)
return
@ -341,44 +335,44 @@ func PivotRoot(newroot string, putold string) (errno int) {
}
func Pread(fd int, p []byte, offset int64) (n int, errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = &p[0]
_p0 = unsafe.Pointer(&p[0])
}
r0, _, e1 := Syscall6(SYS_PREAD64, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), uintptr(offset), 0, 0)
r0, _, e1 := Syscall6(SYS_PREAD64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0)
n = int(r0)
errno = int(e1)
return
}
func Pwrite(fd int, p []byte, offset int64) (n int, errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = &p[0]
_p0 = unsafe.Pointer(&p[0])
}
r0, _, e1 := Syscall6(SYS_PWRITE64, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), uintptr(offset), 0, 0)
r0, _, e1 := Syscall6(SYS_PWRITE64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0)
n = int(r0)
errno = int(e1)
return
}
func Read(fd int, p []byte) (n int, errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = &p[0]
_p0 = unsafe.Pointer(&p[0])
}
r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)))
r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p)))
n = int(r0)
errno = int(e1)
return
}
func Readlink(path string, buf []byte) (n int, errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = &buf[0]
_p0 = unsafe.Pointer(&buf[0])
}
r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)))
r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(_p0), uintptr(len(buf)))
n = int(r0)
errno = int(e1)
return
@ -403,21 +397,21 @@ func Rmdir(path string) (errno int) {
}
func Setdomainname(p []byte) (errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = &p[0]
_p0 = unsafe.Pointer(&p[0])
}
_, _, e1 := Syscall(SYS_SETDOMAINNAME, uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), 0)
_, _, e1 := Syscall(SYS_SETDOMAINNAME, uintptr(_p0), uintptr(len(p)), 0)
errno = int(e1)
return
}
func Sethostname(p []byte) (errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = &p[0]
_p0 = unsafe.Pointer(&p[0])
}
_, _, e1 := Syscall(SYS_SETHOSTNAME, uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), 0)
_, _, e1 := Syscall(SYS_SETHOSTNAME, uintptr(_p0), uintptr(len(p)), 0)
errno = int(e1)
return
}
@ -490,13 +484,6 @@ func Tgkill(tgid int, tid int, sig int) (errno int) {
return
}
func Time(t *Time_t) (tt Time_t, errno int) {
r0, _, e1 := Syscall(SYS_TIME, uintptr(unsafe.Pointer(t)), 0, 0)
tt = Time_t(r0)
errno = int(e1)
return
}
func Times(tms *Tms) (ticks uintptr, errno int) {
r0, _, e1 := Syscall(SYS_TIMES, uintptr(unsafe.Pointer(tms)), 0, 0)
ticks = uintptr(r0)
@ -553,11 +540,11 @@ func Utime(path string, buf *Utimbuf) (errno int) {
}
func Write(fd int, p []byte) (n int, errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = &p[0]
_p0 = unsafe.Pointer(&p[0])
}
r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)))
r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)))
n = int(r0)
errno = int(e1)
return
@ -805,22 +792,22 @@ func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int) {
}
func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = &p[0]
_p0 = unsafe.Pointer(&p[0])
}
r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
n = int(r0)
errno = int(e1)
return
}
func sendto(s int, buf []byte, flags int, to uintptr, addrlen _Socklen) (errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = &buf[0]
_p0 = unsafe.Pointer(&buf[0])
}
_, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen))
_, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen))
errno = int(e1)
return
}

View File

@ -38,11 +38,11 @@ func futimesat(dirfd int, path *byte, times *[2]Timeval) (errno int) {
}
func Getcwd(buf []byte) (n int, errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = &buf[0]
_p0 = unsafe.Pointer(&buf[0])
}
r0, _, e1 := Syscall(SYS_GETCWD, uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), 0)
r0, _, e1 := Syscall(SYS_GETCWD, uintptr(_p0), uintptr(len(buf)), 0)
n = int(r0)
errno = int(e1)
return
@ -139,11 +139,11 @@ func EpollCtl(epfd int, op int, fd int, event *EpollEvent) (errno int) {
}
func EpollWait(epfd int, events []EpollEvent, msec int) (n int, errno int) {
var _p0 *EpollEvent
var _p0 unsafe.Pointer
if len(events) > 0 {
_p0 = &events[0]
_p0 = unsafe.Pointer(&events[0])
}
r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(unsafe.Pointer(_p0)), uintptr(len(events)), uintptr(msec), 0, 0)
r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0)
n = int(r0)
errno = int(e1)
return
@ -216,11 +216,11 @@ func Ftruncate(fd int, length int64) (errno int) {
}
func Getdents(fd int, buf []byte) (n int, errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = &buf[0]
_p0 = unsafe.Pointer(&buf[0])
}
r0, _, e1 := Syscall(SYS_GETDENTS64, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)))
r0, _, e1 := Syscall(SYS_GETDENTS64, uintptr(fd), uintptr(_p0), uintptr(len(buf)))
n = int(r0)
errno = int(e1)
return
@ -269,12 +269,6 @@ func Gettid() (tid int) {
return
}
func Gettimeofday(tv *Timeval) (errno int) {
_, _, e1 := Syscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0)
errno = int(e1)
return
}
func Kill(pid int, sig int) (errno int) {
_, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(sig), 0)
errno = int(e1)
@ -282,11 +276,11 @@ func Kill(pid int, sig int) (errno int) {
}
func Klogctl(typ int, buf []byte) (n int, errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = &buf[0]
_p0 = unsafe.Pointer(&buf[0])
}
r0, _, e1 := Syscall(SYS_SYSLOG, uintptr(typ), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)))
r0, _, e1 := Syscall(SYS_SYSLOG, uintptr(typ), uintptr(_p0), uintptr(len(buf)))
n = int(r0)
errno = int(e1)
return
@ -341,44 +335,44 @@ func PivotRoot(newroot string, putold string) (errno int) {
}
func Pread(fd int, p []byte, offset int64) (n int, errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = &p[0]
_p0 = unsafe.Pointer(&p[0])
}
r0, _, e1 := Syscall6(SYS_PREAD64, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0)
r0, _, e1 := Syscall6(SYS_PREAD64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0)
n = int(r0)
errno = int(e1)
return
}
func Pwrite(fd int, p []byte, offset int64) (n int, errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = &p[0]
_p0 = unsafe.Pointer(&p[0])
}
r0, _, e1 := Syscall6(SYS_PWRITE64, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0)
r0, _, e1 := Syscall6(SYS_PWRITE64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0)
n = int(r0)
errno = int(e1)
return
}
func Read(fd int, p []byte) (n int, errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = &p[0]
_p0 = unsafe.Pointer(&p[0])
}
r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)))
r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p)))
n = int(r0)
errno = int(e1)
return
}
func Readlink(path string, buf []byte) (n int, errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = &buf[0]
_p0 = unsafe.Pointer(&buf[0])
}
r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)))
r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(_p0), uintptr(len(buf)))
n = int(r0)
errno = int(e1)
return
@ -403,21 +397,21 @@ func Rmdir(path string) (errno int) {
}
func Setdomainname(p []byte) (errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = &p[0]
_p0 = unsafe.Pointer(&p[0])
}
_, _, e1 := Syscall(SYS_SETDOMAINNAME, uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), 0)
_, _, e1 := Syscall(SYS_SETDOMAINNAME, uintptr(_p0), uintptr(len(p)), 0)
errno = int(e1)
return
}
func Sethostname(p []byte) (errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = &p[0]
_p0 = unsafe.Pointer(&p[0])
}
_, _, e1 := Syscall(SYS_SETHOSTNAME, uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), 0)
_, _, e1 := Syscall(SYS_SETHOSTNAME, uintptr(_p0), uintptr(len(p)), 0)
errno = int(e1)
return
}
@ -490,13 +484,6 @@ func Tgkill(tgid int, tid int, sig int) (errno int) {
return
}
func Time(t *Time_t) (tt Time_t, errno int) {
r0, _, e1 := Syscall(SYS_TIME, uintptr(unsafe.Pointer(t)), 0, 0)
tt = Time_t(r0)
errno = int(e1)
return
}
func Times(tms *Tms) (ticks uintptr, errno int) {
r0, _, e1 := Syscall(SYS_TIMES, uintptr(unsafe.Pointer(tms)), 0, 0)
ticks = uintptr(r0)
@ -553,11 +540,11 @@ func Utime(path string, buf *Utimbuf) (errno int) {
}
func Write(fd int, p []byte) (n int, errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = &p[0]
_p0 = unsafe.Pointer(&p[0])
}
r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)))
r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)))
n = int(r0)
errno = int(e1)
return
@ -641,22 +628,22 @@ func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int) {
}
func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = &p[0]
_p0 = unsafe.Pointer(&p[0])
}
r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
n = int(r0)
errno = int(e1)
return
}
func sendto(s int, buf []byte, flags int, to uintptr, addrlen _Socklen) (errno int) {
var _p0 *byte
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = &buf[0]
_p0 = unsafe.Pointer(&buf[0])
}
_, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen))
_, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen))
errno = int(e1)
return
}
@ -806,3 +793,16 @@ func Statfs(path string, buf *Statfs_t) (errno int) {
errno = int(e1)
return
}
func Gettimeofday(tv *Timeval) (errno int) {
_, _, e1 := Syscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0)
errno = int(e1)
return
}
func Time(t *Time_t) (tt Time_t, errno int) {
r0, _, e1 := Syscall(SYS_TIME, uintptr(unsafe.Pointer(t)), 0, 0)
tt = Time_t(r0)
errno = int(e1)
return
}