github.com/mfpierre/corectl@v0.5.6/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  #ifdef  __powerpc64__
   118  	int32_t _padFd;
   119  #endif
   120  	int32_t fd;
   121  	int32_t pad;
   122  };
   123  
   124  */
   125  import "C"
   126  
   127  // Machine characteristics; for internal use.
   128  
   129  const (
   130  	sizeofPtr      = C.sizeofPtr
   131  	sizeofShort    = C.sizeof_short
   132  	sizeofInt      = C.sizeof_int
   133  	sizeofLong     = C.sizeof_long
   134  	sizeofLongLong = C.sizeof_longlong
   135  	PathMax        = C.PATH_MAX
   136  )
   137  
   138  // Basic types
   139  
   140  type (
   141  	_C_short     C.short
   142  	_C_int       C.int
   143  	_C_long      C.long
   144  	_C_long_long C.longlong
   145  )
   146  
   147  // Time
   148  
   149  type Timespec C.struct_timespec
   150  
   151  type Timeval C.struct_timeval
   152  
   153  type Timex C.struct_timex
   154  
   155  type Time_t C.time_t
   156  
   157  type Tms C.struct_tms
   158  
   159  type Utimbuf C.struct_utimbuf
   160  
   161  // Processes
   162  
   163  type Rusage C.struct_rusage
   164  
   165  type Rlimit C.struct_rlimit
   166  
   167  type _Gid_t C.gid_t
   168  
   169  // Files
   170  
   171  type Stat_t C.struct_stat
   172  
   173  type Statfs_t C.struct_statfs
   174  
   175  type Dirent C.struct_dirent
   176  
   177  type Fsid C.fsid_t
   178  
   179  type Flock_t C.struct_flock
   180  
   181  // Advice to Fadvise
   182  
   183  const (
   184  	FADV_NORMAL     = C.POSIX_FADV_NORMAL
   185  	FADV_RANDOM     = C.POSIX_FADV_RANDOM
   186  	FADV_SEQUENTIAL = C.POSIX_FADV_SEQUENTIAL
   187  	FADV_WILLNEED   = C.POSIX_FADV_WILLNEED
   188  	FADV_DONTNEED   = C.POSIX_FADV_DONTNEED
   189  	FADV_NOREUSE    = C.POSIX_FADV_NOREUSE
   190  )
   191  
   192  // Sockets
   193  
   194  type RawSockaddrInet4 C.struct_sockaddr_in
   195  
   196  type RawSockaddrInet6 C.struct_sockaddr_in6
   197  
   198  type RawSockaddrUnix C.struct_my_sockaddr_un
   199  
   200  type RawSockaddrLinklayer C.struct_sockaddr_ll
   201  
   202  type RawSockaddrNetlink C.struct_sockaddr_nl
   203  
   204  type RawSockaddrHCI C.struct_sockaddr_hci
   205  
   206  type RawSockaddr C.struct_sockaddr
   207  
   208  type RawSockaddrAny C.struct_sockaddr_any
   209  
   210  type _Socklen C.socklen_t
   211  
   212  type Linger C.struct_linger
   213  
   214  type Iovec C.struct_iovec
   215  
   216  type IPMreq C.struct_ip_mreq
   217  
   218  type IPMreqn C.struct_ip_mreqn
   219  
   220  type IPv6Mreq C.struct_ipv6_mreq
   221  
   222  type Msghdr C.struct_msghdr
   223  
   224  type Cmsghdr C.struct_cmsghdr
   225  
   226  type Inet4Pktinfo C.struct_in_pktinfo
   227  
   228  type Inet6Pktinfo C.struct_in6_pktinfo
   229  
   230  type IPv6MTUInfo C.struct_ip6_mtuinfo
   231  
   232  type ICMPv6Filter C.struct_icmp6_filter
   233  
   234  type Ucred C.struct_ucred
   235  
   236  type TCPInfo C.struct_tcp_info
   237  
   238  const (
   239  	SizeofSockaddrInet4     = C.sizeof_struct_sockaddr_in
   240  	SizeofSockaddrInet6     = C.sizeof_struct_sockaddr_in6
   241  	SizeofSockaddrAny       = C.sizeof_struct_sockaddr_any
   242  	SizeofSockaddrUnix      = C.sizeof_struct_sockaddr_un
   243  	SizeofSockaddrLinklayer = C.sizeof_struct_sockaddr_ll
   244  	SizeofSockaddrNetlink   = C.sizeof_struct_sockaddr_nl
   245  	SizeofSockaddrHCI       = C.sizeof_struct_sockaddr_hci
   246  	SizeofLinger            = C.sizeof_struct_linger
   247  	SizeofIPMreq            = C.sizeof_struct_ip_mreq
   248  	SizeofIPMreqn           = C.sizeof_struct_ip_mreqn
   249  	SizeofIPv6Mreq          = C.sizeof_struct_ipv6_mreq
   250  	SizeofMsghdr            = C.sizeof_struct_msghdr
   251  	SizeofCmsghdr           = C.sizeof_struct_cmsghdr
   252  	SizeofInet4Pktinfo      = C.sizeof_struct_in_pktinfo
   253  	SizeofInet6Pktinfo      = C.sizeof_struct_in6_pktinfo
   254  	SizeofIPv6MTUInfo       = C.sizeof_struct_ip6_mtuinfo
   255  	SizeofICMPv6Filter      = C.sizeof_struct_icmp6_filter
   256  	SizeofUcred             = C.sizeof_struct_ucred
   257  	SizeofTCPInfo           = C.sizeof_struct_tcp_info
   258  )
   259  
   260  // Netlink routing and interface messages
   261  
   262  const (
   263  	IFA_UNSPEC          = C.IFA_UNSPEC
   264  	IFA_ADDRESS         = C.IFA_ADDRESS
   265  	IFA_LOCAL           = C.IFA_LOCAL
   266  	IFA_LABEL           = C.IFA_LABEL
   267  	IFA_BROADCAST       = C.IFA_BROADCAST
   268  	IFA_ANYCAST         = C.IFA_ANYCAST
   269  	IFA_CACHEINFO       = C.IFA_CACHEINFO
   270  	IFA_MULTICAST       = C.IFA_MULTICAST
   271  	IFLA_UNSPEC         = C.IFLA_UNSPEC
   272  	IFLA_ADDRESS        = C.IFLA_ADDRESS
   273  	IFLA_BROADCAST      = C.IFLA_BROADCAST
   274  	IFLA_IFNAME         = C.IFLA_IFNAME
   275  	IFLA_MTU            = C.IFLA_MTU
   276  	IFLA_LINK           = C.IFLA_LINK
   277  	IFLA_QDISC          = C.IFLA_QDISC
   278  	IFLA_STATS          = C.IFLA_STATS
   279  	IFLA_COST           = C.IFLA_COST
   280  	IFLA_PRIORITY       = C.IFLA_PRIORITY
   281  	IFLA_MASTER         = C.IFLA_MASTER
   282  	IFLA_WIRELESS       = C.IFLA_WIRELESS
   283  	IFLA_PROTINFO       = C.IFLA_PROTINFO
   284  	IFLA_TXQLEN         = C.IFLA_TXQLEN
   285  	IFLA_MAP            = C.IFLA_MAP
   286  	IFLA_WEIGHT         = C.IFLA_WEIGHT
   287  	IFLA_OPERSTATE      = C.IFLA_OPERSTATE
   288  	IFLA_LINKMODE       = C.IFLA_LINKMODE
   289  	IFLA_LINKINFO       = C.IFLA_LINKINFO
   290  	IFLA_NET_NS_PID     = C.IFLA_NET_NS_PID
   291  	IFLA_IFALIAS        = C.IFLA_IFALIAS
   292  	IFLA_MAX            = C.IFLA_MAX
   293  	RT_SCOPE_UNIVERSE   = C.RT_SCOPE_UNIVERSE
   294  	RT_SCOPE_SITE       = C.RT_SCOPE_SITE
   295  	RT_SCOPE_LINK       = C.RT_SCOPE_LINK
   296  	RT_SCOPE_HOST       = C.RT_SCOPE_HOST
   297  	RT_SCOPE_NOWHERE    = C.RT_SCOPE_NOWHERE
   298  	RT_TABLE_UNSPEC     = C.RT_TABLE_UNSPEC
   299  	RT_TABLE_COMPAT     = C.RT_TABLE_COMPAT
   300  	RT_TABLE_DEFAULT    = C.RT_TABLE_DEFAULT
   301  	RT_TABLE_MAIN       = C.RT_TABLE_MAIN
   302  	RT_TABLE_LOCAL      = C.RT_TABLE_LOCAL
   303  	RT_TABLE_MAX        = C.RT_TABLE_MAX
   304  	RTA_UNSPEC          = C.RTA_UNSPEC
   305  	RTA_DST             = C.RTA_DST
   306  	RTA_SRC             = C.RTA_SRC
   307  	RTA_IIF             = C.RTA_IIF
   308  	RTA_OIF             = C.RTA_OIF
   309  	RTA_GATEWAY         = C.RTA_GATEWAY
   310  	RTA_PRIORITY        = C.RTA_PRIORITY
   311  	RTA_PREFSRC         = C.RTA_PREFSRC
   312  	RTA_METRICS         = C.RTA_METRICS
   313  	RTA_MULTIPATH       = C.RTA_MULTIPATH
   314  	RTA_FLOW            = C.RTA_FLOW
   315  	RTA_CACHEINFO       = C.RTA_CACHEINFO
   316  	RTA_TABLE           = C.RTA_TABLE
   317  	RTN_UNSPEC          = C.RTN_UNSPEC
   318  	RTN_UNICAST         = C.RTN_UNICAST
   319  	RTN_LOCAL           = C.RTN_LOCAL
   320  	RTN_BROADCAST       = C.RTN_BROADCAST
   321  	RTN_ANYCAST         = C.RTN_ANYCAST
   322  	RTN_MULTICAST       = C.RTN_MULTICAST
   323  	RTN_BLACKHOLE       = C.RTN_BLACKHOLE
   324  	RTN_UNREACHABLE     = C.RTN_UNREACHABLE
   325  	RTN_PROHIBIT        = C.RTN_PROHIBIT
   326  	RTN_THROW           = C.RTN_THROW
   327  	RTN_NAT             = C.RTN_NAT
   328  	RTN_XRESOLVE        = C.RTN_XRESOLVE
   329  	RTNLGRP_NONE        = C.RTNLGRP_NONE
   330  	RTNLGRP_LINK        = C.RTNLGRP_LINK
   331  	RTNLGRP_NOTIFY      = C.RTNLGRP_NOTIFY
   332  	RTNLGRP_NEIGH       = C.RTNLGRP_NEIGH
   333  	RTNLGRP_TC          = C.RTNLGRP_TC
   334  	RTNLGRP_IPV4_IFADDR = C.RTNLGRP_IPV4_IFADDR
   335  	RTNLGRP_IPV4_MROUTE = C.RTNLGRP_IPV4_MROUTE
   336  	RTNLGRP_IPV4_ROUTE  = C.RTNLGRP_IPV4_ROUTE
   337  	RTNLGRP_IPV4_RULE   = C.RTNLGRP_IPV4_RULE
   338  	RTNLGRP_IPV6_IFADDR = C.RTNLGRP_IPV6_IFADDR
   339  	RTNLGRP_IPV6_MROUTE = C.RTNLGRP_IPV6_MROUTE
   340  	RTNLGRP_IPV6_ROUTE  = C.RTNLGRP_IPV6_ROUTE
   341  	RTNLGRP_IPV6_IFINFO = C.RTNLGRP_IPV6_IFINFO
   342  	RTNLGRP_IPV6_PREFIX = C.RTNLGRP_IPV6_PREFIX
   343  	RTNLGRP_IPV6_RULE   = C.RTNLGRP_IPV6_RULE
   344  	RTNLGRP_ND_USEROPT  = C.RTNLGRP_ND_USEROPT
   345  	SizeofNlMsghdr      = C.sizeof_struct_nlmsghdr
   346  	SizeofNlMsgerr      = C.sizeof_struct_nlmsgerr
   347  	SizeofRtGenmsg      = C.sizeof_struct_rtgenmsg
   348  	SizeofNlAttr        = C.sizeof_struct_nlattr
   349  	SizeofRtAttr        = C.sizeof_struct_rtattr
   350  	SizeofIfInfomsg     = C.sizeof_struct_ifinfomsg
   351  	SizeofIfAddrmsg     = C.sizeof_struct_ifaddrmsg
   352  	SizeofRtMsg         = C.sizeof_struct_rtmsg
   353  	SizeofRtNexthop     = C.sizeof_struct_rtnexthop
   354  )
   355  
   356  type NlMsghdr C.struct_nlmsghdr
   357  
   358  type NlMsgerr C.struct_nlmsgerr
   359  
   360  type RtGenmsg C.struct_rtgenmsg
   361  
   362  type NlAttr C.struct_nlattr
   363  
   364  type RtAttr C.struct_rtattr
   365  
   366  type IfInfomsg C.struct_ifinfomsg
   367  
   368  type IfAddrmsg C.struct_ifaddrmsg
   369  
   370  type RtMsg C.struct_rtmsg
   371  
   372  type RtNexthop C.struct_rtnexthop
   373  
   374  // Linux socket filter
   375  
   376  const (
   377  	SizeofSockFilter = C.sizeof_struct_sock_filter
   378  	SizeofSockFprog  = C.sizeof_struct_sock_fprog
   379  )
   380  
   381  type SockFilter C.struct_sock_filter
   382  
   383  type SockFprog C.struct_sock_fprog
   384  
   385  // Inotify
   386  
   387  type InotifyEvent C.struct_inotify_event
   388  
   389  const SizeofInotifyEvent = C.sizeof_struct_inotify_event
   390  
   391  // Ptrace
   392  
   393  // Register structures
   394  type PtraceRegs C.PtraceRegs
   395  
   396  // Misc
   397  
   398  type FdSet C.fd_set
   399  
   400  type Sysinfo_t C.struct_sysinfo
   401  
   402  type Utsname C.struct_utsname
   403  
   404  type Ustat_t C.struct_ustat
   405  
   406  type EpollEvent C.struct_my_epoll_event
   407  
   408  const (
   409  	AT_FDCWD            = C.AT_FDCWD
   410  	AT_REMOVEDIR        = C.AT_REMOVEDIR
   411  	AT_SYMLINK_FOLLOW   = C.AT_SYMLINK_FOLLOW
   412  	AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
   413  )
   414  
   415  // Terminal handling
   416  
   417  type Termios C.termios_t