github.com/HACKERALERT/Picocrypt/src/external/sys@v0.0.0-20210609020157-e519952f829f/unix/types_netbsd.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 KERNEL
    19  #include <dirent.h>
    20  #include <fcntl.h>
    21  #include <poll.h>
    22  #include <signal.h>
    23  #include <termios.h>
    24  #include <stdio.h>
    25  #include <unistd.h>
    26  #include <sys/param.h>
    27  #include <sys/types.h>
    28  #include <sys/event.h>
    29  #include <sys/mman.h>
    30  #include <sys/mount.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/statvfs.h>
    38  #include <sys/sysctl.h>
    39  #include <sys/time.h>
    40  #include <sys/uio.h>
    41  #include <sys/un.h>
    42  #include <sys/utsname.h>
    43  #include <sys/wait.h>
    44  #include <net/bpf.h>
    45  #include <net/if.h>
    46  #include <net/if_dl.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
    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  // Processes
    98  
    99  type Rusage C.struct_rusage
   100  
   101  type Rlimit C.struct_rlimit
   102  
   103  type _Gid_t C.gid_t
   104  
   105  // Files
   106  
   107  type Stat_t C.struct_stat
   108  
   109  type Statfs_t C.struct_statfs
   110  
   111  type Statvfs_t C.struct_statvfs
   112  
   113  type Flock_t C.struct_flock
   114  
   115  type Dirent C.struct_dirent
   116  
   117  type Fsid C.fsid_t
   118  
   119  // File system limits
   120  
   121  const (
   122  	PathMax = C.PATH_MAX
   123  )
   124  
   125  // Fstatvfs/Statvfs flags
   126  
   127  const (
   128  	ST_WAIT   = C.ST_WAIT
   129  	ST_NOWAIT = C.ST_NOWAIT
   130  )
   131  
   132  // Advice to Fadvise
   133  
   134  const (
   135  	FADV_NORMAL     = C.POSIX_FADV_NORMAL
   136  	FADV_RANDOM     = C.POSIX_FADV_RANDOM
   137  	FADV_SEQUENTIAL = C.POSIX_FADV_SEQUENTIAL
   138  	FADV_WILLNEED   = C.POSIX_FADV_WILLNEED
   139  	FADV_DONTNEED   = C.POSIX_FADV_DONTNEED
   140  	FADV_NOREUSE    = C.POSIX_FADV_NOREUSE
   141  )
   142  
   143  // Sockets
   144  
   145  type RawSockaddrInet4 C.struct_sockaddr_in
   146  
   147  type RawSockaddrInet6 C.struct_sockaddr_in6
   148  
   149  type RawSockaddrUnix C.struct_sockaddr_un
   150  
   151  type RawSockaddrDatalink C.struct_sockaddr_dl
   152  
   153  type RawSockaddr C.struct_sockaddr
   154  
   155  type RawSockaddrAny C.struct_sockaddr_any
   156  
   157  type _Socklen C.socklen_t
   158  
   159  type Linger C.struct_linger
   160  
   161  type Iovec C.struct_iovec
   162  
   163  type IPMreq C.struct_ip_mreq
   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 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  	SizeofLinger           = C.sizeof_struct_linger
   184  	SizeofIovec            = C.sizeof_struct_iovec
   185  	SizeofIPMreq           = C.sizeof_struct_ip_mreq
   186  	SizeofIPv6Mreq         = C.sizeof_struct_ipv6_mreq
   187  	SizeofMsghdr           = C.sizeof_struct_msghdr
   188  	SizeofCmsghdr          = C.sizeof_struct_cmsghdr
   189  	SizeofInet6Pktinfo     = C.sizeof_struct_in6_pktinfo
   190  	SizeofIPv6MTUInfo      = C.sizeof_struct_ip6_mtuinfo
   191  	SizeofICMPv6Filter     = C.sizeof_struct_icmp6_filter
   192  )
   193  
   194  // Ptrace requests
   195  
   196  const (
   197  	PTRACE_TRACEME = C.PT_TRACE_ME
   198  	PTRACE_CONT    = C.PT_CONTINUE
   199  	PTRACE_KILL    = C.PT_KILL
   200  )
   201  
   202  // Events (kqueue, kevent)
   203  
   204  type Kevent_t C.struct_kevent
   205  
   206  // Select
   207  
   208  type FdSet C.fd_set
   209  
   210  // Routing and interface messages
   211  
   212  const (
   213  	SizeofIfMsghdr         = C.sizeof_struct_if_msghdr
   214  	SizeofIfData           = C.sizeof_struct_if_data
   215  	SizeofIfaMsghdr        = C.sizeof_struct_ifa_msghdr
   216  	SizeofIfAnnounceMsghdr = C.sizeof_struct_if_announcemsghdr
   217  	SizeofRtMsghdr         = C.sizeof_struct_rt_msghdr
   218  	SizeofRtMetrics        = C.sizeof_struct_rt_metrics
   219  )
   220  
   221  type IfMsghdr C.struct_if_msghdr
   222  
   223  type IfData C.struct_if_data
   224  
   225  type IfaMsghdr C.struct_ifa_msghdr
   226  
   227  type IfAnnounceMsghdr C.struct_if_announcemsghdr
   228  
   229  type RtMsghdr C.struct_rt_msghdr
   230  
   231  type RtMetrics C.struct_rt_metrics
   232  
   233  type Mclpool C.struct_mclpool
   234  
   235  // Berkeley packet filter
   236  
   237  const (
   238  	SizeofBpfVersion = C.sizeof_struct_bpf_version
   239  	SizeofBpfStat    = C.sizeof_struct_bpf_stat
   240  	SizeofBpfProgram = C.sizeof_struct_bpf_program
   241  	SizeofBpfInsn    = C.sizeof_struct_bpf_insn
   242  	SizeofBpfHdr     = C.sizeof_struct_bpf_hdr
   243  )
   244  
   245  type BpfVersion C.struct_bpf_version
   246  
   247  type BpfStat C.struct_bpf_stat
   248  
   249  type BpfProgram C.struct_bpf_program
   250  
   251  type BpfInsn C.struct_bpf_insn
   252  
   253  type BpfHdr C.struct_bpf_hdr
   254  
   255  type BpfTimeval C.struct_bpf_timeval
   256  
   257  // Terminal handling
   258  
   259  type Termios C.struct_termios
   260  
   261  type Winsize C.struct_winsize
   262  
   263  type Ptmget C.struct_ptmget
   264  
   265  // fchmodat-like syscalls.
   266  
   267  const (
   268  	AT_FDCWD            = C.AT_FDCWD
   269  	AT_SYMLINK_FOLLOW   = C.AT_SYMLINK_FOLLOW
   270  	AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
   271  )
   272  
   273  // poll
   274  
   275  type PollFd C.struct_pollfd
   276  
   277  const (
   278  	POLLERR    = C.POLLERR
   279  	POLLHUP    = C.POLLHUP
   280  	POLLIN     = C.POLLIN
   281  	POLLNVAL   = C.POLLNVAL
   282  	POLLOUT    = C.POLLOUT
   283  	POLLPRI    = C.POLLPRI
   284  	POLLRDBAND = C.POLLRDBAND
   285  	POLLRDNORM = C.POLLRDNORM
   286  	POLLWRBAND = C.POLLWRBAND
   287  	POLLWRNORM = C.POLLWRNORM
   288  )
   289  
   290  // Sysctl
   291  
   292  type Sysctlnode C.struct_sysctlnode
   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