github.com/akaros/go-akaros@v0.0.0-20181004170632-85005d477eab/src/syscall/types_akaros.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 _LARGEFILE_SOURCE
    18  #define _LARGEFILE64_SOURCE
    19  #define _FILE_OFFSET_BITS 64
    20  #define _GNU_SOURCE
    21  
    22  #include <dirent.h>
    23  #include <unistd.h>
    24  #include <fcntl.h>
    25  #include <termios.h>
    26  #include <net/if.h>
    27  #include <netinet/in.h>
    28  #include <netinet/icmp6.h>
    29  #include <sys/un.h>
    30  #include <sys/mman.h>
    31  #include <sys/stat.h>
    32  #include <sys/types.h>
    33  #include <sys/time.h>
    34  #include <sys/socket.h>
    35  #include <sys/resource.h>
    36  #include <bits/sockaddr.h>
    37  #include <ros/glibc-asm/ioctls.h>
    38  #include <ros/event.h>
    39  #include <ros/syscall.h>
    40  
    41  #define BIT8SZ      1
    42  #define BIT16SZ     2
    43  #define BIT32SZ     4
    44  #define BIT64SZ     8
    45  #define QIDSZ   (BIT8SZ+BIT32SZ+BIT64SZ)
    46  #define STATFIXLEN  (BIT16SZ+QIDSZ+5*BIT16SZ+4*BIT32SZ+1*BIT64SZ)
    47  
    48  enum {
    49  	sizeofPtr = sizeof(void*),
    50  };
    51  
    52  union sockaddr_all {
    53  	struct sockaddr s1;	// this one gets used for fields
    54  	struct sockaddr_in s2;	// these pad it out
    55  	struct sockaddr_in6 s3;
    56  	struct sockaddr_un s4;
    57  };
    58  
    59  struct sockaddr_any {
    60  	struct sockaddr addr;
    61  	char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
    62  };
    63  
    64  struct my_sockaddr_un {
    65  	sa_family_t sun_family;
    66  	char sun_path[108];
    67  };
    68  */
    69  import "C"
    70  
    71  // Machine characteristics; for internal use.
    72  
    73  const (
    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  	PathMax        = C.PATH_MAX
    80  	ErrstrMax      = C.MAX_ERRSTR_LEN
    81  )
    82  
    83  // Basic types
    84  
    85  type (
    86  	_C_short     C.short
    87  	_C_int       C.int
    88  	_C_long      C.long
    89  	_C_long_long C.longlong
    90  )
    91  
    92  type EventMsg C.struct_event_msg
    93  
    94  // Time
    95  
    96  type Timespec C.struct_timespec
    97  
    98  type Timeval C.struct_timeval
    99  
   100  type Time_t C.time_t
   101  
   102  type Tms C.struct_tms
   103  
   104  type Utimbuf C.struct_utimbuf
   105  
   106  // Processes
   107  
   108  type Rusage C.struct_rusage
   109  
   110  type Rlimit C.struct_rlimit
   111  
   112  type _Gid_t C.gid_t
   113  
   114  // Files
   115  
   116  type Stat_t C.struct_stat
   117  
   118  type Statfs_t C.struct_statfs
   119  
   120  type Dirent C.struct_dirent
   121  
   122  type Fsid C.fsid_t
   123  
   124  const (
   125  	SEEK_SET = C.SEEK_SET
   126  	SEEK_CUR = C.SEEK_CUR
   127  	SEEK_END = C.SEEK_END
   128  )
   129  
   130  // Syscall interface stuff
   131  
   132  type Childfdmap_t C.struct_childfdmap
   133  
   134  // 9p stuff
   135  
   136  const (
   137  	BIT8SZ     = C.BIT8SZ
   138  	BIT16SZ    = C.BIT16SZ
   139  	BIT32SZ    = C.BIT32SZ
   140  	BIT64SZ    = C.BIT64SZ
   141  	QIDSZ      = C.QIDSZ
   142  	STATFIXLEN = C.STATFIXLEN
   143  )
   144  
   145  const (
   146  	WSTAT_MODE   = C.WSTAT_MODE
   147  	WSTAT_ATIME  = C.WSTAT_ATIME
   148  	WSTAT_MTIME  = C.WSTAT_MTIME
   149  	WSTAT_LENGTH = C.WSTAT_LENGTH
   150  	WSTAT_NAME   = C.WSTAT_NAME
   151  	WSTAT_UID    = C.WSTAT_UID
   152  	WSTAT_GID    = C.WSTAT_GID
   153  	WSTAT_MUID   = C.WSTAT_MUID
   154  )
   155  
   156  // Sockets
   157  
   158  type RawSockaddrInet4 C.struct_sockaddr_in
   159  
   160  type RawSockaddrInet6 C.struct_sockaddr_in6
   161  
   162  type RawSockaddrUnix C.struct_my_sockaddr_un
   163  
   164  type RawSockaddr C.struct_sockaddr
   165  
   166  type RawSockaddrAny C.struct_sockaddr_any
   167  
   168  type _Socklen C.socklen_t
   169  
   170  type Linger C.struct_linger
   171  
   172  type Iovec C.struct_iovec
   173  
   174  type IPMreq C.struct_ip_mreq
   175  
   176  type IPv6Mreq C.struct_ipv6_mreq
   177  
   178  type Msghdr C.struct_msghdr
   179  
   180  type Cmsghdr C.struct_cmsghdr
   181  
   182  type Inet6Pktinfo C.struct_in6_pktinfo
   183  
   184  type IPv6MTUInfo C.struct_ip6_mtuinfo
   185  
   186  type ICMPv6Filter C.struct_icmp6_filter
   187  
   188  type Ucred C.struct_ucred
   189  
   190  const (
   191  	SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in
   192  	SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6
   193  	SizeofSockaddrUnix  = C.sizeof_struct_my_sockaddr_un
   194  	SizeofSockaddrAny   = C.sizeof_struct_sockaddr_any
   195  	SizeofLinger        = C.sizeof_struct_linger
   196  	SizeofIPMreq        = C.sizeof_struct_ip_mreq
   197  	SizeofIPv6Mreq      = C.sizeof_struct_ipv6_mreq
   198  	SizeofMsghdr        = C.sizeof_struct_msghdr
   199  	SizeofCmsghdr       = C.sizeof_struct_cmsghdr
   200  	SizeofInet6Pktinfo  = C.sizeof_struct_in6_pktinfo
   201  	SizeofIPv6MTUInfo   = C.sizeof_struct_ip6_mtuinfo
   202  	SizeofICMPv6Filter  = C.sizeof_struct_icmp6_filter
   203  	SizeofUcred         = C.sizeof_struct_ucred
   204  )
   205  
   206  // Misc
   207  
   208  type FdSet C.fd_set
   209  
   210  type Sysinfo_t C.struct_sysinfo
   211  
   212  type Utsname C.struct_utsname
   213  
   214  type Ustat_t C.struct_ustat
   215  
   216  const (
   217  	_AT_FDCWD = C.AT_FDCWD
   218  )
   219  
   220  // Terminal handling
   221  
   222  type Termios C.struct_termios
   223  
   224  const (
   225  	VINTR    = C.VINTR
   226  	VQUIT    = C.VQUIT
   227  	VERASE   = C.VERASE
   228  	VKILL    = C.VKILL
   229  	VEOF     = C.VEOF
   230  	VTIME    = C.VTIME
   231  	VMIN     = C.VMIN
   232  	VSWTC    = C.VSWTC
   233  	VSTART   = C.VSTART
   234  	VSTOP    = C.VSTOP
   235  	VSUSP    = C.VSUSP
   236  	VEOL     = C.VEOL
   237  	VREPRINT = C.VREPRINT
   238  	VDISCARD = C.VDISCARD
   239  	VWERASE  = C.VWERASE
   240  	VLNEXT   = C.VLNEXT
   241  	VEOL2    = C.VEOL2
   242  	IGNBRK   = C.IGNBRK
   243  	BRKINT   = C.BRKINT
   244  	IGNPAR   = C.IGNPAR
   245  	PARMRK   = C.PARMRK
   246  	INPCK    = C.INPCK
   247  	ISTRIP   = C.ISTRIP
   248  	INLCR    = C.INLCR
   249  	IGNCR    = C.IGNCR
   250  	ICRNL    = C.ICRNL
   251  	IUCLC    = C.IUCLC
   252  	IXON     = C.IXON
   253  	IXANY    = C.IXANY
   254  	IXOFF    = C.IXOFF
   255  	IMAXBEL  = C.IMAXBEL
   256  	IUTF8    = C.IUTF8
   257  	OPOST    = C.OPOST
   258  	OLCUC    = C.OLCUC
   259  	ONLCR    = C.ONLCR
   260  	OCRNL    = C.OCRNL
   261  	ONOCR    = C.ONOCR
   262  	ONLRET   = C.ONLRET
   263  	OFILL    = C.OFILL
   264  	OFDEL    = C.OFDEL
   265  	B0       = C.B0
   266  	B50      = C.B50
   267  	B75      = C.B75
   268  	B110     = C.B110
   269  	B134     = C.B134
   270  	B150     = C.B150
   271  	B200     = C.B200
   272  	B300     = C.B300
   273  	B600     = C.B600
   274  	B1200    = C.B1200
   275  	B1800    = C.B1800
   276  	B2400    = C.B2400
   277  	B4800    = C.B4800
   278  	B9600    = C.B9600
   279  	B19200   = C.B19200
   280  	B38400   = C.B38400
   281  	CSIZE    = C.CSIZE
   282  	CS5      = C.CS5
   283  	CS6      = C.CS6
   284  	CS7      = C.CS7
   285  	CS8      = C.CS8
   286  	CSTOPB   = C.CSTOPB
   287  	CREAD    = C.CREAD
   288  	PARENB   = C.PARENB
   289  	PARODD   = C.PARODD
   290  	HUPCL    = C.HUPCL
   291  	CLOCAL   = C.CLOCAL
   292  	B57600   = C.B57600
   293  	B115200  = C.B115200
   294  	B230400  = C.B230400
   295  	B460800  = C.B460800
   296  	B500000  = C.B500000
   297  	B576000  = C.B576000
   298  	B921600  = C.B921600
   299  	B1000000 = C.B1000000
   300  	B1152000 = C.B1152000
   301  	B1500000 = C.B1500000
   302  	B2000000 = C.B2000000
   303  	B2500000 = C.B2500000
   304  	B3000000 = C.B3000000
   305  	B3500000 = C.B3500000
   306  	B4000000 = C.B4000000
   307  	ISIG     = C.ISIG
   308  	ICANON   = C.ICANON
   309  	XCASE    = C.XCASE
   310  	ECHO     = C.ECHO
   311  	ECHOE    = C.ECHOE
   312  	ECHOK    = C.ECHOK
   313  	ECHONL   = C.ECHONL
   314  	NOFLSH   = C.NOFLSH
   315  	TOSTOP   = C.TOSTOP
   316  	ECHOCTL  = C.ECHOCTL
   317  	ECHOPRT  = C.ECHOPRT
   318  	ECHOKE   = C.ECHOKE
   319  	FLUSHO   = C.FLUSHO
   320  	PENDIN   = C.PENDIN
   321  	IEXTEN   = C.IEXTEN
   322  	TCGETS   = C.TCGETS
   323  	TCSETS   = C.TCSETS
   324  )