github.com/go-xe2/third@v1.0.3/golang.org/x/sys/unix/syscall_linux_ppc64x.go (about)

     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  // +build linux
     6  // +build ppc64 ppc64le
     7  
     8  package unix
     9  
    10  //sys	Dup2(oldfd int, newfd int) (err error)
    11  //sysnb	EpollCreate(size int) (fd int, err error)
    12  //sys	EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
    13  //sys	Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
    14  //sys	Fchown(fd int, uid int, gid int) (err error)
    15  //sys	Fstat(fd int, stat *Stat_t) (err error)
    16  //sys	Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_NEWFSTATAT
    17  //sys	Fstatfs(fd int, buf *Statfs_t) (err error)
    18  //sys	Ftruncate(fd int, length int64) (err error)
    19  //sysnb	Getegid() (egid int)
    20  //sysnb	Geteuid() (euid int)
    21  //sysnb	Getgid() (gid int)
    22  //sysnb	Getrlimit(resource int, rlim *Rlimit) (err error) = SYS_UGETRLIMIT
    23  //sysnb	Getuid() (uid int)
    24  //sysnb	InotifyInit() (fd int, err error)
    25  //sys	Ioperm(from int, num int, on int) (err error)
    26  //sys	Iopl(level int) (err error)
    27  //sys	Lchown(path string, uid int, gid int) (err error)
    28  //sys	Listen(s int, n int) (err error)
    29  //sys	Lstat(path string, stat *Stat_t) (err error)
    30  //sys	Pause() (err error)
    31  //sys	Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
    32  //sys	Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
    33  //sys	Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
    34  //sys	Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
    35  //sys	Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT
    36  //sys	sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
    37  //sys	Setfsgid(gid int) (err error)
    38  //sys	Setfsuid(uid int) (err error)
    39  //sysnb	Setregid(rgid int, egid int) (err error)
    40  //sysnb	Setresgid(rgid int, egid int, sgid int) (err error)
    41  //sysnb	Setresuid(ruid int, euid int, suid int) (err error)
    42  //sysnb	Setrlimit(resource int, rlim *Rlimit) (err error)
    43  //sysnb	Setreuid(ruid int, euid int) (err error)
    44  //sys	Shutdown(fd int, how int) (err error)
    45  //sys	Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
    46  //sys	Stat(path string, stat *Stat_t) (err error)
    47  //sys	Statfs(path string, buf *Statfs_t) (err error)
    48  //sys	Truncate(path string, length int64) (err error)
    49  //sys	Ustat(dev int, ubuf *Ustat_t) (err error)
    50  //sys	accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
    51  //sys	accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
    52  //sys	bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
    53  //sys	connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
    54  //sysnb	getgroups(n int, list *_Gid_t) (nn int, err error)
    55  //sysnb	setgroups(n int, list *_Gid_t) (err error)
    56  //sys	getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
    57  //sys	setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
    58  //sysnb	socket(domain int, typ int, proto int) (fd int, err error)
    59  //sysnb	socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
    60  //sysnb	getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
    61  //sysnb	getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
    62  //sys	recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
    63  //sys	sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
    64  //sys	recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
    65  //sys	sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
    66  //sys	mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
    67  
    68  //sys	futimesat(dirfd int, path string, times *[2]Timeval) (err error)
    69  //sysnb	Gettimeofday(tv *Timeval) (err error)
    70  //sysnb	Time(t *Time_t) (tt Time_t, err error)
    71  //sys	Utime(path string, buf *Utimbuf) (err error)
    72  //sys	utimes(path string, times *[2]Timeval) (err error)
    73  
    74  func setTimespec(sec, nsec int64) Timespec {
    75  	return Timespec{Sec: sec, Nsec: nsec}
    76  }
    77  
    78  func setTimeval(sec, usec int64) Timeval {
    79  	return Timeval{Sec: sec, Usec: usec}
    80  }
    81  
    82  func (r *PtraceRegs) PC() uint64 { return r.Nip }
    83  
    84  func (r *PtraceRegs) SetPC(pc uint64) { r.Nip = pc }
    85  
    86  func (iov *Iovec) SetLen(length int) {
    87  	iov.Len = uint64(length)
    88  }
    89  
    90  func (msghdr *Msghdr) SetControllen(length int) {
    91  	msghdr.Controllen = uint64(length)
    92  }
    93  
    94  func (cmsg *Cmsghdr) SetLen(length int) {
    95  	cmsg.Len = uint64(length)
    96  }
    97  
    98  //sysnb pipe(p *[2]_C_int) (err error)
    99  
   100  func Pipe(p []int) (err error) {
   101  	if len(p) != 2 {
   102  		return EINVAL
   103  	}
   104  	var pp [2]_C_int
   105  	err = pipe(&pp)
   106  	p[0] = int(pp[0])
   107  	p[1] = int(pp[1])
   108  	return
   109  }
   110  
   111  //sysnb pipe2(p *[2]_C_int, flags int) (err error)
   112  
   113  func Pipe2(p []int, flags int) (err error) {
   114  	if len(p) != 2 {
   115  		return EINVAL
   116  	}
   117  	var pp [2]_C_int
   118  	err = pipe2(&pp, flags)
   119  	p[0] = int(pp[0])
   120  	p[1] = int(pp[1])
   121  	return
   122  }
   123  
   124  //sys	poll(fds *PollFd, nfds int, timeout int) (n int, err error)
   125  
   126  func Poll(fds []PollFd, timeout int) (n int, err error) {
   127  	if len(fds) == 0 {
   128  		return poll(nil, 0, timeout)
   129  	}
   130  	return poll(&fds[0], len(fds), timeout)
   131  }
   132  
   133  //sys	syncFileRange2(fd int, flags int, off int64, n int64) (err error) = SYS_SYNC_FILE_RANGE2
   134  
   135  func SyncFileRange(fd int, off int64, n int64, flags int) error {
   136  	// The sync_file_range and sync_file_range2 syscalls differ only in the
   137  	// order of their arguments.
   138  	return syncFileRange2(fd, flags, off, n)
   139  }
   140  
   141  //sys	kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error)
   142  
   143  func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error {
   144  	cmdlineLen := len(cmdline)
   145  	if cmdlineLen > 0 {
   146  		// Account for the additional NULL byte added by
   147  		// BytePtrFromString in kexecFileLoad. The kexec_file_load
   148  		// syscall expects a NULL-terminated string.
   149  		cmdlineLen++
   150  	}
   151  	return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
   152  }