Source file src/syscall/types_solaris.go

     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  //go: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  // These defines ensure that builds done on newer versions of Solaris are
    19  // backwards-compatible with older versions of Solaris and
    20  // OpenSolaris-based derivatives.
    21  #define __USE_SUNOS_SOCKETS__          // msghdr
    22  #define __USE_LEGACY_PROTOTYPES__      // iovec
    23  #include <dirent.h>
    24  #include <fcntl.h>
    25  #include <limits.h>
    26  #include <signal.h>
    27  #include <termios.h>
    28  #include <stdio.h>
    29  #include <unistd.h>
    30  #include <sys/mman.h>
    31  #include <sys/mount.h>
    32  #include <sys/param.h>
    33  #include <sys/resource.h>
    34  #include <sys/select.h>
    35  #include <sys/signal.h>
    36  #include <sys/socket.h>
    37  #include <sys/stat.h>
    38  #include <sys/time.h>
    39  #include <sys/types.h>
    40  #include <sys/un.h>
    41  #include <sys/wait.h>
    42  #include <net/bpf.h>
    43  #include <net/if.h>
    44  #include <net/if_dl.h>
    45  #include <net/route.h>
    46  #include <netinet/in.h>
    47  #include <netinet/icmp6.h>
    48  #include <netinet/tcp.h>
    49  
    50  enum {
    51  	sizeofPtr = sizeof(void*),
    52  };
    53  
    54  union sockaddr_all {
    55  	struct sockaddr s1;	// this one gets used for fields
    56  	struct sockaddr_in s2;	// these pad it out
    57  	struct sockaddr_in6 s3;
    58  	struct sockaddr_un s4;
    59  	struct sockaddr_dl s5;
    60  };
    61  
    62  struct sockaddr_any {
    63  	struct sockaddr addr;
    64  	char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
    65  };
    66  
    67  */
    68  import "C"
    69  
    70  // Machine characteristics; for internal use.
    71  
    72  const (
    73  	sizeofPtr      = C.sizeofPtr
    74  	sizeofShort    = C.sizeof_short
    75  	sizeofInt      = C.sizeof_int
    76  	sizeofLong     = C.sizeof_long
    77  	sizeofLongLong = C.sizeof_longlong
    78  	PathMax        = C.PATH_MAX
    79  )
    80  
    81  // Basic types
    82  
    83  type (
    84  	_C_short     C.short
    85  	_C_int       C.int
    86  	_C_long      C.long
    87  	_C_long_long C.longlong
    88  )
    89  
    90  // Time
    91  
    92  type Timespec C.struct_timespec
    93  
    94  type Timeval C.struct_timeval
    95  
    96  type Timeval32 C.struct_timeval32
    97  
    98  // Processes
    99  
   100  type Rusage C.struct_rusage
   101  
   102  type Rlimit C.struct_rlimit
   103  
   104  type _Pid_t C.pid_t
   105  
   106  type _Gid_t C.gid_t
   107  
   108  // Files
   109  
   110  const ( // Directory mode bits
   111  	S_IFMT   = C.S_IFMT
   112  	S_IFIFO  = C.S_IFIFO
   113  	S_IFCHR  = C.S_IFCHR
   114  	S_IFDIR  = C.S_IFDIR
   115  	S_IFBLK  = C.S_IFBLK
   116  	S_IFREG  = C.S_IFREG
   117  	S_IFLNK  = C.S_IFLNK
   118  	S_IFSOCK = C.S_IFSOCK
   119  	S_ISUID  = C.S_ISUID
   120  	S_ISGID  = C.S_ISGID
   121  	S_ISVTX  = C.S_ISVTX
   122  	S_IRUSR  = C.S_IRUSR
   123  	S_IWUSR  = C.S_IWUSR
   124  	S_IXUSR  = C.S_IXUSR
   125  	S_IRWXG  = C.S_IRWXG
   126  	S_IRWXO  = C.S_IRWXO
   127  )
   128  
   129  type Stat_t C.struct_stat
   130  
   131  type Flock_t C.struct_flock
   132  
   133  type Dirent C.struct_dirent
   134  
   135  // Sockets
   136  
   137  type RawSockaddrInet4 C.struct_sockaddr_in
   138  
   139  type RawSockaddrInet6 C.struct_sockaddr_in6
   140  
   141  type RawSockaddrUnix C.struct_sockaddr_un
   142  
   143  type RawSockaddrDatalink C.struct_sockaddr_dl
   144  
   145  type RawSockaddr C.struct_sockaddr
   146  
   147  type RawSockaddrAny C.struct_sockaddr_any
   148  
   149  type _Socklen C.socklen_t
   150  
   151  type Linger C.struct_linger
   152  
   153  type Iovec C.struct_iovec
   154  
   155  type IPMreq C.struct_ip_mreq
   156  
   157  type IPv6Mreq C.struct_ipv6_mreq
   158  
   159  type Msghdr C.struct_msghdr
   160  
   161  type Cmsghdr C.struct_cmsghdr
   162  
   163  type Inet6Pktinfo C.struct_in6_pktinfo
   164  
   165  type IPv6MTUInfo C.struct_ip6_mtuinfo
   166  
   167  type ICMPv6Filter C.struct_icmp6_filter
   168  
   169  const (
   170  	SizeofSockaddrInet4    = C.sizeof_struct_sockaddr_in
   171  	SizeofSockaddrInet6    = C.sizeof_struct_sockaddr_in6
   172  	SizeofSockaddrAny      = C.sizeof_struct_sockaddr_any
   173  	SizeofSockaddrUnix     = C.sizeof_struct_sockaddr_un
   174  	SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
   175  	SizeofLinger           = C.sizeof_struct_linger
   176  	SizeofIPMreq           = C.sizeof_struct_ip_mreq
   177  	SizeofIPv6Mreq         = C.sizeof_struct_ipv6_mreq
   178  	SizeofMsghdr           = C.sizeof_struct_msghdr
   179  	SizeofCmsghdr          = C.sizeof_struct_cmsghdr
   180  	SizeofInet6Pktinfo     = C.sizeof_struct_in6_pktinfo
   181  	SizeofIPv6MTUInfo      = C.sizeof_struct_ip6_mtuinfo
   182  	SizeofICMPv6Filter     = C.sizeof_struct_icmp6_filter
   183  )
   184  
   185  // Select
   186  
   187  type FdSet C.fd_set
   188  
   189  // Routing and interface messages
   190  
   191  const (
   192  	SizeofIfMsghdr  = C.sizeof_struct_if_msghdr
   193  	SizeofIfData    = C.sizeof_struct_if_data
   194  	SizeofIfaMsghdr = C.sizeof_struct_ifa_msghdr
   195  	SizeofRtMsghdr  = C.sizeof_struct_rt_msghdr
   196  	SizeofRtMetrics = C.sizeof_struct_rt_metrics
   197  )
   198  
   199  type IfMsghdr C.struct_if_msghdr
   200  
   201  type IfData C.struct_if_data
   202  
   203  type IfaMsghdr C.struct_ifa_msghdr
   204  
   205  type RtMsghdr C.struct_rt_msghdr
   206  
   207  type RtMetrics C.struct_rt_metrics
   208  
   209  // Berkeley packet filter
   210  
   211  const (
   212  	SizeofBpfVersion = C.sizeof_struct_bpf_version
   213  	SizeofBpfStat    = C.sizeof_struct_bpf_stat
   214  	SizeofBpfProgram = C.sizeof_struct_bpf_program
   215  	SizeofBpfInsn    = C.sizeof_struct_bpf_insn
   216  	SizeofBpfHdr     = C.sizeof_struct_bpf_hdr
   217  )
   218  
   219  type BpfVersion C.struct_bpf_version
   220  
   221  type BpfStat C.struct_bpf_stat
   222  
   223  type BpfProgram C.struct_bpf_program
   224  
   225  type BpfInsn C.struct_bpf_insn
   226  
   227  type BpfTimeval C.struct_bpf_timeval
   228  
   229  type BpfHdr C.struct_bpf_hdr
   230  
   231  // Misc
   232  
   233  const (
   234  	_AT_FDCWD = C.AT_FDCWD
   235  )
   236  
   237  // Terminal handling
   238  
   239  type Termios C.struct_termios
   240  

View as plain text