Source file src/syscall/types_darwin.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 __DARWIN_UNIX03 0
    18  #define KERNEL
    19  #define _DARWIN_USE_64_BIT_INODE
    20  #include <dirent.h>
    21  #include <fcntl.h>
    22  #include <signal.h>
    23  #include <termios.h>
    24  #include <unistd.h>
    25  #include <mach/mach.h>
    26  #include <mach/message.h>
    27  #include <sys/event.h>
    28  #include <sys/mman.h>
    29  #include <sys/mount.h>
    30  #include <sys/param.h>
    31  #include <sys/ptrace.h>
    32  #include <sys/resource.h>
    33  #include <sys/select.h>
    34  #include <sys/signal.h>
    35  #include <sys/socket.h>
    36  #include <sys/stat.h>
    37  #include <sys/time.h>
    38  #include <sys/types.h>
    39  #include <sys/uio.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/if_var.h>
    46  #include <net/route.h>
    47  #include <netinet/in.h>
    48  #include <netinet/icmp6.h>
    49  #include <netinet/tcp.h>
    50  
    51  enum {
    52  	sizeofPtr = sizeof(void*),
    53  };
    54  
    55  union sockaddr_all {
    56  	struct sockaddr s1;	// this one gets used for fields
    57  	struct sockaddr_in s2;	// these pad it out
    58  	struct sockaddr_in6 s3;
    59  	struct sockaddr_un s4;
    60  	struct sockaddr_dl s5;
    61  };
    62  
    63  struct sockaddr_any {
    64  	struct sockaddr addr;
    65  	char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
    66  };
    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  )
    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 _Gid_t C.gid_t
   105  
   106  // Files
   107  
   108  type Stat_t C.struct_stat64
   109  
   110  type Statfs_t C.struct_statfs64
   111  
   112  type Flock_t C.struct_flock
   113  
   114  type Fstore_t C.struct_fstore
   115  
   116  type Radvisory_t C.struct_radvisory
   117  
   118  type Fbootstraptransfer_t C.struct_fbootstraptransfer
   119  
   120  type Log2phys_t C.struct_log2phys
   121  
   122  type Fsid C.struct_fsid
   123  
   124  type Dirent C.struct_dirent
   125  
   126  // File system limits
   127  
   128  const (
   129  	pathMax = C.PATH_MAX
   130  )
   131  
   132  // Sockets
   133  
   134  type RawSockaddrInet4 C.struct_sockaddr_in
   135  
   136  type RawSockaddrInet6 C.struct_sockaddr_in6
   137  
   138  type RawSockaddrUnix C.struct_sockaddr_un
   139  
   140  type RawSockaddrDatalink C.struct_sockaddr_dl
   141  
   142  type RawSockaddr C.struct_sockaddr
   143  
   144  type RawSockaddrAny C.struct_sockaddr_any
   145  
   146  type _Socklen C.socklen_t
   147  
   148  type Linger C.struct_linger
   149  
   150  type Iovec C.struct_iovec
   151  
   152  type IPMreq C.struct_ip_mreq
   153  
   154  type IPv6Mreq C.struct_ipv6_mreq
   155  
   156  type Msghdr C.struct_msghdr
   157  
   158  type Cmsghdr C.struct_cmsghdr
   159  
   160  type Inet4Pktinfo C.struct_in_pktinfo
   161  
   162  type Inet6Pktinfo C.struct_in6_pktinfo
   163  
   164  type IPv6MTUInfo C.struct_ip6_mtuinfo
   165  
   166  type ICMPv6Filter C.struct_icmp6_filter
   167  
   168  const (
   169  	SizeofSockaddrInet4    = C.sizeof_struct_sockaddr_in
   170  	SizeofSockaddrInet6    = C.sizeof_struct_sockaddr_in6
   171  	SizeofSockaddrAny      = C.sizeof_struct_sockaddr_any
   172  	SizeofSockaddrUnix     = C.sizeof_struct_sockaddr_un
   173  	SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
   174  	SizeofLinger           = C.sizeof_struct_linger
   175  	SizeofIPMreq           = C.sizeof_struct_ip_mreq
   176  	SizeofIPv6Mreq         = C.sizeof_struct_ipv6_mreq
   177  	SizeofMsghdr           = C.sizeof_struct_msghdr
   178  	SizeofCmsghdr          = C.sizeof_struct_cmsghdr
   179  	SizeofInet4Pktinfo     = C.sizeof_struct_in_pktinfo
   180  	SizeofInet6Pktinfo     = C.sizeof_struct_in6_pktinfo
   181  	SizeofIPv6MTUInfo      = C.sizeof_struct_ip6_mtuinfo
   182  	SizeofICMPv6Filter     = C.sizeof_struct_icmp6_filter
   183  )
   184  
   185  // Ptrace requests
   186  
   187  const (
   188  	PTRACE_TRACEME = C.PT_TRACE_ME
   189  	PTRACE_CONT    = C.PT_CONTINUE
   190  	PTRACE_KILL    = C.PT_KILL
   191  )
   192  
   193  // Events (kqueue, kevent)
   194  
   195  type Kevent_t C.struct_kevent
   196  
   197  // Select
   198  
   199  type FdSet C.fd_set
   200  
   201  // Routing and interface messages
   202  
   203  const (
   204  	SizeofIfMsghdr    = C.sizeof_struct_if_msghdr
   205  	SizeofIfData      = C.sizeof_struct_if_data
   206  	SizeofIfaMsghdr   = C.sizeof_struct_ifa_msghdr
   207  	SizeofIfmaMsghdr  = C.sizeof_struct_ifma_msghdr
   208  	SizeofIfmaMsghdr2 = C.sizeof_struct_ifma_msghdr2
   209  	SizeofRtMsghdr    = C.sizeof_struct_rt_msghdr
   210  	SizeofRtMetrics   = C.sizeof_struct_rt_metrics
   211  )
   212  
   213  type IfMsghdr C.struct_if_msghdr
   214  
   215  type IfData C.struct_if_data
   216  
   217  type IfaMsghdr C.struct_ifa_msghdr
   218  
   219  type IfmaMsghdr C.struct_ifma_msghdr
   220  
   221  type IfmaMsghdr2 C.struct_ifma_msghdr2
   222  
   223  type RtMsghdr C.struct_rt_msghdr
   224  
   225  type RtMetrics C.struct_rt_metrics
   226  
   227  // Berkeley packet filter
   228  
   229  const (
   230  	SizeofBpfVersion = C.sizeof_struct_bpf_version
   231  	SizeofBpfStat    = C.sizeof_struct_bpf_stat
   232  	SizeofBpfProgram = C.sizeof_struct_bpf_program
   233  	SizeofBpfInsn    = C.sizeof_struct_bpf_insn
   234  	SizeofBpfHdr     = C.sizeof_struct_bpf_hdr
   235  )
   236  
   237  type BpfVersion C.struct_bpf_version
   238  
   239  type BpfStat C.struct_bpf_stat
   240  
   241  type BpfProgram C.struct_bpf_program
   242  
   243  type BpfInsn C.struct_bpf_insn
   244  
   245  type BpfHdr C.struct_bpf_hdr
   246  
   247  // Misc
   248  
   249  const (
   250  	_AT_FDCWD = C.AT_FDCWD
   251  )
   252  
   253  // Terminal handling
   254  
   255  type Termios C.struct_termios
   256  

View as plain text