github.com/etecs-ru/go-sys-wineventlog@v0.0.0-20210227233244-4c3abb794018/unix/types_freebsd.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 //go:build ignore 6 // +build ignore 7 8 /* 9 Input to cgo -godefs. See README.md 10 */ 11 12 // +godefs map struct_in_addr [4]byte /* in_addr */ 13 // +godefs map struct_in6_addr [16]byte /* in6_addr */ 14 15 package unix 16 17 /* 18 #define _WANT_FREEBSD11_STAT 1 19 #define _WANT_FREEBSD11_STATFS 1 20 #define _WANT_FREEBSD11_DIRENT 1 21 #define _WANT_FREEBSD11_KEVENT 1 22 23 #include <dirent.h> 24 #include <fcntl.h> 25 #include <poll.h> 26 #include <signal.h> 27 #include <termios.h> 28 #include <stdio.h> 29 #include <unistd.h> 30 #include <sys/capsicum.h> 31 #include <sys/event.h> 32 #include <sys/mman.h> 33 #include <sys/mount.h> 34 #include <sys/param.h> 35 #include <sys/ptrace.h> 36 #include <sys/resource.h> 37 #include <sys/select.h> 38 #include <sys/signal.h> 39 #include <sys/socket.h> 40 #include <sys/stat.h> 41 #include <sys/time.h> 42 #include <sys/types.h> 43 #include <sys/ucred.h> 44 #include <sys/un.h> 45 #include <sys/utsname.h> 46 #include <sys/wait.h> 47 #include <net/bpf.h> 48 #include <net/if.h> 49 #include <net/if_dl.h> 50 #include <net/route.h> 51 #include <netinet/in.h> 52 #include <netinet/icmp6.h> 53 #include <netinet/tcp.h> 54 55 enum { 56 sizeofPtr = sizeof(void*), 57 }; 58 59 union sockaddr_all { 60 struct sockaddr s1; // this one gets used for fields 61 struct sockaddr_in s2; // these pad it out 62 struct sockaddr_in6 s3; 63 struct sockaddr_un s4; 64 struct sockaddr_dl s5; 65 }; 66 67 struct sockaddr_any { 68 struct sockaddr addr; 69 char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)]; 70 }; 71 72 // This structure is a duplicate of if_data on FreeBSD 8-STABLE. 73 // See /usr/include/net/if.h. 74 struct if_data8 { 75 u_char ifi_type; 76 u_char ifi_physical; 77 u_char ifi_addrlen; 78 u_char ifi_hdrlen; 79 u_char ifi_link_state; 80 u_char ifi_spare_char1; 81 u_char ifi_spare_char2; 82 u_char ifi_datalen; 83 u_long ifi_mtu; 84 u_long ifi_metric; 85 u_long ifi_baudrate; 86 u_long ifi_ipackets; 87 u_long ifi_ierrors; 88 u_long ifi_opackets; 89 u_long ifi_oerrors; 90 u_long ifi_collisions; 91 u_long ifi_ibytes; 92 u_long ifi_obytes; 93 u_long ifi_imcasts; 94 u_long ifi_omcasts; 95 u_long ifi_iqdrops; 96 u_long ifi_noproto; 97 u_long ifi_hwassist; 98 // FIXME: these are now unions, so maybe need to change definitions? 99 #undef ifi_epoch 100 time_t ifi_epoch; 101 #undef ifi_lastchange 102 struct timeval ifi_lastchange; 103 }; 104 105 // This structure is a duplicate of if_msghdr on FreeBSD 8-STABLE. 106 // See /usr/include/net/if.h. 107 struct if_msghdr8 { 108 u_short ifm_msglen; 109 u_char ifm_version; 110 u_char ifm_type; 111 int ifm_addrs; 112 int ifm_flags; 113 u_short ifm_index; 114 struct if_data8 ifm_data; 115 }; 116 */ 117 import "C" 118 119 // Machine characteristics 120 121 const ( 122 SizeofPtr = C.sizeofPtr 123 SizeofShort = C.sizeof_short 124 SizeofInt = C.sizeof_int 125 SizeofLong = C.sizeof_long 126 SizeofLongLong = C.sizeof_longlong 127 ) 128 129 // Basic types 130 131 type ( 132 _C_short C.short 133 _C_int C.int 134 _C_long C.long 135 _C_long_long C.longlong 136 ) 137 138 // Time 139 140 type Timespec C.struct_timespec 141 142 type Timeval C.struct_timeval 143 144 // Processes 145 146 type Rusage C.struct_rusage 147 148 type Rlimit C.struct_rlimit 149 150 type _Gid_t C.gid_t 151 152 // Files 153 154 const ( 155 _statfsVersion = C.STATFS_VERSION 156 _dirblksiz = C.DIRBLKSIZ 157 ) 158 159 type Stat_t C.struct_stat 160 161 type stat_freebsd11_t C.struct_freebsd11_stat 162 163 type Statfs_t C.struct_statfs 164 165 type statfs_freebsd11_t C.struct_freebsd11_statfs 166 167 type Flock_t C.struct_flock 168 169 type Dirent C.struct_dirent 170 171 type dirent_freebsd11 C.struct_freebsd11_dirent 172 173 type Fsid C.struct_fsid 174 175 // File system limits 176 177 const ( 178 PathMax = C.PATH_MAX 179 ) 180 181 // Advice to Fadvise 182 183 const ( 184 FADV_NORMAL = C.POSIX_FADV_NORMAL 185 FADV_RANDOM = C.POSIX_FADV_RANDOM 186 FADV_SEQUENTIAL = C.POSIX_FADV_SEQUENTIAL 187 FADV_WILLNEED = C.POSIX_FADV_WILLNEED 188 FADV_DONTNEED = C.POSIX_FADV_DONTNEED 189 FADV_NOREUSE = C.POSIX_FADV_NOREUSE 190 ) 191 192 // Sockets 193 194 type RawSockaddrInet4 C.struct_sockaddr_in 195 196 type RawSockaddrInet6 C.struct_sockaddr_in6 197 198 type RawSockaddrUnix C.struct_sockaddr_un 199 200 type RawSockaddrDatalink C.struct_sockaddr_dl 201 202 type RawSockaddr C.struct_sockaddr 203 204 type RawSockaddrAny C.struct_sockaddr_any 205 206 type _Socklen C.socklen_t 207 208 type Xucred C.struct_xucred 209 210 type Linger C.struct_linger 211 212 type Iovec C.struct_iovec 213 214 type IPMreq C.struct_ip_mreq 215 216 type IPMreqn C.struct_ip_mreqn 217 218 type IPv6Mreq C.struct_ipv6_mreq 219 220 type Msghdr C.struct_msghdr 221 222 type Cmsghdr C.struct_cmsghdr 223 224 type Inet6Pktinfo C.struct_in6_pktinfo 225 226 type IPv6MTUInfo C.struct_ip6_mtuinfo 227 228 type ICMPv6Filter C.struct_icmp6_filter 229 230 const ( 231 SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in 232 SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 233 SizeofSockaddrAny = C.sizeof_struct_sockaddr_any 234 SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un 235 SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl 236 SizeofXucred = C.sizeof_struct_xucred 237 SizeofLinger = C.sizeof_struct_linger 238 SizeofIovec = C.sizeof_struct_iovec 239 SizeofIPMreq = C.sizeof_struct_ip_mreq 240 SizeofIPMreqn = C.sizeof_struct_ip_mreqn 241 SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq 242 SizeofMsghdr = C.sizeof_struct_msghdr 243 SizeofCmsghdr = C.sizeof_struct_cmsghdr 244 SizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo 245 SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo 246 SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter 247 ) 248 249 // Ptrace requests 250 251 const ( 252 PTRACE_ATTACH = C.PT_ATTACH 253 PTRACE_CONT = C.PT_CONTINUE 254 PTRACE_DETACH = C.PT_DETACH 255 PTRACE_GETFPREGS = C.PT_GETFPREGS 256 PTRACE_GETFSBASE = C.PT_GETFSBASE 257 PTRACE_GETLWPLIST = C.PT_GETLWPLIST 258 PTRACE_GETNUMLWPS = C.PT_GETNUMLWPS 259 PTRACE_GETREGS = C.PT_GETREGS 260 PTRACE_GETXSTATE = C.PT_GETXSTATE 261 PTRACE_IO = C.PT_IO 262 PTRACE_KILL = C.PT_KILL 263 PTRACE_LWPEVENTS = C.PT_LWP_EVENTS 264 PTRACE_LWPINFO = C.PT_LWPINFO 265 PTRACE_SETFPREGS = C.PT_SETFPREGS 266 PTRACE_SETREGS = C.PT_SETREGS 267 PTRACE_SINGLESTEP = C.PT_STEP 268 PTRACE_TRACEME = C.PT_TRACE_ME 269 ) 270 271 const ( 272 PIOD_READ_D = C.PIOD_READ_D 273 PIOD_WRITE_D = C.PIOD_WRITE_D 274 PIOD_READ_I = C.PIOD_READ_I 275 PIOD_WRITE_I = C.PIOD_WRITE_I 276 ) 277 278 const ( 279 PL_FLAG_BORN = C.PL_FLAG_BORN 280 PL_FLAG_EXITED = C.PL_FLAG_EXITED 281 PL_FLAG_SI = C.PL_FLAG_SI 282 ) 283 284 const ( 285 TRAP_BRKPT = C.TRAP_BRKPT 286 TRAP_TRACE = C.TRAP_TRACE 287 ) 288 289 type PtraceLwpInfoStruct C.struct_ptrace_lwpinfo 290 291 type __Siginfo C.struct___siginfo 292 293 type Sigset_t C.sigset_t 294 295 type Reg C.struct_reg 296 297 type FpReg C.struct_fpreg 298 299 type PtraceIoDesc C.struct_ptrace_io_desc 300 301 // Events (kqueue, kevent) 302 303 type Kevent_t C.struct_kevent_freebsd11 304 305 // Select 306 307 type FdSet C.fd_set 308 309 // Routing and interface messages 310 311 const ( 312 sizeofIfMsghdr = C.sizeof_struct_if_msghdr 313 SizeofIfMsghdr = C.sizeof_struct_if_msghdr8 314 sizeofIfData = C.sizeof_struct_if_data 315 SizeofIfData = C.sizeof_struct_if_data8 316 SizeofIfaMsghdr = C.sizeof_struct_ifa_msghdr 317 SizeofIfmaMsghdr = C.sizeof_struct_ifma_msghdr 318 SizeofIfAnnounceMsghdr = C.sizeof_struct_if_announcemsghdr 319 SizeofRtMsghdr = C.sizeof_struct_rt_msghdr 320 SizeofRtMetrics = C.sizeof_struct_rt_metrics 321 ) 322 323 type ifMsghdr C.struct_if_msghdr 324 325 type IfMsghdr C.struct_if_msghdr8 326 327 type ifData C.struct_if_data 328 329 type IfData C.struct_if_data8 330 331 type IfaMsghdr C.struct_ifa_msghdr 332 333 type IfmaMsghdr C.struct_ifma_msghdr 334 335 type IfAnnounceMsghdr C.struct_if_announcemsghdr 336 337 type RtMsghdr C.struct_rt_msghdr 338 339 type RtMetrics C.struct_rt_metrics 340 341 // Berkeley packet filter 342 343 const ( 344 SizeofBpfVersion = C.sizeof_struct_bpf_version 345 SizeofBpfStat = C.sizeof_struct_bpf_stat 346 SizeofBpfZbuf = C.sizeof_struct_bpf_zbuf 347 SizeofBpfProgram = C.sizeof_struct_bpf_program 348 SizeofBpfInsn = C.sizeof_struct_bpf_insn 349 SizeofBpfHdr = C.sizeof_struct_bpf_hdr 350 SizeofBpfZbufHeader = C.sizeof_struct_bpf_zbuf_header 351 ) 352 353 type BpfVersion C.struct_bpf_version 354 355 type BpfStat C.struct_bpf_stat 356 357 type BpfZbuf C.struct_bpf_zbuf 358 359 type BpfProgram C.struct_bpf_program 360 361 type BpfInsn C.struct_bpf_insn 362 363 type BpfHdr C.struct_bpf_hdr 364 365 type BpfZbufHeader C.struct_bpf_zbuf_header 366 367 // Terminal handling 368 369 type Termios C.struct_termios 370 371 type Winsize C.struct_winsize 372 373 // fchmodat-like syscalls. 374 375 const ( 376 AT_FDCWD = C.AT_FDCWD 377 AT_REMOVEDIR = C.AT_REMOVEDIR 378 AT_SYMLINK_FOLLOW = C.AT_SYMLINK_FOLLOW 379 AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW 380 ) 381 382 // poll 383 384 type PollFd C.struct_pollfd 385 386 const ( 387 POLLERR = C.POLLERR 388 POLLHUP = C.POLLHUP 389 POLLIN = C.POLLIN 390 POLLINIGNEOF = C.POLLINIGNEOF 391 POLLNVAL = C.POLLNVAL 392 POLLOUT = C.POLLOUT 393 POLLPRI = C.POLLPRI 394 POLLRDBAND = C.POLLRDBAND 395 POLLRDNORM = C.POLLRDNORM 396 POLLWRBAND = C.POLLWRBAND 397 POLLWRNORM = C.POLLWRNORM 398 ) 399 400 // Capabilities 401 402 type CapRights C.struct_cap_rights 403 404 // Uname 405 406 type Utsname C.struct_utsname 407 408 // Clockinfo 409 410 const SizeofClockinfo = C.sizeof_struct_clockinfo 411 412 type Clockinfo C.struct_clockinfo