Source file src/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  const _SYS_setgroups = SYS_SETGROUPS
     8  
     9  //sys	Dup2(oldfd int, newfd int) (err error)
    10  //sysnb	EpollCreate(size int) (fd int, err error)
    11  //sys	Fchown(fd int, uid int, gid int) (err error)
    12  //sys	Fstat(fd int, stat *Stat_t) (err error)
    13  //sys	Fstatfs(fd int, buf *Statfs_t) (err error)
    14  //sys	Ftruncate(fd int, length int64) (err error)
    15  //sysnb	Getegid() (egid int)
    16  //sysnb	Geteuid() (euid int)
    17  //sysnb	Getgid() (gid int)
    18  //sysnb	Getrlimit(resource int, rlim *Rlimit) (err error)
    19  //sysnb	Getuid() (uid int)
    20  //sysnb	InotifyInit() (fd int, err error)
    21  //sys	Ioperm(from int, num int, on int) (err error)
    22  //sys	Iopl(level int) (err error)
    23  //sys	Listen(s int, n int) (err error)
    24  //sys	Pause() (err error)
    25  //sys	pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
    26  //sys	pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
    27  //sys	Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
    28  //sys	Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
    29  //sys	Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
    30  //sys	sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
    31  //sys	Setfsgid(gid int) (err error)
    32  //sys	Setfsuid(uid int) (err error)
    33  //sysnb	Setrlimit(resource int, rlim *Rlimit) (err error)
    34  //sys	Shutdown(fd int, how int) (err error)
    35  //sys	Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, 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	Ustat(dev int, ubuf *Ustat_t) (err error)
    40  //sys	accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
    41  //sys	bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
    42  //sys	connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
    43  //sys	fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_NEWFSTATAT
    44  //sysnb	getgroups(n int, list *_Gid_t) (nn int, err error)
    45  //sys	getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
    46  //sys	setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
    47  //sysnb	socket(domain int, typ int, proto int) (fd int, err error)
    48  //sysnb	socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
    49  //sysnb	getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
    50  //sysnb	getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
    51  //sys	recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
    52  //sys	sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
    53  //sys	recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
    54  //sys	sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
    55  //sys	mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
    56  //sys	EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
    57  
    58  func Stat(path string, stat *Stat_t) (err error) {
    59  	return fstatat(_AT_FDCWD, path, stat, 0)
    60  }
    61  
    62  func Lchown(path string, uid int, gid int) (err error) {
    63  	return Fchownat(_AT_FDCWD, path, uid, gid, _AT_SYMLINK_NOFOLLOW)
    64  }
    65  
    66  func Lstat(path string, stat *Stat_t) (err error) {
    67  	return fstatat(_AT_FDCWD, path, stat, _AT_SYMLINK_NOFOLLOW)
    68  }
    69  
    70  //sys	futimesat(dirfd int, path string, times *[2]Timeval) (err error)
    71  
    72  //go:noescape
    73  func gettimeofday(tv *Timeval) (err Errno)
    74  
    75  func Gettimeofday(tv *Timeval) (err error) {
    76  	errno := gettimeofday(tv)
    77  	if errno != 0 {
    78  		return errno
    79  	}
    80  	return nil
    81  }
    82  
    83  func Time(t *Time_t) (tt Time_t, err error) {
    84  	var tv Timeval
    85  	errno := gettimeofday(&tv)
    86  	if errno != 0 {
    87  		return 0, errno
    88  	}
    89  	if t != nil {
    90  		*t = Time_t(tv.Sec)
    91  	}
    92  	return Time_t(tv.Sec), nil
    93  }
    94  
    95  //sys	Utime(path string, buf *Utimbuf) (err error)
    96  //sys	utimes(path string, times *[2]Timeval) (err error)
    97  
    98  func setTimespec(sec, nsec int64) Timespec {
    99  	return Timespec{Sec: sec, Nsec: nsec}
   100  }
   101  
   102  func setTimeval(sec, usec int64) Timeval {
   103  	return Timeval{Sec: sec, Usec: usec}
   104  }
   105  
   106  func (r *PtraceRegs) PC() uint64 { return r.Rip }
   107  
   108  func (r *PtraceRegs) SetPC(pc uint64) { r.Rip = pc }
   109  
   110  func (iov *Iovec) SetLen(length int) {
   111  	iov.Len = uint64(length)
   112  }
   113  
   114  func (msghdr *Msghdr) SetControllen(length int) {
   115  	msghdr.Controllen = uint64(length)
   116  }
   117  
   118  func (cmsg *Cmsghdr) SetLen(length int) {
   119  	cmsg.Len = uint64(length)
   120  }
   121  
   122  func rawVforkSyscall(trap, a1 uintptr) (r1 uintptr, err Errno)
   123  

View as plain text