github.com/Kalvelign/golang-windows-sys-lib@v0.0.0-20221121121202-63da651435e1/unix/types_darwin.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 __DARWIN_UNIX03 0 19 #define KERNEL 1 20 #define _DARWIN_USE_64_BIT_INODE 21 #include <dirent.h> 22 #include <fcntl.h> 23 #include <poll.h> 24 #include <stdint.h> 25 #include <signal.h> 26 #include <termios.h> 27 #include <unistd.h> 28 #include <mach/mach.h> 29 #include <mach/message.h> 30 #include <sys/event.h> 31 #include <sys/ipc.h> 32 #include <sys/kern_control.h> 33 #include <sys/mman.h> 34 #include <sys/mount.h> 35 #include <sys/param.h> 36 #include <sys/ptrace.h> 37 #include <sys/resource.h> 38 #include <sys/select.h> 39 #include <sys/shm.h> 40 #include <sys/signal.h> 41 #include <sys/socket.h> 42 #include <sys/stat.h> 43 #include <sys/sysctl.h> 44 #include <sys/time.h> 45 #include <sys/types.h> 46 #include <sys/ucred.h> 47 #include <sys/uio.h> 48 #include <sys/un.h> 49 #include <sys/utsname.h> 50 #include <sys/wait.h> 51 #include <sys/vsock.h> 52 #include <net/bpf.h> 53 #include <net/if.h> 54 #include <net/if_dl.h> 55 #include <net/if_var.h> 56 #include <net/route.h> 57 #include <netinet/in.h> 58 #include <netinet/icmp6.h> 59 #include <netinet/tcp.h> 60 61 enum { 62 sizeofPtr = sizeof(void*), 63 }; 64 65 union sockaddr_all { 66 struct sockaddr s1; // this one gets used for fields 67 struct sockaddr_in s2; // these pad it out 68 struct sockaddr_in6 s3; 69 struct sockaddr_un s4; 70 struct sockaddr_dl s5; 71 }; 72 73 struct sockaddr_any { 74 struct sockaddr addr; 75 char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)]; 76 }; 77 78 #if defined(__x86_64__) 79 typedef struct stat64 stat_t; 80 typedef struct statfs64 statfs_t; 81 #else // __arm__ 82 typedef struct stat stat_t; 83 typedef struct statfs statfs_t; 84 #endif 85 */ 86 import "C" 87 88 // Machine characteristics 89 90 const ( 91 SizeofPtr = C.sizeofPtr 92 SizeofShort = C.sizeof_short 93 SizeofInt = C.sizeof_int 94 SizeofLong = C.sizeof_long 95 SizeofLongLong = C.sizeof_longlong 96 ) 97 98 // Basic types 99 100 type ( 101 _C_short C.short 102 _C_int C.int 103 _C_long C.long 104 _C_long_long C.longlong 105 ) 106 107 // Time 108 109 type Timespec C.struct_timespec 110 111 type Timeval C.struct_timeval 112 113 type Timeval32 C.struct_timeval32 114 115 // Processes 116 117 type Rusage C.struct_rusage 118 119 type Rlimit C.struct_rlimit 120 121 type _Gid_t C.gid_t 122 123 // Files 124 125 type Stat_t C.stat_t 126 127 type Statfs_t C.statfs_t 128 129 type Flock_t C.struct_flock 130 131 type Fstore_t C.struct_fstore 132 133 type Radvisory_t C.struct_radvisory 134 135 type Fbootstraptransfer_t C.struct_fbootstraptransfer 136 137 type Log2phys_t C.struct_log2phys 138 139 type Fsid C.struct_fsid 140 141 type Dirent C.struct_dirent 142 143 // File system limits 144 145 const ( 146 PathMax = C.PATH_MAX 147 ) 148 149 // Sockets 150 151 type RawSockaddrInet4 C.struct_sockaddr_in 152 153 type RawSockaddrInet6 C.struct_sockaddr_in6 154 155 type RawSockaddrUnix C.struct_sockaddr_un 156 157 type RawSockaddrDatalink C.struct_sockaddr_dl 158 159 type RawSockaddr C.struct_sockaddr 160 161 type RawSockaddrAny C.struct_sockaddr_any 162 163 type RawSockaddrCtl C.struct_sockaddr_ctl 164 165 type RawSockaddrVM C.struct_sockaddr_vm 166 167 type XVSockPCB C.struct_xvsockpcb 168 169 type XSocket C.struct_xsocket 170 171 type XSocket64 C.struct_xsocket64 172 173 type XSockbuf C.struct_xsockbuf 174 175 type XVSockPgen C.struct_xvsockpgen 176 177 type _Socklen C.socklen_t 178 179 type Xucred C.struct_xucred 180 181 type Linger C.struct_linger 182 183 type Iovec C.struct_iovec 184 185 type IPMreq C.struct_ip_mreq 186 187 type IPMreqn C.struct_ip_mreqn 188 189 type IPv6Mreq C.struct_ipv6_mreq 190 191 type Msghdr C.struct_msghdr 192 193 type Cmsghdr C.struct_cmsghdr 194 195 type Inet4Pktinfo C.struct_in_pktinfo 196 197 type Inet6Pktinfo C.struct_in6_pktinfo 198 199 type IPv6MTUInfo C.struct_ip6_mtuinfo 200 201 type ICMPv6Filter C.struct_icmp6_filter 202 203 type TCPConnectionInfo C.struct_tcp_connection_info 204 205 const ( 206 SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in 207 SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 208 SizeofSockaddrAny = C.sizeof_struct_sockaddr_any 209 SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un 210 SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl 211 SizeofSockaddrCtl = C.sizeof_struct_sockaddr_ctl 212 SizeofSockaddrVM = C.sizeof_struct_sockaddr_vm 213 SizeofXvsockpcb = C.sizeof_struct_xvsockpcb 214 SizeofXSocket = C.sizeof_struct_xsocket 215 SizeofXSockbuf = C.sizeof_struct_xsockbuf 216 SizeofXVSockPgen = C.sizeof_struct_xvsockpgen 217 SizeofXucred = C.sizeof_struct_xucred 218 SizeofLinger = C.sizeof_struct_linger 219 SizeofIovec = C.sizeof_struct_iovec 220 SizeofIPMreq = C.sizeof_struct_ip_mreq 221 SizeofIPMreqn = C.sizeof_struct_ip_mreqn 222 SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq 223 SizeofMsghdr = C.sizeof_struct_msghdr 224 SizeofCmsghdr = C.sizeof_struct_cmsghdr 225 SizeofInet4Pktinfo = C.sizeof_struct_in_pktinfo 226 SizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo 227 SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo 228 SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter 229 SizeofTCPConnectionInfo = C.sizeof_struct_tcp_connection_info 230 ) 231 232 // Ptrace requests 233 234 const ( 235 PTRACE_TRACEME = C.PT_TRACE_ME 236 PTRACE_CONT = C.PT_CONTINUE 237 PTRACE_KILL = C.PT_KILL 238 ) 239 240 // Events (kqueue, kevent) 241 242 type Kevent_t C.struct_kevent 243 244 // Select 245 246 type FdSet C.fd_set 247 248 // Routing and interface messages 249 250 const ( 251 SizeofIfMsghdr = C.sizeof_struct_if_msghdr 252 SizeofIfData = C.sizeof_struct_if_data 253 SizeofIfaMsghdr = C.sizeof_struct_ifa_msghdr 254 SizeofIfmaMsghdr = C.sizeof_struct_ifma_msghdr 255 SizeofIfmaMsghdr2 = C.sizeof_struct_ifma_msghdr2 256 SizeofRtMsghdr = C.sizeof_struct_rt_msghdr 257 SizeofRtMetrics = C.sizeof_struct_rt_metrics 258 ) 259 260 type IfMsghdr C.struct_if_msghdr 261 262 type IfData C.struct_if_data 263 264 type IfaMsghdr C.struct_ifa_msghdr 265 266 type IfmaMsghdr C.struct_ifma_msghdr 267 268 type IfmaMsghdr2 C.struct_ifma_msghdr2 269 270 type RtMsghdr C.struct_rt_msghdr 271 272 type RtMetrics C.struct_rt_metrics 273 274 // Berkeley packet filter 275 276 const ( 277 SizeofBpfVersion = C.sizeof_struct_bpf_version 278 SizeofBpfStat = C.sizeof_struct_bpf_stat 279 SizeofBpfProgram = C.sizeof_struct_bpf_program 280 SizeofBpfInsn = C.sizeof_struct_bpf_insn 281 SizeofBpfHdr = C.sizeof_struct_bpf_hdr 282 ) 283 284 type BpfVersion C.struct_bpf_version 285 286 type BpfStat C.struct_bpf_stat 287 288 type BpfProgram C.struct_bpf_program 289 290 type BpfInsn C.struct_bpf_insn 291 292 type BpfHdr C.struct_bpf_hdr 293 294 // Terminal handling 295 296 type Termios C.struct_termios 297 298 type Winsize C.struct_winsize 299 300 // fchmodat-like syscalls. 301 302 const ( 303 AT_FDCWD = C.AT_FDCWD 304 AT_REMOVEDIR = C.AT_REMOVEDIR 305 AT_SYMLINK_FOLLOW = C.AT_SYMLINK_FOLLOW 306 AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW 307 ) 308 309 // poll 310 311 type PollFd C.struct_pollfd 312 313 const ( 314 POLLERR = C.POLLERR 315 POLLHUP = C.POLLHUP 316 POLLIN = C.POLLIN 317 POLLNVAL = C.POLLNVAL 318 POLLOUT = C.POLLOUT 319 POLLPRI = C.POLLPRI 320 POLLRDBAND = C.POLLRDBAND 321 POLLRDNORM = C.POLLRDNORM 322 POLLWRBAND = C.POLLWRBAND 323 POLLWRNORM = C.POLLWRNORM 324 ) 325 326 // uname 327 328 type Utsname C.struct_utsname 329 330 // Clockinfo 331 332 const SizeofClockinfo = C.sizeof_struct_clockinfo 333 334 type Clockinfo C.struct_clockinfo 335 336 // ctl_info 337 338 type CtlInfo C.struct_ctl_info 339 340 // KinfoProc 341 342 const SizeofKinfoProc = C.sizeof_struct_kinfo_proc 343 344 type Eproc C.struct_eproc 345 346 type ExternProc C.struct_extern_proc 347 348 type Itimerval C.struct_itimerval 349 350 type KinfoProc C.struct_kinfo_proc 351 352 type Vmspace C.struct_vmspace 353 354 type Pcred C.struct__pcred 355 356 type Ucred C.struct__ucred 357 358 // shm 359 360 type SysvIpcPerm C.struct_ipc_perm 361 type SysvShmDesc C.struct_shmid_ds 362 363 const ( 364 IPC_CREAT = C.IPC_CREAT 365 IPC_EXCL = C.IPC_EXCL 366 IPC_NOWAIT = C.IPC_NOWAIT 367 IPC_PRIVATE = C.IPC_PRIVATE 368 ) 369 370 const ( 371 IPC_RMID = C.IPC_RMID 372 IPC_SET = C.IPC_SET 373 IPC_STAT = C.IPC_STAT 374 ) 375 376 const ( 377 SHM_RDONLY = C.SHM_RDONLY 378 SHM_RND = C.SHM_RND 379 )