github.com/code-reading/golang@v0.0.0-20220303082512-ba5bc0e589a3/go/src/syscall/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 //go:build ignore 6 // +build ignore 7 8 /* 9 Input to cgo -godefs. See also mkerrors.sh and mkall.sh 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 syscall 16 17 /* 18 #define KERNEL 19 #include <dirent.h> 20 #include <fcntl.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/wait.h> 40 #include <net/bpf.h> 41 #include <net/if.h> 42 #include <net/if_dl.h> 43 #include <net/route.h> 44 #include <netinet/in.h> 45 #include <netinet/icmp6.h> 46 #include <netinet/tcp.h> 47 48 enum { 49 sizeofPtr = sizeof(void*), 50 }; 51 52 union sockaddr_all { 53 struct sockaddr s1; // this one gets used for fields 54 struct sockaddr_in s2; // these pad it out 55 struct sockaddr_in6 s3; 56 struct sockaddr_un s4; 57 struct sockaddr_dl s5; 58 }; 59 60 struct sockaddr_any { 61 struct sockaddr addr; 62 char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)]; 63 }; 64 65 */ 66 import "C" 67 68 // Machine characteristics; for internal use. 69 70 const ( 71 sizeofPtr = C.sizeofPtr 72 sizeofShort = C.sizeof_short 73 sizeofInt = C.sizeof_int 74 sizeofLong = C.sizeof_long 75 sizeofLongLong = C.sizeof_longlong 76 ) 77 78 // Basic types 79 80 type ( 81 _C_short C.short 82 _C_int C.int 83 _C_long C.long 84 _C_long_long C.longlong 85 ) 86 87 // Time 88 89 type Timespec C.struct_timespec 90 91 type Timeval C.struct_timeval 92 93 // Processes 94 95 type Rusage C.struct_rusage 96 97 type Rlimit C.struct_rlimit 98 99 type _Gid_t C.gid_t 100 101 // Files 102 103 const ( // Directory mode bits 104 S_IFMT = C.S_IFMT 105 S_IFIFO = C.S_IFIFO 106 S_IFCHR = C.S_IFCHR 107 S_IFDIR = C.S_IFDIR 108 S_IFBLK = C.S_IFBLK 109 S_IFREG = C.S_IFREG 110 S_IFLNK = C.S_IFLNK 111 S_IFSOCK = C.S_IFSOCK 112 S_ISUID = C.S_ISUID 113 S_ISGID = C.S_ISGID 114 S_ISVTX = C.S_ISVTX 115 S_IRUSR = C.S_IRUSR 116 S_IWUSR = C.S_IWUSR 117 S_IXUSR = C.S_IXUSR 118 S_IRWXG = C.S_IRWXG 119 S_IRWXO = C.S_IRWXO 120 ) 121 122 type Stat_t C.struct_stat 123 124 type Statfs_t C.struct_statfs 125 126 type Flock_t C.struct_flock 127 128 type Dirent C.struct_dirent 129 130 type Fsid C.fsid_t 131 132 // File system limits 133 134 const ( 135 pathMax = C.PATH_MAX 136 ) 137 138 // Sockets 139 140 type RawSockaddrInet4 C.struct_sockaddr_in 141 142 type RawSockaddrInet6 C.struct_sockaddr_in6 143 144 type RawSockaddrUnix C.struct_sockaddr_un 145 146 type RawSockaddrDatalink C.struct_sockaddr_dl 147 148 type RawSockaddr C.struct_sockaddr 149 150 type RawSockaddrAny C.struct_sockaddr_any 151 152 type _Socklen C.socklen_t 153 154 type Linger C.struct_linger 155 156 type Iovec C.struct_iovec 157 158 type IPMreq C.struct_ip_mreq 159 160 type IPv6Mreq C.struct_ipv6_mreq 161 162 type Msghdr C.struct_msghdr 163 164 type Cmsghdr C.struct_cmsghdr 165 166 type Inet6Pktinfo C.struct_in6_pktinfo 167 168 type IPv6MTUInfo C.struct_ip6_mtuinfo 169 170 type ICMPv6Filter C.struct_icmp6_filter 171 172 const ( 173 SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in 174 SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 175 SizeofSockaddrAny = C.sizeof_struct_sockaddr_any 176 SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un 177 SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl 178 SizeofLinger = C.sizeof_struct_linger 179 SizeofIPMreq = C.sizeof_struct_ip_mreq 180 SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq 181 SizeofMsghdr = C.sizeof_struct_msghdr 182 SizeofCmsghdr = C.sizeof_struct_cmsghdr 183 SizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo 184 SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo 185 SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter 186 ) 187 188 // Ptrace requests 189 190 const ( 191 PTRACE_TRACEME = C.PT_TRACE_ME 192 PTRACE_CONT = C.PT_CONTINUE 193 PTRACE_KILL = C.PT_KILL 194 ) 195 196 // Events (kqueue, kevent) 197 198 type Kevent_t C.struct_kevent 199 200 // Select 201 202 type FdSet C.fd_set 203 204 // Routing and interface messages 205 206 const ( 207 SizeofIfMsghdr = C.sizeof_struct_if_msghdr 208 SizeofIfData = C.sizeof_struct_if_data 209 SizeofIfaMsghdr = C.sizeof_struct_ifa_msghdr 210 SizeofIfAnnounceMsghdr = C.sizeof_struct_if_announcemsghdr 211 SizeofRtMsghdr = C.sizeof_struct_rt_msghdr 212 SizeofRtMetrics = C.sizeof_struct_rt_metrics 213 ) 214 215 type IfMsghdr C.struct_if_msghdr 216 217 type IfData C.struct_if_data 218 219 type IfaMsghdr C.struct_ifa_msghdr 220 221 type IfAnnounceMsghdr C.struct_if_announcemsghdr 222 223 type RtMsghdr C.struct_rt_msghdr 224 225 type RtMetrics C.struct_rt_metrics 226 227 type Mclpool C.struct_mclpool 228 229 // Berkeley packet filter 230 231 const ( 232 SizeofBpfVersion = C.sizeof_struct_bpf_version 233 SizeofBpfStat = C.sizeof_struct_bpf_stat 234 SizeofBpfProgram = C.sizeof_struct_bpf_program 235 SizeofBpfInsn = C.sizeof_struct_bpf_insn 236 SizeofBpfHdr = C.sizeof_struct_bpf_hdr 237 ) 238 239 type BpfVersion C.struct_bpf_version 240 241 type BpfStat C.struct_bpf_stat 242 243 type BpfProgram C.struct_bpf_program 244 245 type BpfInsn C.struct_bpf_insn 246 247 type BpfHdr C.struct_bpf_hdr 248 249 type BpfTimeval C.struct_bpf_timeval 250 251 // Misc 252 253 const ( 254 _AT_FDCWD = C.AT_FDCWD 255 ) 256 257 // Terminal handling 258 259 type Termios C.struct_termios