Black Lives Matter. Support the Equal Justice Initiative.

Source file src/syscall/types_darwin.go

Documentation: syscall

     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  // +build ignore
     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 syscall
    16  
    17  /*
    18  #define __DARWIN_UNIX03 0
    19  #define KERNEL
    20  #define _DARWIN_USE_64_BIT_INODE
    21  #include <dirent.h>
    22  #include <fcntl.h>
    23  #include <signal.h>
    24  #include <termios.h>
    25  #include <unistd.h>
    26  #include <mach/mach.h>
    27  #include <mach/message.h>
    28  #include <sys/event.h>
    29  #include <sys/mman.h>
    30  #include <sys/mount.h>
    31  #include <sys/param.h>
    32  #include <sys/ptrace.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/uio.h>
    41  #include <sys/un.h>
    42  #include <sys/wait.h>
    43  #include <net/bpf.h>
    44  #include <net/if.h>
    45  #include <net/if_dl.h>
    46  #include <net/if_var.h>
    47  #include <net/route.h>
    48  #include <netinet/in.h>
    49  #include <netinet/icmp6.h>
    50  #include <netinet/tcp.h>
    51  
    52  enum {
    53  	sizeofPtr = sizeof(void*),
    54  };
    55  
    56  union sockaddr_all {
    57  	struct sockaddr s1;	// this one gets used for fields
    58  	struct sockaddr_in s2;	// these pad it out
    59  	struct sockaddr_in6 s3;
    60  	struct sockaddr_un s4;
    61  	struct sockaddr_dl s5;
    62  };
    63  
    64  struct sockaddr_any {
    65  	struct sockaddr addr;
    66  	char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
    67  };
    68  
    69  */
    70  import "C"
    71  
    72  // Machine characteristics; for internal use.
    73  
    74  const (
    75  	sizeofPtr      = C.sizeofPtr
    76  	sizeofShort    = C.sizeof_short
    77  	sizeofInt      = C.sizeof_int
    78  	sizeofLong     = C.sizeof_long
    79  	sizeofLongLong = C.sizeof_longlong
    80  )
    81  
    82  // Basic types
    83  
    84  type (
    85  	_C_short     C.short
    86  	_C_int       C.int
    87  	_C_long      C.long
    88  	_C_long_long C.longlong
    89  )
    90  
    91  // Time
    92  
    93  type Timespec C.struct_timespec
    94  
    95  type Timeval C.struct_timeval
    96  
    97  type Timeval32 C.struct_timeval32
    98  
    99  // Processes
   100  
   101  type Rusage C.struct_rusage
   102  
   103  type Rlimit C.struct_rlimit
   104  
   105  type _Gid_t C.gid_t
   106  
   107  // Files
   108  
   109  type Stat_t C.struct_stat64
   110  
   111  type Statfs_t C.struct_statfs64
   112  
   113  type Flock_t C.struct_flock
   114  
   115  type Fstore_t C.struct_fstore
   116  
   117  type Radvisory_t C.struct_radvisory
   118  
   119  type Fbootstraptransfer_t C.struct_fbootstraptransfer
   120  
   121  type Log2phys_t C.struct_log2phys
   122  
   123  type Fsid C.struct_fsid
   124  
   125  type Dirent C.struct_dirent
   126  
   127  // File system limits
   128  
   129  const (
   130  	pathMax = C.PATH_MAX
   131  )
   132  
   133  // Sockets
   134  
   135  type RawSockaddrInet4 C.struct_sockaddr_in
   136  
   137  type RawSockaddrInet6 C.struct_sockaddr_in6
   138  
   139  type RawSockaddrUnix C.struct_sockaddr_un
   140  
   141  type RawSockaddrDatalink C.struct_sockaddr_dl
   142  
   143  type RawSockaddr C.struct_sockaddr
   144  
   145  type RawSockaddrAny C.struct_sockaddr_any
   146  
   147  type _Socklen C.socklen_t
   148  
   149  type Linger C.struct_linger
   150  
   151  type Iovec C.struct_iovec
   152  
   153  type IPMreq C.struct_ip_mreq
   154  
   155  type IPv6Mreq C.struct_ipv6_mreq
   156  
   157  type Msghdr C.struct_msghdr
   158  
   159  type Cmsghdr C.struct_cmsghdr
   160  
   161  type Inet4Pktinfo C.struct_in_pktinfo
   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  	SizeofInet4Pktinfo     = C.sizeof_struct_in_pktinfo
   181  	SizeofInet6Pktinfo     = C.sizeof_struct_in6_pktinfo
   182  	SizeofIPv6MTUInfo      = C.sizeof_struct_ip6_mtuinfo
   183  	SizeofICMPv6Filter     = C.sizeof_struct_icmp6_filter
   184  )
   185  
   186  // Ptrace requests
   187  
   188  const (
   189  	PTRACE_TRACEME = C.PT_TRACE_ME
   190  	PTRACE_CONT    = C.PT_CONTINUE
   191  	PTRACE_KILL    = C.PT_KILL
   192  )
   193  
   194  // Events (kqueue, kevent)
   195  
   196  type Kevent_t C.struct_kevent
   197  
   198  // Select
   199  
   200  type FdSet C.fd_set
   201  
   202  // Routing and interface messages
   203  
   204  const (
   205  	SizeofIfMsghdr    = C.sizeof_struct_if_msghdr
   206  	SizeofIfData      = C.sizeof_struct_if_data
   207  	SizeofIfaMsghdr   = C.sizeof_struct_ifa_msghdr
   208  	SizeofIfmaMsghdr  = C.sizeof_struct_ifma_msghdr
   209  	SizeofIfmaMsghdr2 = C.sizeof_struct_ifma_msghdr2
   210  	SizeofRtMsghdr    = C.sizeof_struct_rt_msghdr
   211  	SizeofRtMetrics   = C.sizeof_struct_rt_metrics
   212  )
   213  
   214  type IfMsghdr C.struct_if_msghdr
   215  
   216  type IfData C.struct_if_data
   217  
   218  type IfaMsghdr C.struct_ifa_msghdr
   219  
   220  type IfmaMsghdr C.struct_ifma_msghdr
   221  
   222  type IfmaMsghdr2 C.struct_ifma_msghdr2
   223  
   224  type RtMsghdr C.struct_rt_msghdr
   225  
   226  type RtMetrics C.struct_rt_metrics
   227  
   228  // Berkeley packet filter
   229  
   230  const (
   231  	SizeofBpfVersion = C.sizeof_struct_bpf_version
   232  	SizeofBpfStat    = C.sizeof_struct_bpf_stat
   233  	SizeofBpfProgram = C.sizeof_struct_bpf_program
   234  	SizeofBpfInsn    = C.sizeof_struct_bpf_insn
   235  	SizeofBpfHdr     = C.sizeof_struct_bpf_hdr
   236  )
   237  
   238  type BpfVersion C.struct_bpf_version
   239  
   240  type BpfStat C.struct_bpf_stat
   241  
   242  type BpfProgram C.struct_bpf_program
   243  
   244  type BpfInsn C.struct_bpf_insn
   245  
   246  type BpfHdr C.struct_bpf_hdr
   247  
   248  // Misc
   249  
   250  const (
   251  	_AT_FDCWD = C.AT_FDCWD
   252  )
   253  
   254  // Terminal handling
   255  
   256  type Termios C.struct_termios
   257  

View as plain text