...
Run Format

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  // +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  // Sockets
   127  
   128  type RawSockaddrInet4 C.struct_sockaddr_in
   129  
   130  type RawSockaddrInet6 C.struct_sockaddr_in6
   131  
   132  type RawSockaddrUnix C.struct_sockaddr_un
   133  
   134  type RawSockaddrDatalink C.struct_sockaddr_dl
   135  
   136  type RawSockaddr C.struct_sockaddr
   137  
   138  type RawSockaddrAny C.struct_sockaddr_any
   139  
   140  type _Socklen C.socklen_t
   141  
   142  type Linger C.struct_linger
   143  
   144  type Iovec C.struct_iovec
   145  
   146  type IPMreq C.struct_ip_mreq
   147  
   148  type IPv6Mreq C.struct_ipv6_mreq
   149  
   150  type Msghdr C.struct_msghdr
   151  
   152  type Cmsghdr C.struct_cmsghdr
   153  
   154  type Inet4Pktinfo C.struct_in_pktinfo
   155  
   156  type Inet6Pktinfo C.struct_in6_pktinfo
   157  
   158  type IPv6MTUInfo C.struct_ip6_mtuinfo
   159  
   160  type ICMPv6Filter C.struct_icmp6_filter
   161  
   162  const (
   163  	SizeofSockaddrInet4    = C.sizeof_struct_sockaddr_in
   164  	SizeofSockaddrInet6    = C.sizeof_struct_sockaddr_in6
   165  	SizeofSockaddrAny      = C.sizeof_struct_sockaddr_any
   166  	SizeofSockaddrUnix     = C.sizeof_struct_sockaddr_un
   167  	SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
   168  	SizeofLinger           = C.sizeof_struct_linger
   169  	SizeofIPMreq           = C.sizeof_struct_ip_mreq
   170  	SizeofIPv6Mreq         = C.sizeof_struct_ipv6_mreq
   171  	SizeofMsghdr           = C.sizeof_struct_msghdr
   172  	SizeofCmsghdr          = C.sizeof_struct_cmsghdr
   173  	SizeofInet4Pktinfo     = C.sizeof_struct_in_pktinfo
   174  	SizeofInet6Pktinfo     = C.sizeof_struct_in6_pktinfo
   175  	SizeofIPv6MTUInfo      = C.sizeof_struct_ip6_mtuinfo
   176  	SizeofICMPv6Filter     = C.sizeof_struct_icmp6_filter
   177  )
   178  
   179  // Ptrace requests
   180  
   181  const (
   182  	PTRACE_TRACEME = C.PT_TRACE_ME
   183  	PTRACE_CONT    = C.PT_CONTINUE
   184  	PTRACE_KILL    = C.PT_KILL
   185  )
   186  
   187  // Events (kqueue, kevent)
   188  
   189  type Kevent_t C.struct_kevent
   190  
   191  // Select
   192  
   193  type FdSet C.fd_set
   194  
   195  // Routing and interface messages
   196  
   197  const (
   198  	SizeofIfMsghdr    = C.sizeof_struct_if_msghdr
   199  	SizeofIfData      = C.sizeof_struct_if_data
   200  	SizeofIfaMsghdr   = C.sizeof_struct_ifa_msghdr
   201  	SizeofIfmaMsghdr  = C.sizeof_struct_ifma_msghdr
   202  	SizeofIfmaMsghdr2 = C.sizeof_struct_ifma_msghdr2
   203  	SizeofRtMsghdr    = C.sizeof_struct_rt_msghdr
   204  	SizeofRtMetrics   = C.sizeof_struct_rt_metrics
   205  )
   206  
   207  type IfMsghdr C.struct_if_msghdr
   208  
   209  type IfData C.struct_if_data
   210  
   211  type IfaMsghdr C.struct_ifa_msghdr
   212  
   213  type IfmaMsghdr C.struct_ifma_msghdr
   214  
   215  type IfmaMsghdr2 C.struct_ifma_msghdr2
   216  
   217  type RtMsghdr C.struct_rt_msghdr
   218  
   219  type RtMetrics C.struct_rt_metrics
   220  
   221  // Berkeley packet filter
   222  
   223  const (
   224  	SizeofBpfVersion = C.sizeof_struct_bpf_version
   225  	SizeofBpfStat    = C.sizeof_struct_bpf_stat
   226  	SizeofBpfProgram = C.sizeof_struct_bpf_program
   227  	SizeofBpfInsn    = C.sizeof_struct_bpf_insn
   228  	SizeofBpfHdr     = C.sizeof_struct_bpf_hdr
   229  )
   230  
   231  type BpfVersion C.struct_bpf_version
   232  
   233  type BpfStat C.struct_bpf_stat
   234  
   235  type BpfProgram C.struct_bpf_program
   236  
   237  type BpfInsn C.struct_bpf_insn
   238  
   239  type BpfHdr C.struct_bpf_hdr
   240  
   241  // Misc
   242  
   243  const (
   244  	_AT_FDCWD = C.AT_FDCWD
   245  )
   246  
   247  // Terminal handling
   248  
   249  type Termios C.struct_termios
   250  

View as plain text