github.com/Andyfoo/golang/x/sys@v0.0.0-20190901054642-57c1bf301704/unix/types_dragonfly.go (about) 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 5 // +build ignore 6 7 /* 8 Input to cgo -godefs. See README.md 9 */ 10 11 // +godefs map struct_in_addr [4]byte /* in_addr */ 12 // +godefs map struct_in6_addr [16]byte /* in6_addr */ 13 14 package unix 15 16 /* 17 #define KERNEL 18 #include <dirent.h> 19 #include <fcntl.h> 20 #include <poll.h> 21 #include <signal.h> 22 #include <termios.h> 23 #include <stdio.h> 24 #include <unistd.h> 25 #include <sys/event.h> 26 #include <sys/mman.h> 27 #include <sys/mount.h> 28 #include <sys/param.h> 29 #include <sys/ptrace.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/types.h> 37 #include <sys/un.h> 38 #include <sys/utsname.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 48 enum { 49 sizeofPtr = sizeof(void*), 50 }; 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 60 struct sockaddr_any { 61 struct sockaddr addr; 62 char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)]; 63 }; 64 65 */ 66 import "C" 67 68 // Machine characteristics 69 70 const ( 71 SizeofPtr = C.sizeofPtr 72 SizeofShort = C.sizeof_short 73 SizeofInt = C.sizeof_int 74 SizeofLong = C.sizeof_long 75 SizeofLongLong = C.sizeof_longlong 76 ) 77 78 // Basic types 79 80 type ( 81 _C_short C.short 82 _C_int C.int 83 _C_long C.long 84 _C_long_long C.longlong 85 ) 86 87 // Time 88 89 type Timespec C.struct_timespec 90 91 type Timeval C.struct_timeval 92 93 // Processes 94 95 type Rusage C.struct_rusage 96 97 type Rlimit C.struct_rlimit 98 99 type _Gid_t C.gid_t 100 101 // Files 102 103 type Stat_t C.struct_stat 104 105 type Statfs_t C.struct_statfs 106 107 type Flock_t C.struct_flock 108 109 type Dirent C.struct_dirent 110 111 type Fsid C.struct_fsid 112 113 // File system limits 114 115 const ( 116 PathMax = C.PATH_MAX 117 ) 118 119 // Sockets 120 121 type RawSockaddrInet4 C.struct_sockaddr_in 122 123 type RawSockaddrInet6 C.struct_sockaddr_in6 124 125 type RawSockaddrUnix C.struct_sockaddr_un 126 127 type RawSockaddrDatalink C.struct_sockaddr_dl 128 129 type RawSockaddr C.struct_sockaddr 130 131 type RawSockaddrAny C.struct_sockaddr_any 132 133 type _Socklen C.socklen_t 134 135 type Linger C.struct_linger 136 137 type Iovec C.struct_iovec 138 139 type IPMreq C.struct_ip_mreq 140 141 type IPv6Mreq C.struct_ipv6_mreq 142 143 type Msghdr C.struct_msghdr 144 145 type Cmsghdr C.struct_cmsghdr 146 147 type Inet6Pktinfo C.struct_in6_pktinfo 148 149 type IPv6MTUInfo C.struct_ip6_mtuinfo 150 151 type ICMPv6Filter C.struct_icmp6_filter 152 153 const ( 154 SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in 155 SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 156 SizeofSockaddrAny = C.sizeof_struct_sockaddr_any 157 SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un 158 SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl 159 SizeofLinger = C.sizeof_struct_linger 160 SizeofIPMreq = C.sizeof_struct_ip_mreq 161 SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq 162 SizeofMsghdr = C.sizeof_struct_msghdr 163 SizeofCmsghdr = C.sizeof_struct_cmsghdr 164 SizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo 165 SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo 166 SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter 167 ) 168 169 // Ptrace requests 170 171 const ( 172 PTRACE_TRACEME = C.PT_TRACE_ME 173 PTRACE_CONT = C.PT_CONTINUE 174 PTRACE_KILL = C.PT_KILL 175 ) 176 177 // Events (kqueue, kevent) 178 179 type Kevent_t C.struct_kevent 180 181 // Select 182 183 type FdSet C.fd_set 184 185 // Routing and interface messages 186 187 const ( 188 SizeofIfMsghdr = C.sizeof_struct_if_msghdr 189 SizeofIfData = C.sizeof_struct_if_data 190 SizeofIfaMsghdr = C.sizeof_struct_ifa_msghdr 191 SizeofIfmaMsghdr = C.sizeof_struct_ifma_msghdr 192 SizeofIfAnnounceMsghdr = C.sizeof_struct_if_announcemsghdr 193 SizeofRtMsghdr = C.sizeof_struct_rt_msghdr 194 SizeofRtMetrics = C.sizeof_struct_rt_metrics 195 ) 196 197 type IfMsghdr C.struct_if_msghdr 198 199 type IfData C.struct_if_data 200 201 type IfaMsghdr C.struct_ifa_msghdr 202 203 type IfmaMsghdr C.struct_ifma_msghdr 204 205 type IfAnnounceMsghdr C.struct_if_announcemsghdr 206 207 type RtMsghdr C.struct_rt_msghdr 208 209 type RtMetrics C.struct_rt_metrics 210 211 // Berkeley packet filter 212 213 const ( 214 SizeofBpfVersion = C.sizeof_struct_bpf_version 215 SizeofBpfStat = C.sizeof_struct_bpf_stat 216 SizeofBpfProgram = C.sizeof_struct_bpf_program 217 SizeofBpfInsn = C.sizeof_struct_bpf_insn 218 SizeofBpfHdr = C.sizeof_struct_bpf_hdr 219 ) 220 221 type BpfVersion C.struct_bpf_version 222 223 type BpfStat C.struct_bpf_stat 224 225 type BpfProgram C.struct_bpf_program 226 227 type BpfInsn C.struct_bpf_insn 228 229 type BpfHdr C.struct_bpf_hdr 230 231 // Terminal handling 232 233 type Termios C.struct_termios 234 235 type Winsize C.struct_winsize 236 237 // fchmodat-like syscalls. 238 239 const ( 240 AT_FDCWD = C.AT_FDCWD 241 AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW 242 ) 243 244 // poll 245 246 type PollFd C.struct_pollfd 247 248 const ( 249 POLLERR = C.POLLERR 250 POLLHUP = C.POLLHUP 251 POLLIN = C.POLLIN 252 POLLNVAL = C.POLLNVAL 253 POLLOUT = C.POLLOUT 254 POLLPRI = C.POLLPRI 255 POLLRDBAND = C.POLLRDBAND 256 POLLRDNORM = C.POLLRDNORM 257 POLLWRBAND = C.POLLWRBAND 258 POLLWRNORM = C.POLLWRNORM 259 ) 260 261 // Uname 262 263 type Utsname C.struct_utsname