github.com/etecs-ru/go-sys-wineventlog@v0.0.0-20210227233244-4c3abb794018/unix/types_darwin.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  //go:build ignore
     6  // +build ignore
     7  
     8  /*
     9  Input to cgo -godefs.  See README.md
    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 unix
    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 <poll.h>
    24  #include <signal.h>
    25  #include <termios.h>
    26  #include <unistd.h>
    27  #include <mach/mach.h>
    28  #include <mach/message.h>
    29  #include <sys/event.h>
    30  #include <sys/kern_control.h>
    31  #include <sys/mman.h>
    32  #include <sys/mount.h>
    33  #include <sys/param.h>
    34  #include <sys/ptrace.h>
    35  #include <sys/resource.h>
    36  #include <sys/select.h>
    37  #include <sys/signal.h>
    38  #include <sys/socket.h>
    39  #include <sys/stat.h>
    40  #include <sys/time.h>
    41  #include <sys/types.h>
    42  #include <sys/ucred.h>
    43  #include <sys/uio.h>
    44  #include <sys/un.h>
    45  #include <sys/utsname.h>
    46  #include <sys/wait.h>
    47  #include <net/bpf.h>
    48  #include <net/if.h>
    49  #include <net/if_dl.h>
    50  #include <net/if_var.h>
    51  #include <net/route.h>
    52  #include <netinet/in.h>
    53  #include <netinet/icmp6.h>
    54  #include <netinet/tcp.h>
    55  
    56  enum {
    57  	sizeofPtr = sizeof(void*),
    58  };
    59  
    60  union sockaddr_all {
    61  	struct sockaddr s1;	// this one gets used for fields
    62  	struct sockaddr_in s2;	// these pad it out
    63  	struct sockaddr_in6 s3;
    64  	struct sockaddr_un s4;
    65  	struct sockaddr_dl s5;
    66  };
    67  
    68  struct sockaddr_any {
    69  	struct sockaddr addr;
    70  	char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
    71  };
    72  
    73  */
    74  import "C"
    75  
    76  // Machine characteristics
    77  
    78  const (
    79  	SizeofPtr      = C.sizeofPtr
    80  	SizeofShort    = C.sizeof_short
    81  	SizeofInt      = C.sizeof_int
    82  	SizeofLong     = C.sizeof_long
    83  	SizeofLongLong = C.sizeof_longlong
    84  )
    85  
    86  // Basic types
    87  
    88  type (
    89  	_C_short     C.short
    90  	_C_int       C.int
    91  	_C_long      C.long
    92  	_C_long_long C.longlong
    93  )
    94  
    95  // Time
    96  
    97  type Timespec C.struct_timespec
    98  
    99  type Timeval C.struct_timeval
   100  
   101  type Timeval32 C.struct_timeval32
   102  
   103  // Processes
   104  
   105  type Rusage C.struct_rusage
   106  
   107  type Rlimit C.struct_rlimit
   108  
   109  type _Gid_t C.gid_t
   110  
   111  // Files
   112  
   113  type Stat_t C.struct_stat64
   114  
   115  type Statfs_t C.struct_statfs64
   116  
   117  type Flock_t C.struct_flock
   118  
   119  type Fstore_t C.struct_fstore
   120  
   121  type Radvisory_t C.struct_radvisory
   122  
   123  type Fbootstraptransfer_t C.struct_fbootstraptransfer
   124  
   125  type Log2phys_t C.struct_log2phys
   126  
   127  type Fsid C.struct_fsid
   128  
   129  type Dirent C.struct_dirent
   130  
   131  // File system limits
   132  
   133  const (
   134  	PathMax = C.PATH_MAX
   135  )
   136  
   137  // Sockets
   138  
   139  type RawSockaddrInet4 C.struct_sockaddr_in
   140  
   141  type RawSockaddrInet6 C.struct_sockaddr_in6
   142  
   143  type RawSockaddrUnix C.struct_sockaddr_un
   144  
   145  type RawSockaddrDatalink C.struct_sockaddr_dl
   146  
   147  type RawSockaddr C.struct_sockaddr
   148  
   149  type RawSockaddrAny C.struct_sockaddr_any
   150  
   151  type RawSockaddrCtl C.struct_sockaddr_ctl
   152  
   153  type _Socklen C.socklen_t
   154  
   155  type Xucred C.struct_xucred
   156  
   157  type Linger C.struct_linger
   158  
   159  type Iovec C.struct_iovec
   160  
   161  type IPMreq C.struct_ip_mreq
   162  
   163  type IPv6Mreq C.struct_ipv6_mreq
   164  
   165  type Msghdr C.struct_msghdr
   166  
   167  type Cmsghdr C.struct_cmsghdr
   168  
   169  type Inet4Pktinfo C.struct_in_pktinfo
   170  
   171  type Inet6Pktinfo C.struct_in6_pktinfo
   172  
   173  type IPv6MTUInfo C.struct_ip6_mtuinfo
   174  
   175  type ICMPv6Filter C.struct_icmp6_filter
   176  
   177  const (
   178  	SizeofSockaddrInet4    = C.sizeof_struct_sockaddr_in
   179  	SizeofSockaddrInet6    = C.sizeof_struct_sockaddr_in6
   180  	SizeofSockaddrAny      = C.sizeof_struct_sockaddr_any
   181  	SizeofSockaddrUnix     = C.sizeof_struct_sockaddr_un
   182  	SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
   183  	SizeofSockaddrCtl      = C.sizeof_struct_sockaddr_ctl
   184  	SizeofXucred           = C.sizeof_struct_xucred
   185  	SizeofLinger           = C.sizeof_struct_linger
   186  	SizeofIovec            = C.sizeof_struct_iovec
   187  	SizeofIPMreq           = C.sizeof_struct_ip_mreq
   188  	SizeofIPv6Mreq         = C.sizeof_struct_ipv6_mreq
   189  	SizeofMsghdr           = C.sizeof_struct_msghdr
   190  	SizeofCmsghdr          = C.sizeof_struct_cmsghdr
   191  	SizeofInet4Pktinfo     = C.sizeof_struct_in_pktinfo
   192  	SizeofInet6Pktinfo     = C.sizeof_struct_in6_pktinfo
   193  	SizeofIPv6MTUInfo      = C.sizeof_struct_ip6_mtuinfo
   194  	SizeofICMPv6Filter     = C.sizeof_struct_icmp6_filter
   195  )
   196  
   197  // Ptrace requests
   198  
   199  const (
   200  	PTRACE_TRACEME = C.PT_TRACE_ME
   201  	PTRACE_CONT    = C.PT_CONTINUE
   202  	PTRACE_KILL    = C.PT_KILL
   203  )
   204  
   205  // Events (kqueue, kevent)
   206  
   207  type Kevent_t C.struct_kevent
   208  
   209  // Select
   210  
   211  type FdSet C.fd_set
   212  
   213  // Routing and interface messages
   214  
   215  const (
   216  	SizeofIfMsghdr    = C.sizeof_struct_if_msghdr
   217  	SizeofIfData      = C.sizeof_struct_if_data
   218  	SizeofIfaMsghdr   = C.sizeof_struct_ifa_msghdr
   219  	SizeofIfmaMsghdr  = C.sizeof_struct_ifma_msghdr
   220  	SizeofIfmaMsghdr2 = C.sizeof_struct_ifma_msghdr2
   221  	SizeofRtMsghdr    = C.sizeof_struct_rt_msghdr
   222  	SizeofRtMetrics   = C.sizeof_struct_rt_metrics
   223  )
   224  
   225  type IfMsghdr C.struct_if_msghdr
   226  
   227  type IfData C.struct_if_data
   228  
   229  type IfaMsghdr C.struct_ifa_msghdr
   230  
   231  type IfmaMsghdr C.struct_ifma_msghdr
   232  
   233  type IfmaMsghdr2 C.struct_ifma_msghdr2
   234  
   235  type RtMsghdr C.struct_rt_msghdr
   236  
   237  type RtMetrics C.struct_rt_metrics
   238  
   239  // Berkeley packet filter
   240  
   241  const (
   242  	SizeofBpfVersion = C.sizeof_struct_bpf_version
   243  	SizeofBpfStat    = C.sizeof_struct_bpf_stat
   244  	SizeofBpfProgram = C.sizeof_struct_bpf_program
   245  	SizeofBpfInsn    = C.sizeof_struct_bpf_insn
   246  	SizeofBpfHdr     = C.sizeof_struct_bpf_hdr
   247  )
   248  
   249  type BpfVersion C.struct_bpf_version
   250  
   251  type BpfStat C.struct_bpf_stat
   252  
   253  type BpfProgram C.struct_bpf_program
   254  
   255  type BpfInsn C.struct_bpf_insn
   256  
   257  type BpfHdr C.struct_bpf_hdr
   258  
   259  // Terminal handling
   260  
   261  type Termios C.struct_termios
   262  
   263  type Winsize C.struct_winsize
   264  
   265  // fchmodat-like syscalls.
   266  
   267  const (
   268  	AT_FDCWD            = C.AT_FDCWD
   269  	AT_REMOVEDIR        = C.AT_REMOVEDIR
   270  	AT_SYMLINK_FOLLOW   = C.AT_SYMLINK_FOLLOW
   271  	AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
   272  )
   273  
   274  // poll
   275  
   276  type PollFd C.struct_pollfd
   277  
   278  const (
   279  	POLLERR    = C.POLLERR
   280  	POLLHUP    = C.POLLHUP
   281  	POLLIN     = C.POLLIN
   282  	POLLNVAL   = C.POLLNVAL
   283  	POLLOUT    = C.POLLOUT
   284  	POLLPRI    = C.POLLPRI
   285  	POLLRDBAND = C.POLLRDBAND
   286  	POLLRDNORM = C.POLLRDNORM
   287  	POLLWRBAND = C.POLLWRBAND
   288  	POLLWRNORM = C.POLLWRNORM
   289  )
   290  
   291  // uname
   292  
   293  type Utsname C.struct_utsname
   294  
   295  // Clockinfo
   296  
   297  const SizeofClockinfo = C.sizeof_struct_clockinfo
   298  
   299  type Clockinfo C.struct_clockinfo
   300  
   301  // ctl_info
   302  
   303  type CtlInfo C.struct_ctl_info