src/pkg/syscall/syscall_linux_amd64.go - The Go Programming Language

Golang

Source file src/pkg/syscall/syscall_linux_amd64.go

     1	// Copyright 2009 The Go Authors. All rights reserved.
     2	// Use of this source code is governed by a BSD-style
     3	// license that can be found in the LICENSE file.
     4	
     5	package syscall
     6	
     7	//sys	Chown(path string, uid int, gid int) (err error)
     8	//sys	Fchown(fd int, uid int, gid int) (err error)
     9	//sys	Fstat(fd int, stat *Stat_t) (err error)
    10	//sys	Fstatfs(fd int, buf *Statfs_t) (err error)
    11	//sys	Ftruncate(fd int, length int64) (err error)
    12	//sysnb	Getegid() (egid int)
    13	//sysnb	Geteuid() (euid int)
    14	//sysnb	Getgid() (gid int)
    15	//sysnb	Getuid() (uid int)
    16	//sys	Ioperm(from int, num int, on int) (err error)
    17	//sys	Iopl(level int) (err error)
    18	//sys	Lchown(path string, uid int, gid int) (err error)
    19	//sys	Listen(s int, n int) (err error)
    20	//sys	Lstat(path string, stat *Stat_t) (err error)
    21	//sys	Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
    22	//sys	Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
    23	//sys	Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
    24	//sys	Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
    25	//sys	Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
    26	//sys	Setfsgid(gid int) (err error)
    27	//sys	Setfsuid(uid int) (err error)
    28	//sysnb	Setgid(gid int) (err error)
    29	//sysnb	Setregid(rgid int, egid int) (err error)
    30	//sysnb	Setresgid(rgid int, egid int, sgid int) (err error)
    31	//sysnb	Setresuid(ruid int, euid int, suid int) (err error)
    32	//sysnb	Setreuid(ruid int, euid int) (err error)
    33	//sys	Shutdown(fd int, how int) (err error)
    34	//sys	Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
    35	//sys	Stat(path string, stat *Stat_t) (err error)
    36	//sys	Statfs(path string, buf *Statfs_t) (err error)
    37	//sys	SyncFileRange(fd int, off int64, n int64, flags int) (err error)
    38	//sys	Truncate(path string, length int64) (err error)
    39	//sys	accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
    40	//sys	bind(s int, addr uintptr, addrlen _Socklen) (err error)
    41	//sys	connect(s int, addr uintptr, addrlen _Socklen) (err error)
    42	//sysnb	getgroups(n int, list *_Gid_t) (nn int, err error)
    43	//sysnb	setgroups(n int, list *_Gid_t) (err error)
    44	//sys	getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error)
    45	//sys	setsockopt(s int, level int, name int, val uintptr, vallen uintptr) (err error)
    46	//sysnb	socket(domain int, typ int, proto int) (fd int, err error)
    47	//sysnb	socketpair(domain int, typ int, proto int, fd *[2]int) (err error)
    48	//sysnb	getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
    49	//sysnb	getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
    50	//sys	recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
    51	//sys	sendto(s int, buf []byte, flags int, to uintptr, addrlen _Socklen) (err error)
    52	//sys	recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
    53	//sys	sendmsg(s int, msg *Msghdr, flags int) (err error)
    54	//sys	mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
    55	
    56	func Getpagesize() int { return 4096 }
    57	
    58	func Gettimeofday(tv *Timeval) (err error)
    59	func Time(t *Time_t) (tt Time_t, err error)
    60	
    61	func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
    62	
    63	func NsecToTimespec(nsec int64) (ts Timespec) {
    64		ts.Sec = nsec / 1e9
    65		ts.Nsec = nsec % 1e9
    66		return
    67	}
    68	
    69	func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
    70	
    71	func NsecToTimeval(nsec int64) (tv Timeval) {
    72		nsec += 999 // round up to microsecond
    73		tv.Sec = nsec / 1e9
    74		tv.Usec = nsec % 1e9 / 1e3
    75		return
    76	}
    77	
    78	func (r *PtraceRegs) PC() uint64 { return r.Rip }
    79	
    80	func (r *PtraceRegs) SetPC(pc uint64) { r.Rip = pc }
    81	
    82	func (iov *Iovec) SetLen(length int) {
    83		iov.Len = uint64(length)
    84	}
    85	
    86	func (msghdr *Msghdr) SetControllen(length int) {
    87		msghdr.Controllen = uint64(length)
    88	}
    89	
    90	func (cmsg *Cmsghdr) SetLen(length int) {
    91		cmsg.Len = uint64(length)
    92	}