syscall_linux_ppc64x.go 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. // +build linux
  5. // +build ppc64 ppc64le
  6. package unix
  7. //sys Fchown(fd int, uid int, gid int) (err error)
  8. //sys Fstat(fd int, stat *Stat_t) (err error)
  9. //sys Fstatfs(fd int, buf *Statfs_t) (err error)
  10. //sys Ftruncate(fd int, length int64) (err error)
  11. //sysnb Getegid() (egid int)
  12. //sysnb Geteuid() (euid int)
  13. //sysnb Getgid() (gid int)
  14. //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) = SYS_UGETRLIMIT
  15. //sysnb Getuid() (uid int)
  16. //sys Ioperm(from int, num int, on int) (err error)
  17. //sys Iopl(level int) (err error)
  18. //sys Lchown(path string, uid int, gid int) (err error)
  19. //sys Listen(s int, n int) (err error)
  20. //sys Lstat(path string, stat *Stat_t) (err error)
  21. //sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
  22. //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
  23. //sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
  24. //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
  25. //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
  26. //sys Setfsgid(gid int) (err error)
  27. //sys Setfsuid(uid int) (err error)
  28. //sysnb Setregid(rgid int, egid int) (err error)
  29. //sysnb Setresgid(rgid int, egid int, sgid int) (err error)
  30. //sysnb Setresuid(ruid int, euid int, suid int) (err error)
  31. //sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
  32. //sysnb Setreuid(ruid int, euid int) (err error)
  33. //sys Shutdown(fd int, how int) (err error)
  34. //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
  35. //sys Stat(path string, stat *Stat_t) (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) = SYS_SYNC_FILE_RANGE2
  38. //sys Truncate(path string, length int64) (err error)
  39. //sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, 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. //sysnb getgroups(n int, list *_Gid_t) (nn int, err error)
  44. //sysnb setgroups(n int, list *_Gid_t) (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. func Getpagesize() int { return 65536 }
  57. //sysnb Gettimeofday(tv *Timeval) (err error)
  58. //sysnb Time(t *Time_t) (tt Time_t, err error)
  59. func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
  60. func NsecToTimespec(nsec int64) (ts Timespec) {
  61. ts.Sec = nsec / 1e9
  62. ts.Nsec = nsec % 1e9
  63. return
  64. }
  65. func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
  66. func NsecToTimeval(nsec int64) (tv Timeval) {
  67. nsec += 999 // round up to microsecond
  68. tv.Sec = nsec / 1e9
  69. tv.Usec = nsec % 1e9 / 1e3
  70. return
  71. }
  72. func (r *PtraceRegs) PC() uint64 { return r.Nip }
  73. func (r *PtraceRegs) SetPC(pc uint64) { r.Nip = pc }
  74. func (iov *Iovec) SetLen(length int) {
  75. iov.Len = uint64(length)
  76. }
  77. func (msghdr *Msghdr) SetControllen(length int) {
  78. msghdr.Controllen = uint64(length)
  79. }
  80. func (cmsg *Cmsghdr) SetLen(length int) {
  81. cmsg.Len = uint64(length)
  82. }