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

View as plain text