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.
 
 
 

263 lines
5.4 KiB

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