golang.org/x/sys@v0.9.0/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 <uvm/uvm_extern.h>
    45  #include <net/bpf.h>
    46  #include <net/if.h>
    47  #include <net/if_dl.h>
    48  #include <net/route.h>
    49  #include <netinet/in.h>
    50  #include <netinet/icmp6.h>
    51  #include <netinet/tcp.h>
    52  
    53  enum {
    54  	sizeofPtr = sizeof(void*),
    55  };
    56  
    57  union sockaddr_all {
    58  	struct sockaddr s1;	// this one gets used for fields
    59  	struct sockaddr_in s2;	// these pad it out
    60  	struct sockaddr_in6 s3;
    61  	struct sockaddr_un s4;
    62  	struct sockaddr_dl s5;
    63  };
    64  
    65  struct sockaddr_any {
    66  	struct sockaddr addr;
    67  	char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
    68  };
    69  
    70  */
    71  import "C"
    72  
    73  // Machine characteristics
    74  
    75  const (
    76  	SizeofPtr      = C.sizeofPtr
    77  	SizeofShort    = C.sizeof_short
    78  	SizeofInt      = C.sizeof_int
    79  	SizeofLong     = C.sizeof_long
    80  	SizeofLongLong = C.sizeof_longlong
    81  )
    82  
    83  // Basic types
    84  
    85  type (
    86  	_C_short     C.short
    87  	_C_int       C.int
    88  	_C_long      C.long
    89  	_C_long_long C.longlong
    90  )
    91  
    92  // Time
    93  
    94  type Timespec C.struct_timespec
    95  
    96  type Timeval C.struct_timeval
    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_stat
   109  
   110  type Statfs_t C.struct_statfs
   111  
   112  type Statvfs_t C.struct_statvfs
   113  
   114  type Flock_t C.struct_flock
   115  
   116  type Dirent C.struct_dirent
   117  
   118  type Fsid C.fsid_t
   119  
   120  // File system limits
   121  
   122  const (
   123  	PathMax = C.PATH_MAX
   124  )
   125  
   126  // Fstatvfs/Statvfs flags
   127  
   128  const (
   129  	ST_WAIT   = C.ST_WAIT
   130  	ST_NOWAIT = C.ST_NOWAIT
   131  )
   132  
   133  // Advice to Fadvise
   134  
   135  const (
   136  	FADV_NORMAL     = C.POSIX_FADV_NORMAL
   137  	FADV_RANDOM     = C.POSIX_FADV_RANDOM
   138  	FADV_SEQUENTIAL = C.POSIX_FADV_SEQUENTIAL
   139  	FADV_WILLNEED   = C.POSIX_FADV_WILLNEED
   140  	FADV_DONTNEED   = C.POSIX_FADV_DONTNEED
   141  	FADV_NOREUSE    = C.POSIX_FADV_NOREUSE
   142  )
   143  
   144  // Sockets
   145  
   146  type RawSockaddrInet4 C.struct_sockaddr_in
   147  
   148  type RawSockaddrInet6 C.struct_sockaddr_in6
   149  
   150  type RawSockaddrUnix C.struct_sockaddr_un
   151  
   152  type RawSockaddrDatalink C.struct_sockaddr_dl
   153  
   154  type RawSockaddr C.struct_sockaddr
   155  
   156  type RawSockaddrAny C.struct_sockaddr_any
   157  
   158  type _Socklen C.socklen_t
   159  
   160  type Linger C.struct_linger
   161  
   162  type Iovec C.struct_iovec
   163  
   164  type IPMreq C.struct_ip_mreq
   165  
   166  type IPv6Mreq C.struct_ipv6_mreq
   167  
   168  type Msghdr C.struct_msghdr
   169  
   170  type Cmsghdr C.struct_cmsghdr
   171  
   172  type Inet6Pktinfo C.struct_in6_pktinfo
   173  
   174  type IPv6MTUInfo C.struct_ip6_mtuinfo
   175  
   176  type ICMPv6Filter C.struct_icmp6_filter
   177  
   178  const (
   179  	SizeofSockaddrInet4    = C.sizeof_struct_sockaddr_in
   180  	SizeofSockaddrInet6    = C.sizeof_struct_sockaddr_in6
   181  	SizeofSockaddrAny      = C.sizeof_struct_sockaddr_any
   182  	SizeofSockaddrUnix     = C.sizeof_struct_sockaddr_un
   183  	SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
   184  	SizeofLinger           = C.sizeof_struct_linger
   185  	SizeofIovec            = C.sizeof_struct_iovec
   186  	SizeofIPMreq           = C.sizeof_struct_ip_mreq
   187  	SizeofIPv6Mreq         = C.sizeof_struct_ipv6_mreq
   188  	SizeofMsghdr           = C.sizeof_struct_msghdr
   189  	SizeofCmsghdr          = C.sizeof_struct_cmsghdr
   190  	SizeofInet6Pktinfo     = C.sizeof_struct_in6_pktinfo
   191  	SizeofIPv6MTUInfo      = C.sizeof_struct_ip6_mtuinfo
   192  	SizeofICMPv6Filter     = C.sizeof_struct_icmp6_filter
   193  )
   194  
   195  // Ptrace requests
   196  
   197  const (
   198  	PTRACE_TRACEME = C.PT_TRACE_ME
   199  	PTRACE_CONT    = C.PT_CONTINUE
   200  	PTRACE_KILL    = C.PT_KILL
   201  )
   202  
   203  // Events (kqueue, kevent)
   204  
   205  type Kevent_t C.struct_kevent
   206  
   207  // Select
   208  
   209  type FdSet C.fd_set
   210  
   211  // Routing and interface messages
   212  
   213  const (
   214  	SizeofIfMsghdr         = C.sizeof_struct_if_msghdr
   215  	SizeofIfData           = C.sizeof_struct_if_data
   216  	SizeofIfaMsghdr        = C.sizeof_struct_ifa_msghdr
   217  	SizeofIfAnnounceMsghdr = C.sizeof_struct_if_announcemsghdr
   218  	SizeofRtMsghdr         = C.sizeof_struct_rt_msghdr
   219  	SizeofRtMetrics        = C.sizeof_struct_rt_metrics
   220  )
   221  
   222  type IfMsghdr C.struct_if_msghdr
   223  
   224  type IfData C.struct_if_data
   225  
   226  type IfaMsghdr C.struct_ifa_msghdr
   227  
   228  type IfAnnounceMsghdr C.struct_if_announcemsghdr
   229  
   230  type RtMsghdr C.struct_rt_msghdr
   231  
   232  type RtMetrics C.struct_rt_metrics
   233  
   234  type Mclpool C.struct_mclpool
   235  
   236  // Berkeley packet filter
   237  
   238  const (
   239  	SizeofBpfVersion = C.sizeof_struct_bpf_version
   240  	SizeofBpfStat    = C.sizeof_struct_bpf_stat
   241  	SizeofBpfProgram = C.sizeof_struct_bpf_program
   242  	SizeofBpfInsn    = C.sizeof_struct_bpf_insn
   243  	SizeofBpfHdr     = C.sizeof_struct_bpf_hdr
   244  )
   245  
   246  type BpfVersion C.struct_bpf_version
   247  
   248  type BpfStat C.struct_bpf_stat
   249  
   250  type BpfProgram C.struct_bpf_program
   251  
   252  type BpfInsn C.struct_bpf_insn
   253  
   254  type BpfHdr C.struct_bpf_hdr
   255  
   256  type BpfTimeval C.struct_bpf_timeval
   257  
   258  // Terminal handling
   259  
   260  type Termios C.struct_termios
   261  
   262  type Winsize C.struct_winsize
   263  
   264  type Ptmget C.struct_ptmget
   265  
   266  // fchmodat-like syscalls.
   267  
   268  const (
   269  	AT_FDCWD            = C.AT_FDCWD
   270  	AT_EACCESS          = C.AT_EACCESS
   271  	AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
   272  	AT_SYMLINK_FOLLOW   = C.AT_SYMLINK_FOLLOW
   273  	AT_REMOVEDIR        = C.AT_REMOVEDIR
   274  )
   275  
   276  // poll
   277  
   278  type PollFd C.struct_pollfd
   279  
   280  const (
   281  	POLLERR    = C.POLLERR
   282  	POLLHUP    = C.POLLHUP
   283  	POLLIN     = C.POLLIN
   284  	POLLNVAL   = C.POLLNVAL
   285  	POLLOUT    = C.POLLOUT
   286  	POLLPRI    = C.POLLPRI
   287  	POLLRDBAND = C.POLLRDBAND
   288  	POLLRDNORM = C.POLLRDNORM
   289  	POLLWRBAND = C.POLLWRBAND
   290  	POLLWRNORM = C.POLLWRNORM
   291  )
   292  
   293  // Sysctl
   294  
   295  type Sysctlnode C.struct_sysctlnode
   296  
   297  // Uname
   298  
   299  type Utsname C.struct_utsname
   300  
   301  // Uvmexp
   302  
   303  const SizeofUvmexp = C.sizeof_struct_uvmexp_sysctl
   304  
   305  type Uvmexp C.struct_uvmexp_sysctl
   306  
   307  // Clockinfo
   308  
   309  const SizeofClockinfo = C.sizeof_struct_clockinfo
   310  
   311  type Clockinfo C.struct_clockinfo