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	accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
    41  //sys	accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
    42  //sys	bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
    43  //sys	connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
    44  //sys	fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_NEWFSTATAT
    45  //sysnb	getgroups(n int, list *_Gid_t) (nn int, err error)
    46  //sys	getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
    47  //sys	setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
    48  //sysnb	socket(domain int, typ int, proto int) (fd int, err error)
    49  //sysnb	socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
    50  //sysnb	getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
    51  //sysnb	getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
    52  //sys	recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
    53  //sys	sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
    54  //sys	recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
    55  //sys	sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
    56  //sys	mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
    57  //sys	EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
    58  
    59  func Stat(path string, stat *Stat_t) (err error) {
    60  	return fstatat(_AT_FDCWD, path, stat, 0)
    61  }
    62  
    63  func Lchown(path string, uid int, gid int) (err error) {
    64  	return Fchownat(_AT_FDCWD, path, uid, gid, _AT_SYMLINK_NOFOLLOW)
    65  }
    66  
    67  func Lstat(path string, stat *Stat_t) (err error) {
    68  	return fstatat(_AT_FDCWD, path, stat, _AT_SYMLINK_NOFOLLOW)
    69  }
    70  
    71  //sys	futimesat(dirfd int, path string, times *[2]Timeval) (err error)
    72  
    73  //go:noescape
    74  func gettimeofday(tv *Timeval) (err Errno)
    75  
    76  func Gettimeofday(tv *Timeval) (err error) {
    77  	errno := gettimeofday(tv)
    78  	if errno != 0 {
    79  		return errno
    80  	}
    81  	return nil
    82  }
    83  
    84  func Time(t *Time_t) (tt Time_t, err error) {
    85  	var tv Timeval
    86  	errno := gettimeofday(&tv)
    87  	if errno != 0 {
    88  		return 0, errno
    89  	}
    90  	if t != nil {
    91  		*t = Time_t(tv.Sec)
    92  	}
    93  	return Time_t(tv.Sec), nil
    94  }
    95  
    96  //sys	Utime(path string, buf *Utimbuf) (err error)
    97  //sys	utimes(path string, times *[2]Timeval) (err error)
    98  
    99  func setTimespec(sec, nsec int64) Timespec {
   100  	return Timespec{Sec: sec, Nsec: nsec}
   101  }
   102  
   103  func setTimeval(sec, usec int64) Timeval {
   104  	return Timeval{Sec: sec, Usec: usec}
   105  }
   106  
   107  func (r *PtraceRegs) PC() uint64 { return r.Rip }
   108  
   109  func (r *PtraceRegs) SetPC(pc uint64) { r.Rip = pc }
   110  
   111  func (iov *Iovec) SetLen(length int) {
   112  	iov.Len = uint64(length)
   113  }
   114  
   115  func (msghdr *Msghdr) SetControllen(length int) {
   116  	msghdr.Controllen = uint64(length)
   117  }
   118  
   119  func (cmsg *Cmsghdr) SetLen(length int) {
   120  	cmsg.Len = uint64(length)
   121  }
   122  
   123  func rawVforkSyscall(trap, a1 uintptr) (r1 uintptr, err Errno)
   124  

View as plain text