github.com/fanux/shipyard@v0.0.0-20161009071005-6515ce223235/Godeps/_workspace/src/golang.org/x/sys/unix/types_linux.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 unix 15 16 /* 17 #define _LARGEFILE_SOURCE 18 #define _LARGEFILE64_SOURCE 19 #define _FILE_OFFSET_BITS 64 20 #define _GNU_SOURCE 21 22 #include <dirent.h> 23 #include <fcntl.h> 24 #include <netinet/in.h> 25 #include <netinet/tcp.h> 26 #include <netpacket/packet.h> 27 #include <signal.h> 28 #include <stdio.h> 29 #include <sys/epoll.h> 30 #include <sys/inotify.h> 31 #include <sys/mman.h> 32 #include <sys/mount.h> 33 #include <sys/param.h> 34 #include <sys/ptrace.h> 35 #include <sys/resource.h> 36 #include <sys/select.h> 37 #include <sys/signal.h> 38 #include <sys/stat.h> 39 #include <sys/statfs.h> 40 #include <sys/sysinfo.h> 41 #include <sys/time.h> 42 #include <sys/times.h> 43 #include <sys/timex.h> 44 #include <sys/types.h> 45 #include <sys/un.h> 46 #include <sys/user.h> 47 #include <sys/utsname.h> 48 #include <sys/wait.h> 49 #include <linux/filter.h> 50 #include <linux/netlink.h> 51 #include <linux/rtnetlink.h> 52 #include <linux/icmpv6.h> 53 #include <asm/termbits.h> 54 #include <time.h> 55 #include <unistd.h> 56 #include <ustat.h> 57 #include <utime.h> 58 #include <bluetooth/bluetooth.h> 59 #include <bluetooth/hci.h> 60 61 #ifdef TCSETS2 62 // On systems that have "struct termios2" use this as type Termios. 63 typedef struct termios2 termios_t; 64 #else 65 typedef struct termios termios_t; 66 #endif 67 68 enum { 69 sizeofPtr = sizeof(void*), 70 }; 71 72 union sockaddr_all { 73 struct sockaddr s1; // this one gets used for fields 74 struct sockaddr_in s2; // these pad it out 75 struct sockaddr_in6 s3; 76 struct sockaddr_un s4; 77 struct sockaddr_ll s5; 78 struct sockaddr_nl s6; 79 }; 80 81 struct sockaddr_any { 82 struct sockaddr addr; 83 char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)]; 84 }; 85 86 // copied from /usr/include/linux/un.h 87 struct my_sockaddr_un { 88 sa_family_t sun_family; 89 #if defined(__ARM_EABI__) || defined(__powerpc64__) 90 // on ARM char is by default unsigned 91 signed char sun_path[108]; 92 #else 93 char sun_path[108]; 94 #endif 95 }; 96 97 #ifdef __ARM_EABI__ 98 typedef struct user_regs PtraceRegs; 99 #elif defined(__aarch64__) 100 typedef struct user_pt_regs PtraceRegs; 101 #elif defined(__powerpc64__) 102 typedef struct pt_regs PtraceRegs; 103 #elif defined(__mips__) 104 typedef struct user PtraceRegs; 105 #else 106 typedef struct user_regs_struct PtraceRegs; 107 #endif 108 109 // The real epoll_event is a union, and godefs doesn't handle it well. 110 struct my_epoll_event { 111 uint32_t events; 112 #if defined(__ARM_EABI__) || defined(__aarch64__) 113 // padding is not specified in linux/eventpoll.h but added to conform to the 114 // alignment requirements of EABI 115 int32_t padFd; 116 #endif 117 int32_t fd; 118 int32_t pad; 119 }; 120 121 */ 122 import "C" 123 124 // Machine characteristics; for internal use. 125 126 const ( 127 sizeofPtr = C.sizeofPtr 128 sizeofShort = C.sizeof_short 129 sizeofInt = C.sizeof_int 130 sizeofLong = C.sizeof_long 131 sizeofLongLong = C.sizeof_longlong 132 PathMax = C.PATH_MAX 133 ) 134 135 // Basic types 136 137 type ( 138 _C_short C.short 139 _C_int C.int 140 _C_long C.long 141 _C_long_long C.longlong 142 ) 143 144 // Time 145 146 type Timespec C.struct_timespec 147 148 type Timeval C.struct_timeval 149 150 type Timex C.struct_timex 151 152 type Time_t C.time_t 153 154 type Tms C.struct_tms 155 156 type Utimbuf C.struct_utimbuf 157 158 // Processes 159 160 type Rusage C.struct_rusage 161 162 type Rlimit C.struct_rlimit 163 164 type _Gid_t C.gid_t 165 166 // Files 167 168 type Stat_t C.struct_stat 169 170 type Statfs_t C.struct_statfs 171 172 type Dirent C.struct_dirent 173 174 type Fsid C.fsid_t 175 176 type Flock_t C.struct_flock 177 178 // Advice to Fadvise 179 180 const ( 181 FADV_NORMAL = C.POSIX_FADV_NORMAL 182 FADV_RANDOM = C.POSIX_FADV_RANDOM 183 FADV_SEQUENTIAL = C.POSIX_FADV_SEQUENTIAL 184 FADV_WILLNEED = C.POSIX_FADV_WILLNEED 185 FADV_DONTNEED = C.POSIX_FADV_DONTNEED 186 FADV_NOREUSE = C.POSIX_FADV_NOREUSE 187 ) 188 189 // Sockets 190 191 type RawSockaddrInet4 C.struct_sockaddr_in 192 193 type RawSockaddrInet6 C.struct_sockaddr_in6 194 195 type RawSockaddrUnix C.struct_my_sockaddr_un 196 197 type RawSockaddrLinklayer C.struct_sockaddr_ll 198 199 type RawSockaddrNetlink C.struct_sockaddr_nl 200 201 type RawSockaddrHCI C.struct_sockaddr_hci 202 203 type RawSockaddr C.struct_sockaddr 204 205 type RawSockaddrAny C.struct_sockaddr_any 206 207 type _Socklen C.socklen_t 208 209 type Linger C.struct_linger 210 211 type Iovec C.struct_iovec 212 213 type IPMreq C.struct_ip_mreq 214 215 type IPMreqn C.struct_ip_mreqn 216 217 type IPv6Mreq C.struct_ipv6_mreq 218 219 type Msghdr C.struct_msghdr 220 221 type Cmsghdr C.struct_cmsghdr 222 223 type Inet4Pktinfo C.struct_in_pktinfo 224 225 type Inet6Pktinfo C.struct_in6_pktinfo 226 227 type IPv6MTUInfo C.struct_ip6_mtuinfo 228 229 type ICMPv6Filter C.struct_icmp6_filter 230 231 type Ucred C.struct_ucred 232 233 type TCPInfo C.struct_tcp_info 234 235 const ( 236 SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in 237 SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 238 SizeofSockaddrAny = C.sizeof_struct_sockaddr_any 239 SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un 240 SizeofSockaddrLinklayer = C.sizeof_struct_sockaddr_ll 241 SizeofSockaddrNetlink = C.sizeof_struct_sockaddr_nl 242 SizeofSockaddrHCI = C.sizeof_struct_sockaddr_hci 243 SizeofLinger = C.sizeof_struct_linger 244 SizeofIPMreq = C.sizeof_struct_ip_mreq 245 SizeofIPMreqn = C.sizeof_struct_ip_mreqn 246 SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq 247 SizeofMsghdr = C.sizeof_struct_msghdr 248 SizeofCmsghdr = C.sizeof_struct_cmsghdr 249 SizeofInet4Pktinfo = C.sizeof_struct_in_pktinfo 250 SizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo 251 SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo 252 SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter 253 SizeofUcred = C.sizeof_struct_ucred 254 SizeofTCPInfo = C.sizeof_struct_tcp_info 255 ) 256 257 // Netlink routing and interface messages 258 259 const ( 260 IFA_UNSPEC = C.IFA_UNSPEC 261 IFA_ADDRESS = C.IFA_ADDRESS 262 IFA_LOCAL = C.IFA_LOCAL 263 IFA_LABEL = C.IFA_LABEL 264 IFA_BROADCAST = C.IFA_BROADCAST 265 IFA_ANYCAST = C.IFA_ANYCAST 266 IFA_CACHEINFO = C.IFA_CACHEINFO 267 IFA_MULTICAST = C.IFA_MULTICAST 268 IFLA_UNSPEC = C.IFLA_UNSPEC 269 IFLA_ADDRESS = C.IFLA_ADDRESS 270 IFLA_BROADCAST = C.IFLA_BROADCAST 271 IFLA_IFNAME = C.IFLA_IFNAME 272 IFLA_MTU = C.IFLA_MTU 273 IFLA_LINK = C.IFLA_LINK 274 IFLA_QDISC = C.IFLA_QDISC 275 IFLA_STATS = C.IFLA_STATS 276 IFLA_COST = C.IFLA_COST 277 IFLA_PRIORITY = C.IFLA_PRIORITY 278 IFLA_MASTER = C.IFLA_MASTER 279 IFLA_WIRELESS = C.IFLA_WIRELESS 280 IFLA_PROTINFO = C.IFLA_PROTINFO 281 IFLA_TXQLEN = C.IFLA_TXQLEN 282 IFLA_MAP = C.IFLA_MAP 283 IFLA_WEIGHT = C.IFLA_WEIGHT 284 IFLA_OPERSTATE = C.IFLA_OPERSTATE 285 IFLA_LINKMODE = C.IFLA_LINKMODE 286 IFLA_LINKINFO = C.IFLA_LINKINFO 287 IFLA_NET_NS_PID = C.IFLA_NET_NS_PID 288 IFLA_IFALIAS = C.IFLA_IFALIAS 289 IFLA_MAX = C.IFLA_MAX 290 RT_SCOPE_UNIVERSE = C.RT_SCOPE_UNIVERSE 291 RT_SCOPE_SITE = C.RT_SCOPE_SITE 292 RT_SCOPE_LINK = C.RT_SCOPE_LINK 293 RT_SCOPE_HOST = C.RT_SCOPE_HOST 294 RT_SCOPE_NOWHERE = C.RT_SCOPE_NOWHERE 295 RT_TABLE_UNSPEC = C.RT_TABLE_UNSPEC 296 RT_TABLE_COMPAT = C.RT_TABLE_COMPAT 297 RT_TABLE_DEFAULT = C.RT_TABLE_DEFAULT 298 RT_TABLE_MAIN = C.RT_TABLE_MAIN 299 RT_TABLE_LOCAL = C.RT_TABLE_LOCAL 300 RT_TABLE_MAX = C.RT_TABLE_MAX 301 RTA_UNSPEC = C.RTA_UNSPEC 302 RTA_DST = C.RTA_DST 303 RTA_SRC = C.RTA_SRC 304 RTA_IIF = C.RTA_IIF 305 RTA_OIF = C.RTA_OIF 306 RTA_GATEWAY = C.RTA_GATEWAY 307 RTA_PRIORITY = C.RTA_PRIORITY 308 RTA_PREFSRC = C.RTA_PREFSRC 309 RTA_METRICS = C.RTA_METRICS 310 RTA_MULTIPATH = C.RTA_MULTIPATH 311 RTA_FLOW = C.RTA_FLOW 312 RTA_CACHEINFO = C.RTA_CACHEINFO 313 RTA_TABLE = C.RTA_TABLE 314 RTN_UNSPEC = C.RTN_UNSPEC 315 RTN_UNICAST = C.RTN_UNICAST 316 RTN_LOCAL = C.RTN_LOCAL 317 RTN_BROADCAST = C.RTN_BROADCAST 318 RTN_ANYCAST = C.RTN_ANYCAST 319 RTN_MULTICAST = C.RTN_MULTICAST 320 RTN_BLACKHOLE = C.RTN_BLACKHOLE 321 RTN_UNREACHABLE = C.RTN_UNREACHABLE 322 RTN_PROHIBIT = C.RTN_PROHIBIT 323 RTN_THROW = C.RTN_THROW 324 RTN_NAT = C.RTN_NAT 325 RTN_XRESOLVE = C.RTN_XRESOLVE 326 RTNLGRP_NONE = C.RTNLGRP_NONE 327 RTNLGRP_LINK = C.RTNLGRP_LINK 328 RTNLGRP_NOTIFY = C.RTNLGRP_NOTIFY 329 RTNLGRP_NEIGH = C.RTNLGRP_NEIGH 330 RTNLGRP_TC = C.RTNLGRP_TC 331 RTNLGRP_IPV4_IFADDR = C.RTNLGRP_IPV4_IFADDR 332 RTNLGRP_IPV4_MROUTE = C.RTNLGRP_IPV4_MROUTE 333 RTNLGRP_IPV4_ROUTE = C.RTNLGRP_IPV4_ROUTE 334 RTNLGRP_IPV4_RULE = C.RTNLGRP_IPV4_RULE 335 RTNLGRP_IPV6_IFADDR = C.RTNLGRP_IPV6_IFADDR 336 RTNLGRP_IPV6_MROUTE = C.RTNLGRP_IPV6_MROUTE 337 RTNLGRP_IPV6_ROUTE = C.RTNLGRP_IPV6_ROUTE 338 RTNLGRP_IPV6_IFINFO = C.RTNLGRP_IPV6_IFINFO 339 RTNLGRP_IPV6_PREFIX = C.RTNLGRP_IPV6_PREFIX 340 RTNLGRP_IPV6_RULE = C.RTNLGRP_IPV6_RULE 341 RTNLGRP_ND_USEROPT = C.RTNLGRP_ND_USEROPT 342 SizeofNlMsghdr = C.sizeof_struct_nlmsghdr 343 SizeofNlMsgerr = C.sizeof_struct_nlmsgerr 344 SizeofRtGenmsg = C.sizeof_struct_rtgenmsg 345 SizeofNlAttr = C.sizeof_struct_nlattr 346 SizeofRtAttr = C.sizeof_struct_rtattr 347 SizeofIfInfomsg = C.sizeof_struct_ifinfomsg 348 SizeofIfAddrmsg = C.sizeof_struct_ifaddrmsg 349 SizeofRtMsg = C.sizeof_struct_rtmsg 350 SizeofRtNexthop = C.sizeof_struct_rtnexthop 351 ) 352 353 type NlMsghdr C.struct_nlmsghdr 354 355 type NlMsgerr C.struct_nlmsgerr 356 357 type RtGenmsg C.struct_rtgenmsg 358 359 type NlAttr C.struct_nlattr 360 361 type RtAttr C.struct_rtattr 362 363 type IfInfomsg C.struct_ifinfomsg 364 365 type IfAddrmsg C.struct_ifaddrmsg 366 367 type RtMsg C.struct_rtmsg 368 369 type RtNexthop C.struct_rtnexthop 370 371 // Linux socket filter 372 373 const ( 374 SizeofSockFilter = C.sizeof_struct_sock_filter 375 SizeofSockFprog = C.sizeof_struct_sock_fprog 376 ) 377 378 type SockFilter C.struct_sock_filter 379 380 type SockFprog C.struct_sock_fprog 381 382 // Inotify 383 384 type InotifyEvent C.struct_inotify_event 385 386 const SizeofInotifyEvent = C.sizeof_struct_inotify_event 387 388 // Ptrace 389 390 // Register structures 391 type PtraceRegs C.PtraceRegs 392 393 // Misc 394 395 type FdSet C.fd_set 396 397 type Sysinfo_t C.struct_sysinfo 398 399 type Utsname C.struct_utsname 400 401 type Ustat_t C.struct_ustat 402 403 type EpollEvent C.struct_my_epoll_event 404 405 const ( 406 AT_FDCWD = C.AT_FDCWD 407 AT_REMOVEDIR = C.AT_REMOVEDIR 408 AT_SYMLINK_FOLLOW = C.AT_SYMLINK_FOLLOW 409 AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW 410 ) 411 412 // Terminal handling 413 414 type Termios C.termios_t