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