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_dragonfly.go 5.1KB

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