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_openbsd.go 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  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. #include <dirent.h>
  14. #include <fcntl.h>
  15. #include <poll.h>
  16. #include <signal.h>
  17. #include <termios.h>
  18. #include <stdio.h>
  19. #include <unistd.h>
  20. #include <sys/param.h>
  21. #include <sys/types.h>
  22. #include <sys/event.h>
  23. #include <sys/mman.h>
  24. #include <sys/mount.h>
  25. #include <sys/ptrace.h>
  26. #include <sys/resource.h>
  27. #include <sys/select.h>
  28. #include <sys/signal.h>
  29. #include <sys/socket.h>
  30. #include <sys/stat.h>
  31. #include <sys/time.h>
  32. #include <sys/uio.h>
  33. #include <sys/un.h>
  34. #include <sys/utsname.h>
  35. #include <sys/wait.h>
  36. #include <uvm/uvmexp.h>
  37. #include <net/bpf.h>
  38. #include <net/if.h>
  39. #include <net/if_dl.h>
  40. #include <net/route.h>
  41. #include <netinet/in.h>
  42. #include <netinet/icmp6.h>
  43. #include <netinet/tcp.h>
  44. enum {
  45. sizeofPtr = sizeof(void*),
  46. };
  47. union sockaddr_all {
  48. struct sockaddr s1; // this one gets used for fields
  49. struct sockaddr_in s2; // these pad it out
  50. struct sockaddr_in6 s3;
  51. struct sockaddr_un s4;
  52. struct sockaddr_dl s5;
  53. };
  54. struct sockaddr_any {
  55. struct sockaddr addr;
  56. char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
  57. };
  58. */
  59. import "C"
  60. // Machine characteristics
  61. const (
  62. SizeofPtr = C.sizeofPtr
  63. SizeofShort = C.sizeof_short
  64. SizeofInt = C.sizeof_int
  65. SizeofLong = C.sizeof_long
  66. SizeofLongLong = C.sizeof_longlong
  67. )
  68. // Basic types
  69. type (
  70. _C_short C.short
  71. _C_int C.int
  72. _C_long C.long
  73. _C_long_long C.longlong
  74. )
  75. // Time
  76. type Timespec C.struct_timespec
  77. type Timeval C.struct_timeval
  78. // Processes
  79. type Rusage C.struct_rusage
  80. type Rlimit C.struct_rlimit
  81. type _Gid_t C.gid_t
  82. // Files
  83. type Stat_t C.struct_stat
  84. type Statfs_t C.struct_statfs
  85. type Flock_t C.struct_flock
  86. type Dirent C.struct_dirent
  87. type Fsid C.fsid_t
  88. // File system limits
  89. const (
  90. PathMax = C.PATH_MAX
  91. )
  92. // Sockets
  93. type RawSockaddrInet4 C.struct_sockaddr_in
  94. type RawSockaddrInet6 C.struct_sockaddr_in6
  95. type RawSockaddrUnix C.struct_sockaddr_un
  96. type RawSockaddrDatalink C.struct_sockaddr_dl
  97. type RawSockaddr C.struct_sockaddr
  98. type RawSockaddrAny C.struct_sockaddr_any
  99. type _Socklen C.socklen_t
  100. type Linger C.struct_linger
  101. type Iovec C.struct_iovec
  102. type IPMreq C.struct_ip_mreq
  103. type IPv6Mreq C.struct_ipv6_mreq
  104. type Msghdr C.struct_msghdr
  105. type Cmsghdr C.struct_cmsghdr
  106. type Inet6Pktinfo C.struct_in6_pktinfo
  107. type IPv6MTUInfo C.struct_ip6_mtuinfo
  108. type ICMPv6Filter C.struct_icmp6_filter
  109. const (
  110. SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in
  111. SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6
  112. SizeofSockaddrAny = C.sizeof_struct_sockaddr_any
  113. SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un
  114. SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
  115. SizeofLinger = C.sizeof_struct_linger
  116. SizeofIPMreq = C.sizeof_struct_ip_mreq
  117. SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq
  118. SizeofMsghdr = C.sizeof_struct_msghdr
  119. SizeofCmsghdr = C.sizeof_struct_cmsghdr
  120. SizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo
  121. SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo
  122. SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter
  123. )
  124. // Ptrace requests
  125. const (
  126. PTRACE_TRACEME = C.PT_TRACE_ME
  127. PTRACE_CONT = C.PT_CONTINUE
  128. PTRACE_KILL = C.PT_KILL
  129. )
  130. // Events (kqueue, kevent)
  131. type Kevent_t C.struct_kevent
  132. // Select
  133. type FdSet C.fd_set
  134. // Routing and interface messages
  135. const (
  136. SizeofIfMsghdr = C.sizeof_struct_if_msghdr
  137. SizeofIfData = C.sizeof_struct_if_data
  138. SizeofIfaMsghdr = C.sizeof_struct_ifa_msghdr
  139. SizeofIfAnnounceMsghdr = C.sizeof_struct_if_announcemsghdr
  140. SizeofRtMsghdr = C.sizeof_struct_rt_msghdr
  141. SizeofRtMetrics = C.sizeof_struct_rt_metrics
  142. )
  143. type IfMsghdr C.struct_if_msghdr
  144. type IfData C.struct_if_data
  145. type IfaMsghdr C.struct_ifa_msghdr
  146. type IfAnnounceMsghdr C.struct_if_announcemsghdr
  147. type RtMsghdr C.struct_rt_msghdr
  148. type RtMetrics C.struct_rt_metrics
  149. type Mclpool C.struct_mclpool
  150. // Berkeley packet filter
  151. const (
  152. SizeofBpfVersion = C.sizeof_struct_bpf_version
  153. SizeofBpfStat = C.sizeof_struct_bpf_stat
  154. SizeofBpfProgram = C.sizeof_struct_bpf_program
  155. SizeofBpfInsn = C.sizeof_struct_bpf_insn
  156. SizeofBpfHdr = C.sizeof_struct_bpf_hdr
  157. )
  158. type BpfVersion C.struct_bpf_version
  159. type BpfStat C.struct_bpf_stat
  160. type BpfProgram C.struct_bpf_program
  161. type BpfInsn C.struct_bpf_insn
  162. type BpfHdr C.struct_bpf_hdr
  163. type BpfTimeval C.struct_bpf_timeval
  164. // Terminal handling
  165. type Termios C.struct_termios
  166. type Winsize C.struct_winsize
  167. // fchmodat-like syscalls.
  168. const (
  169. AT_FDCWD = C.AT_FDCWD
  170. AT_SYMLINK_FOLLOW = C.AT_SYMLINK_FOLLOW
  171. AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
  172. )
  173. // poll
  174. type PollFd C.struct_pollfd
  175. const (
  176. POLLERR = C.POLLERR
  177. POLLHUP = C.POLLHUP
  178. POLLIN = C.POLLIN
  179. POLLNVAL = C.POLLNVAL
  180. POLLOUT = C.POLLOUT
  181. POLLPRI = C.POLLPRI
  182. POLLRDBAND = C.POLLRDBAND
  183. POLLRDNORM = C.POLLRDNORM
  184. POLLWRBAND = C.POLLWRBAND
  185. POLLWRNORM = C.POLLWRNORM
  186. )
  187. // Signal Sets
  188. type Sigset_t C.sigset_t
  189. // Uname
  190. type Utsname C.struct_utsname
  191. // Uvmexp
  192. const SizeofUvmexp = C.sizeof_struct_uvmexp
  193. type Uvmexp C.struct_uvmexp
  194. // Clockinfo
  195. const SizeofClockinfo = C.sizeof_struct_clockinfo
  196. type Clockinfo C.struct_clockinfo