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