syscall_linux_ppc64x.go 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. //go:build linux && (ppc64 || ppc64le)
  5. // +build linux
  6. // +build ppc64 ppc64le
  7. package unix
  8. //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
  9. //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
  10. //sys Fchown(fd int, uid int, gid int) (err error)
  11. //sys Fstat(fd int, stat *Stat_t) (err error)
  12. //sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_NEWFSTATAT
  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) = SYS_UGETRLIMIT
  19. //sysnb Getuid() (uid int)
  20. //sys Ioperm(from int, num int, on int) (err error)
  21. //sys Iopl(level int) (err error)
  22. //sys Lchown(path string, uid int, gid int) (err error)
  23. //sys Listen(s int, n int) (err error)
  24. //sys Lstat(path string, stat *Stat_t) (err error)
  25. //sys Pause() (err error)
  26. //sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
  27. //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
  28. //sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
  29. //sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
  30. //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT
  31. //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
  32. //sys setfsgid(gid int) (prev int, err error)
  33. //sys setfsuid(uid int) (prev int, err error)
  34. //sysnb Setregid(rgid int, egid int) (err error)
  35. //sysnb Setresgid(rgid int, egid int, sgid int) (err error)
  36. //sysnb Setresuid(ruid int, euid int, suid int) (err error)
  37. //sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
  38. //sysnb Setreuid(ruid int, euid int) (err error)
  39. //sys Shutdown(fd int, how int) (err error)
  40. //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
  41. //sys Stat(path string, stat *Stat_t) (err error)
  42. //sys Statfs(path string, buf *Statfs_t) (err error)
  43. //sys Truncate(path string, length int64) (err error)
  44. //sys Ustat(dev int, ubuf *Ustat_t) (err error)
  45. //sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
  46. //sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
  47. //sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
  48. //sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
  49. //sysnb getgroups(n int, list *_Gid_t) (nn int, err error)
  50. //sysnb setgroups(n int, list *_Gid_t) (err error)
  51. //sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
  52. //sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
  53. //sysnb socket(domain int, typ int, proto int) (fd int, err error)
  54. //sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
  55. //sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
  56. //sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
  57. //sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
  58. //sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
  59. //sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
  60. //sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
  61. //sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
  62. //sys futimesat(dirfd int, path string, times *[2]Timeval) (err error)
  63. //sysnb Gettimeofday(tv *Timeval) (err error)
  64. //sysnb Time(t *Time_t) (tt Time_t, err error)
  65. //sys Utime(path string, buf *Utimbuf) (err error)
  66. //sys utimes(path string, times *[2]Timeval) (err error)
  67. func setTimespec(sec, nsec int64) Timespec {
  68. return Timespec{Sec: sec, Nsec: nsec}
  69. }
  70. func setTimeval(sec, usec int64) Timeval {
  71. return Timeval{Sec: sec, Usec: usec}
  72. }
  73. func (r *PtraceRegs) PC() uint64 { return r.Nip }
  74. func (r *PtraceRegs) SetPC(pc uint64) { r.Nip = pc }
  75. func (iov *Iovec) SetLen(length int) {
  76. iov.Len = uint64(length)
  77. }
  78. func (msghdr *Msghdr) SetControllen(length int) {
  79. msghdr.Controllen = uint64(length)
  80. }
  81. func (msghdr *Msghdr) SetIovlen(length int) {
  82. msghdr.Iovlen = uint64(length)
  83. }
  84. func (cmsg *Cmsghdr) SetLen(length int) {
  85. cmsg.Len = uint64(length)
  86. }
  87. func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) {
  88. rsa.Service_name_len = uint64(length)
  89. }
  90. //sys syncFileRange2(fd int, flags int, off int64, n int64) (err error) = SYS_SYNC_FILE_RANGE2
  91. func SyncFileRange(fd int, off int64, n int64, flags int) error {
  92. // The sync_file_range and sync_file_range2 syscalls differ only in the
  93. // order of their arguments.
  94. return syncFileRange2(fd, flags, off, n)
  95. }
  96. //sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error)
  97. func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error {
  98. cmdlineLen := len(cmdline)
  99. if cmdlineLen > 0 {
  100. // Account for the additional NULL byte added by
  101. // BytePtrFromString in kexecFileLoad. The kexec_file_load
  102. // syscall expects a NULL-terminated string.
  103. cmdlineLen++
  104. }
  105. return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
  106. }