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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  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 also mkerrors.sh and mkall.sh
  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 <limits.h>
  21. #include <signal.h>
  22. #include <termios.h>
  23. #include <termio.h>
  24. #include <stdio.h>
  25. #include <unistd.h>
  26. #include <sys/mman.h>
  27. #include <sys/mount.h>
  28. #include <sys/param.h>
  29. #include <sys/resource.h>
  30. #include <sys/select.h>
  31. #include <sys/signal.h>
  32. #include <sys/socket.h>
  33. #include <sys/stat.h>
  34. #include <sys/time.h>
  35. #include <sys/times.h>
  36. #include <sys/types.h>
  37. #include <sys/utsname.h>
  38. #include <sys/un.h>
  39. #include <sys/wait.h>
  40. #include <net/bpf.h>
  41. #include <net/if.h>
  42. #include <net/if_dl.h>
  43. #include <net/route.h>
  44. #include <netinet/in.h>
  45. #include <netinet/icmp6.h>
  46. #include <netinet/tcp.h>
  47. #include <ustat.h>
  48. #include <utime.h>
  49. enum {
  50. sizeofPtr = sizeof(void*),
  51. };
  52. union sockaddr_all {
  53. struct sockaddr s1; // this one gets used for fields
  54. struct sockaddr_in s2; // these pad it out
  55. struct sockaddr_in6 s3;
  56. struct sockaddr_un s4;
  57. struct sockaddr_dl s5;
  58. };
  59. struct sockaddr_any {
  60. struct sockaddr addr;
  61. char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
  62. };
  63. */
  64. import "C"
  65. // Machine characteristics; for internal use.
  66. const (
  67. sizeofPtr = C.sizeofPtr
  68. sizeofShort = C.sizeof_short
  69. sizeofInt = C.sizeof_int
  70. sizeofLong = C.sizeof_long
  71. sizeofLongLong = C.sizeof_longlong
  72. PathMax = C.PATH_MAX
  73. )
  74. // Basic types
  75. type (
  76. _C_short C.short
  77. _C_int C.int
  78. _C_long C.long
  79. _C_long_long C.longlong
  80. )
  81. // Time
  82. type Timespec C.struct_timespec
  83. type Timeval C.struct_timeval
  84. type Timeval32 C.struct_timeval32
  85. type Tms C.struct_tms
  86. type Utimbuf C.struct_utimbuf
  87. // Processes
  88. type Rusage C.struct_rusage
  89. type Rlimit C.struct_rlimit
  90. type _Gid_t C.gid_t
  91. // Files
  92. const ( // Directory mode bits
  93. S_IFMT = C.S_IFMT
  94. S_IFIFO = C.S_IFIFO
  95. S_IFCHR = C.S_IFCHR
  96. S_IFDIR = C.S_IFDIR
  97. S_IFBLK = C.S_IFBLK
  98. S_IFREG = C.S_IFREG
  99. S_IFLNK = C.S_IFLNK
  100. S_IFSOCK = C.S_IFSOCK
  101. S_ISUID = C.S_ISUID
  102. S_ISGID = C.S_ISGID
  103. S_ISVTX = C.S_ISVTX
  104. S_IRUSR = C.S_IRUSR
  105. S_IWUSR = C.S_IWUSR
  106. S_IXUSR = C.S_IXUSR
  107. )
  108. type Stat_t C.struct_stat
  109. type Flock_t C.struct_flock
  110. type Dirent C.struct_dirent
  111. // Sockets
  112. type RawSockaddrInet4 C.struct_sockaddr_in
  113. type RawSockaddrInet6 C.struct_sockaddr_in6
  114. type RawSockaddrUnix C.struct_sockaddr_un
  115. type RawSockaddrDatalink C.struct_sockaddr_dl
  116. type RawSockaddr C.struct_sockaddr
  117. type RawSockaddrAny C.struct_sockaddr_any
  118. type _Socklen C.socklen_t
  119. type Linger C.struct_linger
  120. type Iovec C.struct_iovec
  121. type IPMreq C.struct_ip_mreq
  122. type IPv6Mreq C.struct_ipv6_mreq
  123. type Msghdr C.struct_msghdr
  124. type Cmsghdr C.struct_cmsghdr
  125. type Inet6Pktinfo C.struct_in6_pktinfo
  126. type IPv6MTUInfo C.struct_ip6_mtuinfo
  127. type ICMPv6Filter C.struct_icmp6_filter
  128. const (
  129. SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in
  130. SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6
  131. SizeofSockaddrAny = C.sizeof_struct_sockaddr_any
  132. SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un
  133. SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
  134. SizeofLinger = C.sizeof_struct_linger
  135. SizeofIPMreq = C.sizeof_struct_ip_mreq
  136. SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq
  137. SizeofMsghdr = C.sizeof_struct_msghdr
  138. SizeofCmsghdr = C.sizeof_struct_cmsghdr
  139. SizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo
  140. SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo
  141. SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter
  142. )
  143. // Select
  144. type FdSet C.fd_set
  145. // Misc
  146. type Utsname C.struct_utsname
  147. type Ustat_t C.struct_ustat
  148. const (
  149. AT_FDCWD = C.AT_FDCWD
  150. AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
  151. AT_SYMLINK_FOLLOW = C.AT_SYMLINK_FOLLOW
  152. AT_REMOVEDIR = C.AT_REMOVEDIR
  153. AT_EACCESS = C.AT_EACCESS
  154. )
  155. // Routing and interface messages
  156. const (
  157. SizeofIfMsghdr = C.sizeof_struct_if_msghdr
  158. SizeofIfData = C.sizeof_struct_if_data
  159. SizeofIfaMsghdr = C.sizeof_struct_ifa_msghdr
  160. SizeofRtMsghdr = C.sizeof_struct_rt_msghdr
  161. SizeofRtMetrics = C.sizeof_struct_rt_metrics
  162. )
  163. type IfMsghdr C.struct_if_msghdr
  164. type IfData C.struct_if_data
  165. type IfaMsghdr C.struct_ifa_msghdr
  166. type RtMsghdr C.struct_rt_msghdr
  167. type RtMetrics C.struct_rt_metrics
  168. // Berkeley packet filter
  169. const (
  170. SizeofBpfVersion = C.sizeof_struct_bpf_version
  171. SizeofBpfStat = C.sizeof_struct_bpf_stat
  172. SizeofBpfProgram = C.sizeof_struct_bpf_program
  173. SizeofBpfInsn = C.sizeof_struct_bpf_insn
  174. SizeofBpfHdr = C.sizeof_struct_bpf_hdr
  175. )
  176. type BpfVersion C.struct_bpf_version
  177. type BpfStat C.struct_bpf_stat
  178. type BpfProgram C.struct_bpf_program
  179. type BpfInsn C.struct_bpf_insn
  180. type BpfTimeval C.struct_bpf_timeval
  181. type BpfHdr C.struct_bpf_hdr
  182. // sysconf information
  183. const _SC_PAGESIZE = C._SC_PAGESIZE
  184. // Terminal handling
  185. type Termios C.struct_termios
  186. type Termio C.struct_termio
  187. type Winsize C.struct_winsize