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/* 8Input to cgo -godefs. See also mkerrors.sh and mkall.sh 9*/ 10 11// +godefs map struct_in_addr [4]byte /* in_addr */ 12// +godefs map struct_in6_addr [16]byte /* in6_addr */ 13 14package unix 15 16/* 17#define __DARWIN_UNIX03 0 18#define KERNEL 19#define _DARWIN_USE_64_BIT_INODE 20#include <dirent.h> 21#include <fcntl.h> 22#include <signal.h> 23#include <termios.h> 24#include <unistd.h> 25#include <mach/mach.h> 26#include <mach/message.h> 27#include <sys/event.h> 28#include <sys/mman.h> 29#include <sys/mount.h> 30#include <sys/param.h> 31#include <sys/ptrace.h> 32#include <sys/resource.h> 33#include <sys/select.h> 34#include <sys/signal.h> 35#include <sys/socket.h> 36#include <sys/stat.h> 37#include <sys/time.h> 38#include <sys/types.h> 39#include <sys/uio.h> 40#include <sys/un.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/if_var.h> 46#include <net/route.h> 47#include <netinet/in.h> 48#include <netinet/icmp6.h> 49#include <netinet/tcp.h> 50 51enum { 52 sizeofPtr = sizeof(void*), 53}; 54 55union sockaddr_all { 56 struct sockaddr s1; // this one gets used for fields 57 struct sockaddr_in s2; // these pad it out 58 struct sockaddr_in6 s3; 59 struct sockaddr_un s4; 60 struct sockaddr_dl s5; 61}; 62 63struct sockaddr_any { 64 struct sockaddr addr; 65 char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)]; 66}; 67 68*/ 69import "C" 70 71// Machine characteristics; for internal use. 72 73const ( 74 sizeofPtr = C.sizeofPtr 75 sizeofShort = C.sizeof_short 76 sizeofInt = C.sizeof_int 77 sizeofLong = C.sizeof_long 78 sizeofLongLong = C.sizeof_longlong 79) 80 81// Basic types 82 83type ( 84 _C_short C.short 85 _C_int C.int 86 _C_long C.long 87 _C_long_long C.longlong 88) 89 90// Time 91 92type Timespec C.struct_timespec 93 94type Timeval C.struct_timeval 95 96type Timeval32 C.struct_timeval32 97 98// Processes 99 100type Rusage C.struct_rusage 101 102type Rlimit C.struct_rlimit 103 104type _Gid_t C.gid_t 105 106// Files 107 108type Stat_t C.struct_stat64 109 110type Statfs_t C.struct_statfs64 111 112type Flock_t C.struct_flock 113 114type Fstore_t C.struct_fstore 115 116type Radvisory_t C.struct_radvisory 117 118type Fbootstraptransfer_t C.struct_fbootstraptransfer 119 120type Log2phys_t C.struct_log2phys 121 122type Fsid C.struct_fsid 123 124type Dirent C.struct_dirent 125 126// Sockets 127 128type RawSockaddrInet4 C.struct_sockaddr_in 129 130type RawSockaddrInet6 C.struct_sockaddr_in6 131 132type RawSockaddrUnix C.struct_sockaddr_un 133 134type RawSockaddrDatalink C.struct_sockaddr_dl 135 136type RawSockaddr C.struct_sockaddr 137 138type RawSockaddrAny C.struct_sockaddr_any 139 140type _Socklen C.socklen_t 141 142type Linger C.struct_linger 143 144type Iovec C.struct_iovec 145 146type IPMreq C.struct_ip_mreq 147 148type IPv6Mreq C.struct_ipv6_mreq 149 150type Msghdr C.struct_msghdr 151 152type Cmsghdr C.struct_cmsghdr 153 154type Inet4Pktinfo C.struct_in_pktinfo 155 156type Inet6Pktinfo C.struct_in6_pktinfo 157 158type IPv6MTUInfo C.struct_ip6_mtuinfo 159 160type ICMPv6Filter C.struct_icmp6_filter 161 162const ( 163 SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in 164 SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 165 SizeofSockaddrAny = C.sizeof_struct_sockaddr_any 166 SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un 167 SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl 168 SizeofLinger = C.sizeof_struct_linger 169 SizeofIPMreq = C.sizeof_struct_ip_mreq 170 SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq 171 SizeofMsghdr = C.sizeof_struct_msghdr 172 SizeofCmsghdr = C.sizeof_struct_cmsghdr 173 SizeofInet4Pktinfo = C.sizeof_struct_in_pktinfo 174 SizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo 175 SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo 176 SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter 177) 178 179// Ptrace requests 180 181const ( 182 PTRACE_TRACEME = C.PT_TRACE_ME 183 PTRACE_CONT = C.PT_CONTINUE 184 PTRACE_KILL = C.PT_KILL 185) 186 187// Events (kqueue, kevent) 188 189type Kevent_t C.struct_kevent 190 191// Select 192 193type FdSet C.fd_set 194 195// Routing and interface messages 196 197const ( 198 SizeofIfMsghdr = C.sizeof_struct_if_msghdr 199 SizeofIfData = C.sizeof_struct_if_data 200 SizeofIfaMsghdr = C.sizeof_struct_ifa_msghdr 201 SizeofIfmaMsghdr = C.sizeof_struct_ifma_msghdr 202 SizeofIfmaMsghdr2 = C.sizeof_struct_ifma_msghdr2 203 SizeofRtMsghdr = C.sizeof_struct_rt_msghdr 204 SizeofRtMetrics = C.sizeof_struct_rt_metrics 205) 206 207type IfMsghdr C.struct_if_msghdr 208 209type IfData C.struct_if_data 210 211type IfaMsghdr C.struct_ifa_msghdr 212 213type IfmaMsghdr C.struct_ifma_msghdr 214 215type IfmaMsghdr2 C.struct_ifma_msghdr2 216 217type RtMsghdr C.struct_rt_msghdr 218 219type RtMetrics C.struct_rt_metrics 220 221// Berkeley packet filter 222 223const ( 224 SizeofBpfVersion = C.sizeof_struct_bpf_version 225 SizeofBpfStat = C.sizeof_struct_bpf_stat 226 SizeofBpfProgram = C.sizeof_struct_bpf_program 227 SizeofBpfInsn = C.sizeof_struct_bpf_insn 228 SizeofBpfHdr = C.sizeof_struct_bpf_hdr 229) 230 231type BpfVersion C.struct_bpf_version 232 233type BpfStat C.struct_bpf_stat 234 235type BpfProgram C.struct_bpf_program 236 237type BpfInsn C.struct_bpf_insn 238 239type BpfHdr C.struct_bpf_hdr 240 241// Terminal handling 242 243type Termios C.struct_termios 244 245// fchmodat-like syscalls. 246 247const ( 248 AT_FDCWD = C.AT_FDCWD 249 AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW 250) 251