syscall_linux_sparc64.go 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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 sparc64,linux
  5. package unix
  6. //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
  7. //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
  8. //sys Dup2(oldfd int, newfd int) (err error)
  9. //sys Fchown(fd int, uid int, gid int) (err error)
  10. //sys Fstat(fd int, stat *Stat_t) (err error)
  11. //sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
  12. //sys Fstatfs(fd int, buf *Statfs_t) (err error)
  13. //sys Ftruncate(fd int, length int64) (err error)
  14. //sysnb Getegid() (egid int)
  15. //sysnb Geteuid() (euid int)
  16. //sysnb Getgid() (gid int)
  17. //sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
  18. //sysnb Getuid() (uid int)
  19. //sysnb InotifyInit() (fd int, err error)
  20. //sys Lchown(path string, uid int, gid int) (err error)
  21. //sys Listen(s int, n int) (err error)
  22. //sys Lstat(path string, stat *Stat_t) (err error)
  23. //sys Pause() (err error)
  24. //sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
  25. //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
  26. //sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
  27. //sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
  28. //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
  29. //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
  30. //sys Setfsgid(gid int) (err error)
  31. //sys Setfsuid(uid int) (err error)
  32. //sysnb Setregid(rgid int, egid int) (err error)
  33. //sysnb Setresgid(rgid int, egid int, sgid int) (err error)
  34. //sysnb Setresuid(ruid int, euid int, suid int) (err error)
  35. //sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
  36. //sysnb Setreuid(ruid int, euid int) (err error)
  37. //sys Shutdown(fd int, how int) (err error)
  38. //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
  39. //sys Stat(path string, stat *Stat_t) (err error)
  40. //sys Statfs(path string, buf *Statfs_t) (err error)
  41. //sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
  42. //sys Truncate(path string, length int64) (err error)
  43. //sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
  44. //sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
  45. //sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
  46. //sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
  47. //sysnb getgroups(n int, list *_Gid_t) (nn int, err error)
  48. //sysnb setgroups(n int, list *_Gid_t) (err error)
  49. //sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
  50. //sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
  51. //sysnb socket(domain int, typ int, proto int) (fd int, err error)
  52. //sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
  53. //sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
  54. //sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
  55. //sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
  56. //sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
  57. //sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
  58. //sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
  59. //sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
  60. func Ioperm(from int, num int, on int) (err error) {
  61. return ENOSYS
  62. }
  63. func Iopl(level int) (err error) {
  64. return ENOSYS
  65. }
  66. //sys futimesat(dirfd int, path string, times *[2]Timeval) (err error)
  67. //sysnb Gettimeofday(tv *Timeval) (err error)
  68. func Time(t *Time_t) (tt Time_t, err error) {
  69. var tv Timeval
  70. err = Gettimeofday(&tv)
  71. if err != nil {
  72. return 0, err
  73. }
  74. if t != nil {
  75. *t = Time_t(tv.Sec)
  76. }
  77. return Time_t(tv.Sec), nil
  78. }
  79. //sys Utime(path string, buf *Utimbuf) (err error)
  80. //sys utimes(path string, times *[2]Timeval) (err error)
  81. func setTimespec(sec, nsec int64) Timespec {
  82. return Timespec{Sec: sec, Nsec: nsec}
  83. }
  84. func setTimeval(sec, usec int64) Timeval {
  85. return Timeval{Sec: sec, Usec: int32(usec)}
  86. }
  87. func (r *PtraceRegs) PC() uint64 { return r.Tpc }
  88. func (r *PtraceRegs) SetPC(pc uint64) { r.Tpc = pc }
  89. func (iov *Iovec) SetLen(length int) {
  90. iov.Len = uint64(length)
  91. }
  92. func (msghdr *Msghdr) SetControllen(length int) {
  93. msghdr.Controllen = uint64(length)
  94. }
  95. func (msghdr *Msghdr) SetIovlen(length int) {
  96. msghdr.Iovlen = uint64(length)
  97. }
  98. func (cmsg *Cmsghdr) SetLen(length int) {
  99. cmsg.Len = uint64(length)
  100. }
  101. //sysnb pipe(p *[2]_C_int) (err error)
  102. func Pipe(p []int) (err error) {
  103. if len(p) != 2 {
  104. return EINVAL
  105. }
  106. var pp [2]_C_int
  107. err = pipe(&pp)
  108. p[0] = int(pp[0])
  109. p[1] = int(pp[1])
  110. return
  111. }
  112. //sysnb pipe2(p *[2]_C_int, flags int) (err error)
  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. //sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
  124. func Poll(fds []PollFd, timeout int) (n int, err error) {
  125. if len(fds) == 0 {
  126. return poll(nil, 0, timeout)
  127. }
  128. return poll(&fds[0], len(fds), timeout)
  129. }