github.com/Aayushi-Bansal/sys@v0.0.0-20180118120756-90d962a959d8/unix/types_openbsd.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  // +build ignore
     6  
     7  /*
     8  Input to cgo -godefs.  See README.md
     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 unix
    15  
    16  /*
    17  #define KERNEL
    18  #include <dirent.h>
    19  #include <fcntl.h>
    20  #include <poll.h>
    21  #include <signal.h>
    22  #include <termios.h>
    23  #include <stdio.h>
    24  #include <unistd.h>
    25  #include <sys/param.h>
    26  #include <sys/types.h>
    27  #include <sys/event.h>
    28  #include <sys/mman.h>
    29  #include <sys/mount.h>
    30  #include <sys/ptrace.h>
    31  #include <sys/resource.h>
    32  #include <sys/select.h>
    33  #include <sys/signal.h>
    34  #include <sys/socket.h>
    35  #include <sys/stat.h>
    36  #include <sys/time.h>
    37  #include <sys/uio.h>
    38  #include <sys/un.h>
    39  #include <sys/utsname.h>
    40  #include <sys/wait.h>
    41  #include <net/bpf.h>
    42  #include <net/if.h>
    43  #include <net/if_dl.h>
    44  #include <net/route.h>
    45  #include <netinet/in.h>
    46  #include <netinet/icmp6.h>
    47  #include <netinet/tcp.h>
    48  
    49  enum {
    50  	sizeofPtr = sizeof(void*),
    51  };
    52  
    53  union sockaddr_all {
    54  	struct sockaddr s1;	// this one gets used for fields
    55  	struct sockaddr_in s2;	// these pad it out
    56  	struct sockaddr_in6 s3;
    57  	struct sockaddr_un s4;
    58  	struct sockaddr_dl s5;
    59  };
    60  
    61  struct sockaddr_any {
    62  	struct sockaddr addr;
    63  	char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
    64  };
    65  
    66  */
    67  import "C"
    68  
    69  // Machine characteristics; for internal use.
    70  
    71  const (
    72  	sizeofPtr      = C.sizeofPtr
    73  	sizeofShort    = C.sizeof_short
    74  	sizeofInt      = C.sizeof_int
    75  	sizeofLong     = C.sizeof_long
    76  	sizeofLongLong = C.sizeof_longlong
    77  )
    78  
    79  // Basic types
    80  
    81  type (
    82  	_C_short     C.short
    83  	_C_int       C.int
    84  	_C_long      C.long
    85  	_C_long_long C.longlong
    86  )
    87  
    88  // Time
    89  
    90  type Timespec C.struct_timespec
    91  
    92  type Timeval C.struct_timeval
    93  
    94  // Processes
    95  
    96  type Rusage C.struct_rusage
    97  
    98  type Rlimit C.struct_rlimit
    99  
   100  type _Gid_t C.gid_t
   101  
   102  // Files
   103  
   104  const ( // Directory mode bits
   105  	S_IFMT   = C.S_IFMT
   106  	S_IFIFO  = C.S_IFIFO
   107  	S_IFCHR  = C.S_IFCHR
   108  	S_IFDIR  = C.S_IFDIR
   109  	S_IFBLK  = C.S_IFBLK
   110  	S_IFREG  = C.S_IFREG
   111  	S_IFLNK  = C.S_IFLNK
   112  	S_IFSOCK = C.S_IFSOCK
   113  	S_ISUID  = C.S_ISUID
   114  	S_ISGID  = C.S_ISGID
   115  	S_ISVTX  = C.S_ISVTX
   116  	S_IRUSR  = C.S_IRUSR
   117  	S_IWUSR  = C.S_IWUSR
   118  	S_IXUSR  = C.S_IXUSR
   119  )
   120  
   121  type Stat_t C.struct_stat
   122  
   123  type Statfs_t C.struct_statfs
   124  
   125  type Flock_t C.struct_flock
   126  
   127  type Dirent C.struct_dirent
   128  
   129  type Fsid C.fsid_t
   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 _Socklen C.socklen_t
   152  
   153  type Linger C.struct_linger
   154  
   155  type Iovec C.struct_iovec
   156  
   157  type IPMreq C.struct_ip_mreq
   158  
   159  type IPv6Mreq C.struct_ipv6_mreq
   160  
   161  type Msghdr C.struct_msghdr
   162  
   163  type Cmsghdr C.struct_cmsghdr
   164  
   165  type Inet6Pktinfo C.struct_in6_pktinfo
   166  
   167  type IPv6MTUInfo C.struct_ip6_mtuinfo
   168  
   169  type ICMPv6Filter C.struct_icmp6_filter
   170  
   171  const (
   172  	SizeofSockaddrInet4    = C.sizeof_struct_sockaddr_in
   173  	SizeofSockaddrInet6    = C.sizeof_struct_sockaddr_in6
   174  	SizeofSockaddrAny      = C.sizeof_struct_sockaddr_any
   175  	SizeofSockaddrUnix     = C.sizeof_struct_sockaddr_un
   176  	SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
   177  	SizeofLinger           = C.sizeof_struct_linger
   178  	SizeofIPMreq           = C.sizeof_struct_ip_mreq
   179  	SizeofIPv6Mreq         = C.sizeof_struct_ipv6_mreq
   180  	SizeofMsghdr           = C.sizeof_struct_msghdr
   181  	SizeofCmsghdr          = C.sizeof_struct_cmsghdr
   182  	SizeofInet6Pktinfo     = C.sizeof_struct_in6_pktinfo
   183  	SizeofIPv6MTUInfo      = C.sizeof_struct_ip6_mtuinfo
   184  	SizeofICMPv6Filter     = C.sizeof_struct_icmp6_filter
   185  )
   186  
   187  // Ptrace requests
   188  
   189  const (
   190  	PTRACE_TRACEME = C.PT_TRACE_ME
   191  	PTRACE_CONT    = C.PT_CONTINUE
   192  	PTRACE_KILL    = C.PT_KILL
   193  )
   194  
   195  // Events (kqueue, kevent)
   196  
   197  type Kevent_t C.struct_kevent
   198  
   199  // Select
   200  
   201  type FdSet C.fd_set
   202  
   203  // Routing and interface messages
   204  
   205  const (
   206  	SizeofIfMsghdr         = C.sizeof_struct_if_msghdr
   207  	SizeofIfData           = C.sizeof_struct_if_data
   208  	SizeofIfaMsghdr        = C.sizeof_struct_ifa_msghdr
   209  	SizeofIfAnnounceMsghdr = C.sizeof_struct_if_announcemsghdr
   210  	SizeofRtMsghdr         = C.sizeof_struct_rt_msghdr
   211  	SizeofRtMetrics        = C.sizeof_struct_rt_metrics
   212  )
   213  
   214  type IfMsghdr C.struct_if_msghdr
   215  
   216  type IfData C.struct_if_data
   217  
   218  type IfaMsghdr C.struct_ifa_msghdr
   219  
   220  type IfAnnounceMsghdr C.struct_if_announcemsghdr
   221  
   222  type RtMsghdr C.struct_rt_msghdr
   223  
   224  type RtMetrics C.struct_rt_metrics
   225  
   226  type Mclpool C.struct_mclpool
   227  
   228  // Berkeley packet filter
   229  
   230  const (
   231  	SizeofBpfVersion = C.sizeof_struct_bpf_version
   232  	SizeofBpfStat    = C.sizeof_struct_bpf_stat
   233  	SizeofBpfProgram = C.sizeof_struct_bpf_program
   234  	SizeofBpfInsn    = C.sizeof_struct_bpf_insn
   235  	SizeofBpfHdr     = C.sizeof_struct_bpf_hdr
   236  )
   237  
   238  type BpfVersion C.struct_bpf_version
   239  
   240  type BpfStat C.struct_bpf_stat
   241  
   242  type BpfProgram C.struct_bpf_program
   243  
   244  type BpfInsn C.struct_bpf_insn
   245  
   246  type BpfHdr C.struct_bpf_hdr
   247  
   248  type BpfTimeval C.struct_bpf_timeval
   249  
   250  // Terminal handling
   251  
   252  type Termios C.struct_termios
   253  
   254  type Winsize C.struct_winsize
   255  
   256  // fchmodat-like syscalls.
   257  
   258  const (
   259  	AT_FDCWD            = C.AT_FDCWD
   260  	AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
   261  )
   262  
   263  // poll
   264  
   265  type PollFd C.struct_pollfd
   266  
   267  const (
   268  	POLLERR    = C.POLLERR
   269  	POLLHUP    = C.POLLHUP
   270  	POLLIN     = C.POLLIN
   271  	POLLNVAL   = C.POLLNVAL
   272  	POLLOUT    = C.POLLOUT
   273  	POLLPRI    = C.POLLPRI
   274  	POLLRDBAND = C.POLLRDBAND
   275  	POLLRDNORM = C.POLLRDNORM
   276  	POLLWRBAND = C.POLLWRBAND
   277  	POLLWRNORM = C.POLLWRNORM
   278  )
   279  
   280  // Uname
   281  
   282  type Utsname C.struct_utsname