github.com/golang-haiku/go-1.4.3@v0.0.0-20190609233734-1f5ae41cc308/src/syscall/types_haiku.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 KERNEL
    18  #include <dirent.h>
    19  #include <fcntl.h>
    20  #include <signal.h>
    21  #include <termios.h>
    22  #include <stdio.h>
    23  #include <unistd.h>
    24  #include <sys/mman.h>
    25  #include <sys/param.h>
    26  #include <sys/resource.h>
    27  #include <sys/select.h>
    28  #include <sys/socket.h>
    29  #include <sys/stat.h>
    30  #include <sys/time.h>
    31  #include <sys/types.h>
    32  #include <sys/un.h>
    33  #include <sys/wait.h>
    34  #include <net/if.h>
    35  #include <net/if_dl.h>
    36  #include <net/route.h>
    37  #include <netinet/in.h>
    38  #include <netinet/icmp6.h>
    39  #include <netinet/tcp.h>
    40  
    41  enum {
    42  	sizeofPtr = sizeof(void*),
    43  };
    44  
    45  union sockaddr_all {
    46  	struct sockaddr s1;	// this one gets used for fields
    47  	struct sockaddr_in s2;	// these pad it out
    48  	struct sockaddr_in6 s3;
    49  	struct sockaddr_un s4;
    50  	struct sockaddr_dl s5;
    51  };
    52  
    53  struct sockaddr_any {
    54  	struct sockaddr addr;
    55  	char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
    56  };
    57  
    58  */
    59  import "C"
    60  
    61  // Machine characteristics; for internal use.
    62  
    63  const (
    64  	sizeofPtr      = C.sizeofPtr
    65  	sizeofShort    = C.sizeof_short
    66  	sizeofInt      = C.sizeof_int
    67  	sizeofLong     = C.sizeof_long
    68  	sizeofLongLong = C.sizeof_longlong
    69  )
    70  
    71  // Basic types
    72  
    73  type (
    74  	_C_short     C.short
    75  	_C_int       C.int
    76  	_C_long      C.long
    77  	_C_long_long C.longlong
    78  )
    79  
    80  // Time
    81  
    82  type Timespec C.struct_timespec
    83  
    84  type Timeval C.struct_timeval
    85  
    86  // Processes
    87  
    88  type Rusage C.struct_rusage
    89  
    90  type Rlimit C.struct_rlimit
    91  
    92  type _Gid_t C.gid_t
    93  
    94  // Files
    95  
    96  type Stat_t C.struct_stat
    97  
    98  type Flock_t C.struct_flock
    99  
   100  // FIXME: haiku: Manual declaration because Dirent needs the padding
   101  type Dirent struct {
   102  	Dev       int32
   103  	Pdev      int32
   104  	Ino       int64
   105  	Pino      int64
   106  	Reclen    uint16
   107  	Name      [1 + 256]int8
   108  	Pad_cgo_0 [1]byte
   109  }
   110  
   111  // Sockets
   112  
   113  type RawSockaddrInet4 C.struct_sockaddr_in
   114  
   115  type RawSockaddrInet6 C.struct_sockaddr_in6
   116  
   117  type RawSockaddrUnix C.struct_sockaddr_un
   118  
   119  type RawSockaddrDatalink C.struct_sockaddr_dl
   120  
   121  type RawSockaddr C.struct_sockaddr
   122  
   123  type RawSockaddrAny C.struct_sockaddr_any
   124  
   125  type _Socklen C.socklen_t
   126  
   127  type Linger C.struct_linger
   128  
   129  type Iovec C.struct_iovec
   130  
   131  type IPMreq C.struct_ip_mreq
   132  
   133  type IPv6Mreq C.struct_ipv6_mreq
   134  
   135  type Msghdr C.struct_msghdr
   136  
   137  type Cmsghdr C.struct_cmsghdr
   138  
   139  type Inet6Pktinfo C.struct_in6_pktinfo
   140  
   141  type ICMPv6Filter C.struct_icmp6_filter
   142  
   143  const (
   144  	SizeofSockaddrInet4    = C.sizeof_struct_sockaddr_in
   145  	SizeofSockaddrInet6    = C.sizeof_struct_sockaddr_in6
   146  	SizeofSockaddrAny      = C.sizeof_struct_sockaddr_any
   147  	SizeofSockaddrUnix     = C.sizeof_struct_sockaddr_un
   148  	SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
   149  	SizeofLinger           = C.sizeof_struct_linger
   150  	SizeofIPMreq           = C.sizeof_struct_ip_mreq
   151  	SizeofIPv6Mreq         = C.sizeof_struct_ipv6_mreq
   152  	SizeofMsghdr           = C.sizeof_struct_msghdr
   153  	SizeofCmsghdr          = C.sizeof_struct_cmsghdr
   154  	SizeofInet6Pktinfo     = C.sizeof_struct_in6_pktinfo
   155  	SizeofICMPv6Filter     = C.sizeof_struct_icmp6_filter
   156  )
   157  
   158  // Select
   159  
   160  type FdSet C.fd_set
   161  
   162  // Terminal handling
   163  
   164  type Termios C.struct_termios