github.com/Andyfoo/golang/x/sys@v0.0.0-20190901054642-57c1bf301704/unix/types_aix.go (about)

     1  // Copyright 2018 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  // +build aix
     7  
     8  /*
     9  Input to cgo -godefs.  See also mkerrors.sh and mkall.sh
    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  #include <sys/types.h>
    19  #include <sys/time.h>
    20  #include <sys/limits.h>
    21  #include <sys/un.h>
    22  #include <utime.h>
    23  #include <sys/utsname.h>
    24  #include <sys/poll.h>
    25  #include <sys/resource.h>
    26  #include <sys/stat.h>
    27  #include <sys/statfs.h>
    28  #include <sys/termio.h>
    29  #include <sys/ioctl.h>
    30  
    31  #include <termios.h>
    32  
    33  #include <net/if.h>
    34  #include <net/if_dl.h>
    35  #include <netinet/in.h>
    36  #include <netinet/icmp6.h>
    37  
    38  
    39  #include <dirent.h>
    40  #include <fcntl.h>
    41  
    42  enum {
    43  	sizeofPtr = sizeof(void*),
    44  };
    45  
    46  union sockaddr_all {
    47  	struct sockaddr s1;     // this one gets used for fields
    48  	struct sockaddr_in s2;  // these pad it out
    49  	struct sockaddr_in6 s3;
    50  	struct sockaddr_un s4;
    51  	struct sockaddr_dl s5;
    52  };
    53  
    54  struct sockaddr_any {
    55  	struct sockaddr addr;
    56  	char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
    57  };
    58  
    59  */
    60  import "C"
    61  
    62  // Machine characteristics
    63  
    64  const (
    65  	SizeofPtr      = C.sizeofPtr
    66  	SizeofShort    = C.sizeof_short
    67  	SizeofInt      = C.sizeof_int
    68  	SizeofLong     = C.sizeof_long
    69  	SizeofLongLong = C.sizeof_longlong
    70  	PathMax        = C.PATH_MAX
    71  )
    72  
    73  // Basic types
    74  
    75  type (
    76  	_C_short     C.short
    77  	_C_int       C.int
    78  	_C_long      C.long
    79  	_C_long_long C.longlong
    80  )
    81  
    82  type off64 C.off64_t
    83  type off C.off_t
    84  type Mode_t C.mode_t
    85  
    86  // Time
    87  
    88  type Timespec C.struct_timespec
    89  
    90  type Timeval C.struct_timeval
    91  
    92  type Timeval32 C.struct_timeval32
    93  
    94  type Timex C.struct_timex
    95  
    96  type Time_t C.time_t
    97  
    98  type Tms C.struct_tms
    99  
   100  type Utimbuf C.struct_utimbuf
   101  
   102  type Timezone C.struct_timezone
   103  
   104  // Processes
   105  
   106  type Rusage C.struct_rusage
   107  
   108  type Rlimit C.struct_rlimit64
   109  
   110  type Pid_t C.pid_t
   111  
   112  type _Gid_t C.gid_t
   113  
   114  type dev_t C.dev_t
   115  
   116  // Files
   117  
   118  type Stat_t C.struct_stat
   119  
   120  type StatxTimestamp C.struct_statx_timestamp
   121  
   122  type Statx_t C.struct_statx
   123  
   124  type Dirent C.struct_dirent
   125  
   126  // Sockets
   127  
   128  type RawSockaddrInet4 C.struct_sockaddr_in
   129  
   130  type RawSockaddrInet6 C.struct_sockaddr_in6
   131  
   132  type RawSockaddrUnix C.struct_sockaddr_un
   133  
   134  type RawSockaddrDatalink C.struct_sockaddr_dl
   135  
   136  type RawSockaddr C.struct_sockaddr
   137  
   138  type RawSockaddrAny C.struct_sockaddr_any
   139  
   140  type _Socklen C.socklen_t
   141  
   142  type Cmsghdr C.struct_cmsghdr
   143  
   144  type ICMPv6Filter C.struct_icmp6_filter
   145  
   146  type Iovec C.struct_iovec
   147  
   148  type IPMreq C.struct_ip_mreq
   149  
   150  type IPv6Mreq C.struct_ipv6_mreq
   151  
   152  type IPv6MTUInfo C.struct_ip6_mtuinfo
   153  
   154  type Linger C.struct_linger
   155  
   156  type Msghdr C.struct_msghdr
   157  
   158  const (
   159  	SizeofSockaddrInet4    = C.sizeof_struct_sockaddr_in
   160  	SizeofSockaddrInet6    = C.sizeof_struct_sockaddr_in6
   161  	SizeofSockaddrAny      = C.sizeof_struct_sockaddr_any
   162  	SizeofSockaddrUnix     = C.sizeof_struct_sockaddr_un
   163  	SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
   164  	SizeofLinger           = C.sizeof_struct_linger
   165  	SizeofIPMreq           = C.sizeof_struct_ip_mreq
   166  	SizeofIPv6Mreq         = C.sizeof_struct_ipv6_mreq
   167  	SizeofIPv6MTUInfo      = C.sizeof_struct_ip6_mtuinfo
   168  	SizeofMsghdr           = C.sizeof_struct_msghdr
   169  	SizeofCmsghdr          = C.sizeof_struct_cmsghdr
   170  	SizeofICMPv6Filter     = C.sizeof_struct_icmp6_filter
   171  )
   172  
   173  // Routing and interface messages
   174  
   175  const (
   176  	SizeofIfMsghdr = C.sizeof_struct_if_msghdr
   177  )
   178  
   179  type IfMsgHdr C.struct_if_msghdr
   180  
   181  // Misc
   182  
   183  type FdSet C.fd_set
   184  
   185  type Utsname C.struct_utsname
   186  
   187  type Ustat_t C.struct_ustat
   188  
   189  type Sigset_t C.sigset_t
   190  
   191  const (
   192  	AT_FDCWD            = C.AT_FDCWD
   193  	AT_REMOVEDIR        = C.AT_REMOVEDIR
   194  	AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
   195  )
   196  
   197  // Terminal handling
   198  
   199  type Termios C.struct_termios
   200  
   201  type Termio C.struct_termio
   202  
   203  type Winsize C.struct_winsize
   204  
   205  //poll
   206  
   207  type PollFd struct {
   208  	Fd      int32
   209  	Events  uint16
   210  	Revents uint16
   211  }
   212  
   213  const (
   214  	POLLERR    = C.POLLERR
   215  	POLLHUP    = C.POLLHUP
   216  	POLLIN     = C.POLLIN
   217  	POLLNVAL   = C.POLLNVAL
   218  	POLLOUT    = C.POLLOUT
   219  	POLLPRI    = C.POLLPRI
   220  	POLLRDBAND = C.POLLRDBAND
   221  	POLLRDNORM = C.POLLRDNORM
   222  	POLLWRBAND = C.POLLWRBAND
   223  	POLLWRNORM = C.POLLWRNORM
   224  )
   225  
   226  //flock_t
   227  
   228  type Flock_t C.struct_flock64
   229  
   230  // Statfs
   231  
   232  type Fsid_t C.struct_fsid_t
   233  type Fsid64_t C.struct_fsid64_t
   234  
   235  type Statfs_t C.struct_statfs
   236  
   237  const RNDGETENTCNT = 0x80045200