github.com/HACKERALERT/Picocrypt/src/external/sys@v0.0.0-20210609020157-e519952f829f/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 IPMreqn C.struct_ip_mreqn
   164  
   165  type IPv6Mreq C.struct_ipv6_mreq
   166  
   167  type Msghdr C.struct_msghdr
   168  
   169  type Cmsghdr C.struct_cmsghdr
   170  
   171  type Inet4Pktinfo C.struct_in_pktinfo
   172  
   173  type Inet6Pktinfo C.struct_in6_pktinfo
   174  
   175  type IPv6MTUInfo C.struct_ip6_mtuinfo
   176  
   177  type ICMPv6Filter C.struct_icmp6_filter
   178  
   179  const (
   180  	SizeofSockaddrInet4    = C.sizeof_struct_sockaddr_in
   181  	SizeofSockaddrInet6    = C.sizeof_struct_sockaddr_in6
   182  	SizeofSockaddrAny      = C.sizeof_struct_sockaddr_any
   183  	SizeofSockaddrUnix     = C.sizeof_struct_sockaddr_un
   184  	SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
   185  	SizeofSockaddrCtl      = C.sizeof_struct_sockaddr_ctl
   186  	SizeofXucred           = C.sizeof_struct_xucred
   187  	SizeofLinger           = C.sizeof_struct_linger
   188  	SizeofIovec            = C.sizeof_struct_iovec
   189  	SizeofIPMreq           = C.sizeof_struct_ip_mreq
   190  	SizeofIPMreqn          = C.sizeof_struct_ip_mreqn
   191  	SizeofIPv6Mreq         = C.sizeof_struct_ipv6_mreq
   192  	SizeofMsghdr           = C.sizeof_struct_msghdr
   193  	SizeofCmsghdr          = C.sizeof_struct_cmsghdr
   194  	SizeofInet4Pktinfo     = C.sizeof_struct_in_pktinfo
   195  	SizeofInet6Pktinfo     = C.sizeof_struct_in6_pktinfo
   196  	SizeofIPv6MTUInfo      = C.sizeof_struct_ip6_mtuinfo
   197  	SizeofICMPv6Filter     = C.sizeof_struct_icmp6_filter
   198  )
   199  
   200  // Ptrace requests
   201  
   202  const (
   203  	PTRACE_TRACEME = C.PT_TRACE_ME
   204  	PTRACE_CONT    = C.PT_CONTINUE
   205  	PTRACE_KILL    = C.PT_KILL
   206  )
   207  
   208  // Events (kqueue, kevent)
   209  
   210  type Kevent_t C.struct_kevent
   211  
   212  // Select
   213  
   214  type FdSet C.fd_set
   215  
   216  // Routing and interface messages
   217  
   218  const (
   219  	SizeofIfMsghdr    = C.sizeof_struct_if_msghdr
   220  	SizeofIfData      = C.sizeof_struct_if_data
   221  	SizeofIfaMsghdr   = C.sizeof_struct_ifa_msghdr
   222  	SizeofIfmaMsghdr  = C.sizeof_struct_ifma_msghdr
   223  	SizeofIfmaMsghdr2 = C.sizeof_struct_ifma_msghdr2
   224  	SizeofRtMsghdr    = C.sizeof_struct_rt_msghdr
   225  	SizeofRtMetrics   = C.sizeof_struct_rt_metrics
   226  )
   227  
   228  type IfMsghdr C.struct_if_msghdr
   229  
   230  type IfData C.struct_if_data
   231  
   232  type IfaMsghdr C.struct_ifa_msghdr
   233  
   234  type IfmaMsghdr C.struct_ifma_msghdr
   235  
   236  type IfmaMsghdr2 C.struct_ifma_msghdr2
   237  
   238  type RtMsghdr C.struct_rt_msghdr
   239  
   240  type RtMetrics C.struct_rt_metrics
   241  
   242  // Berkeley packet filter
   243  
   244  const (
   245  	SizeofBpfVersion = C.sizeof_struct_bpf_version
   246  	SizeofBpfStat    = C.sizeof_struct_bpf_stat
   247  	SizeofBpfProgram = C.sizeof_struct_bpf_program
   248  	SizeofBpfInsn    = C.sizeof_struct_bpf_insn
   249  	SizeofBpfHdr     = C.sizeof_struct_bpf_hdr
   250  )
   251  
   252  type BpfVersion C.struct_bpf_version
   253  
   254  type BpfStat C.struct_bpf_stat
   255  
   256  type BpfProgram C.struct_bpf_program
   257  
   258  type BpfInsn C.struct_bpf_insn
   259  
   260  type BpfHdr C.struct_bpf_hdr
   261  
   262  // Terminal handling
   263  
   264  type Termios C.struct_termios
   265  
   266  type Winsize C.struct_winsize
   267  
   268  // fchmodat-like syscalls.
   269  
   270  const (
   271  	AT_FDCWD            = C.AT_FDCWD
   272  	AT_REMOVEDIR        = C.AT_REMOVEDIR
   273  	AT_SYMLINK_FOLLOW   = C.AT_SYMLINK_FOLLOW
   274  	AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
   275  )
   276  
   277  // poll
   278  
   279  type PollFd C.struct_pollfd
   280  
   281  const (
   282  	POLLERR    = C.POLLERR
   283  	POLLHUP    = C.POLLHUP
   284  	POLLIN     = C.POLLIN
   285  	POLLNVAL   = C.POLLNVAL
   286  	POLLOUT    = C.POLLOUT
   287  	POLLPRI    = C.POLLPRI
   288  	POLLRDBAND = C.POLLRDBAND
   289  	POLLRDNORM = C.POLLRDNORM
   290  	POLLWRBAND = C.POLLWRBAND
   291  	POLLWRNORM = C.POLLWRNORM
   292  )
   293  
   294  // uname
   295  
   296  type Utsname C.struct_utsname
   297  
   298  // Clockinfo
   299  
   300  const SizeofClockinfo = C.sizeof_struct_clockinfo
   301  
   302  type Clockinfo C.struct_clockinfo
   303  
   304  // ctl_info
   305  
   306  type CtlInfo C.struct_ctl_info