You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

types_solaris.go 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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 ignore
  5. /*
  6. Input to cgo -godefs. See README.md
  7. */
  8. // +godefs map struct_in_addr [4]byte /* in_addr */
  9. // +godefs map struct_in6_addr [16]byte /* in6_addr */
  10. package unix
  11. /*
  12. #define KERNEL
  13. // These defines ensure that builds done on newer versions of Solaris are
  14. // backwards-compatible with older versions of Solaris and
  15. // OpenSolaris-based derivatives.
  16. #define __USE_SUNOS_SOCKETS__ // msghdr
  17. #define __USE_LEGACY_PROTOTYPES__ // iovec
  18. #include <dirent.h>
  19. #include <fcntl.h>
  20. #include <netdb.h>
  21. #include <limits.h>
  22. #include <poll.h>
  23. #include <signal.h>
  24. #include <termios.h>
  25. #include <termio.h>
  26. #include <stdio.h>
  27. #include <unistd.h>
  28. #include <sys/mman.h>
  29. #include <sys/mount.h>
  30. #include <sys/param.h>
  31. #include <sys/resource.h>
  32. #include <sys/select.h>
  33. #include <sys/signal.h>
  34. #include <sys/socket.h>
  35. #include <sys/stat.h>
  36. #include <sys/statvfs.h>
  37. #include <sys/time.h>
  38. #include <sys/times.h>
  39. #include <sys/types.h>
  40. #include <sys/utsname.h>
  41. #include <sys/un.h>
  42. #include <sys/wait.h>
  43. #include <net/bpf.h>
  44. #include <net/if.h>
  45. #include <net/if_dl.h>
  46. #include <net/route.h>
  47. #include <netinet/in.h>
  48. #include <netinet/icmp6.h>
  49. #include <netinet/tcp.h>
  50. #include <ustat.h>
  51. #include <utime.h>
  52. enum {
  53. sizeofPtr = sizeof(void*),
  54. };
  55. union sockaddr_all {
  56. struct sockaddr s1; // this one gets used for fields
  57. struct sockaddr_in s2; // these pad it out
  58. struct sockaddr_in6 s3;
  59. struct sockaddr_un s4;
  60. struct sockaddr_dl s5;
  61. };
  62. struct sockaddr_any {
  63. struct sockaddr addr;
  64. char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
  65. };
  66. */
  67. import "C"
  68. // Machine characteristics
  69. const (
  70. SizeofPtr = C.sizeofPtr
  71. SizeofShort = C.sizeof_short
  72. SizeofInt = C.sizeof_int
  73. SizeofLong = C.sizeof_long
  74. SizeofLongLong = C.sizeof_longlong
  75. PathMax = C.PATH_MAX
  76. MaxHostNameLen = C.MAXHOSTNAMELEN
  77. )
  78. // Basic types
  79. type (
  80. _C_short C.short
  81. _C_int C.int
  82. _C_long C.long
  83. _C_long_long C.longlong
  84. )
  85. // Time
  86. type Timespec C.struct_timespec
  87. type Timeval C.struct_timeval
  88. type Timeval32 C.struct_timeval32
  89. type Tms C.struct_tms
  90. type Utimbuf C.struct_utimbuf
  91. // Processes
  92. type Rusage C.struct_rusage
  93. type Rlimit C.struct_rlimit
  94. type _Gid_t C.gid_t
  95. // Files
  96. type Stat_t C.struct_stat
  97. type Flock_t C.struct_flock
  98. type Dirent C.struct_dirent
  99. // Filesystems
  100. type _Fsblkcnt_t C.fsblkcnt_t
  101. type Statvfs_t C.struct_statvfs
  102. // Sockets
  103. type RawSockaddrInet4 C.struct_sockaddr_in
  104. type RawSockaddrInet6 C.struct_sockaddr_in6
  105. type RawSockaddrUnix C.struct_sockaddr_un
  106. type RawSockaddrDatalink C.struct_sockaddr_dl
  107. type RawSockaddr C.struct_sockaddr
  108. type RawSockaddrAny C.struct_sockaddr_any
  109. type _Socklen C.socklen_t
  110. type Linger C.struct_linger
  111. type Iovec C.struct_iovec
  112. type IPMreq C.struct_ip_mreq
  113. type IPv6Mreq C.struct_ipv6_mreq
  114. type Msghdr C.struct_msghdr
  115. type Cmsghdr C.struct_cmsghdr
  116. type Inet6Pktinfo C.struct_in6_pktinfo
  117. type IPv6MTUInfo C.struct_ip6_mtuinfo
  118. type ICMPv6Filter C.struct_icmp6_filter
  119. const (
  120. SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in
  121. SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6
  122. SizeofSockaddrAny = C.sizeof_struct_sockaddr_any
  123. SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un
  124. SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
  125. SizeofLinger = C.sizeof_struct_linger
  126. SizeofIPMreq = C.sizeof_struct_ip_mreq
  127. SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq
  128. SizeofMsghdr = C.sizeof_struct_msghdr
  129. SizeofCmsghdr = C.sizeof_struct_cmsghdr
  130. SizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo
  131. SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo
  132. SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter
  133. )
  134. // Select
  135. type FdSet C.fd_set
  136. // Misc
  137. type Utsname C.struct_utsname
  138. type Ustat_t C.struct_ustat
  139. const (
  140. AT_FDCWD = C.AT_FDCWD
  141. AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
  142. AT_SYMLINK_FOLLOW = C.AT_SYMLINK_FOLLOW
  143. AT_REMOVEDIR = C.AT_REMOVEDIR
  144. AT_EACCESS = C.AT_EACCESS
  145. )
  146. // Routing and interface messages
  147. const (
  148. SizeofIfMsghdr = C.sizeof_struct_if_msghdr
  149. SizeofIfData = C.sizeof_struct_if_data
  150. SizeofIfaMsghdr = C.sizeof_struct_ifa_msghdr
  151. SizeofRtMsghdr = C.sizeof_struct_rt_msghdr
  152. SizeofRtMetrics = C.sizeof_struct_rt_metrics
  153. )
  154. type IfMsghdr C.struct_if_msghdr
  155. type IfData C.struct_if_data
  156. type IfaMsghdr C.struct_ifa_msghdr
  157. type RtMsghdr C.struct_rt_msghdr
  158. type RtMetrics C.struct_rt_metrics
  159. // Berkeley packet filter
  160. const (
  161. SizeofBpfVersion = C.sizeof_struct_bpf_version
  162. SizeofBpfStat = C.sizeof_struct_bpf_stat
  163. SizeofBpfProgram = C.sizeof_struct_bpf_program
  164. SizeofBpfInsn = C.sizeof_struct_bpf_insn
  165. SizeofBpfHdr = C.sizeof_struct_bpf_hdr
  166. )
  167. type BpfVersion C.struct_bpf_version
  168. type BpfStat C.struct_bpf_stat
  169. type BpfProgram C.struct_bpf_program
  170. type BpfInsn C.struct_bpf_insn
  171. type BpfTimeval C.struct_bpf_timeval
  172. type BpfHdr C.struct_bpf_hdr
  173. // Terminal handling
  174. type Termios C.struct_termios
  175. type Termio C.struct_termio
  176. type Winsize C.struct_winsize
  177. // poll
  178. type PollFd C.struct_pollfd
  179. const (
  180. POLLERR = C.POLLERR
  181. POLLHUP = C.POLLHUP
  182. POLLIN = C.POLLIN
  183. POLLNVAL = C.POLLNVAL
  184. POLLOUT = C.POLLOUT
  185. POLLPRI = C.POLLPRI
  186. POLLRDBAND = C.POLLRDBAND
  187. POLLRDNORM = C.POLLRDNORM
  188. POLLWRBAND = C.POLLWRBAND
  189. POLLWRNORM = C.POLLWRNORM
  190. )