David K. Bainbridge | e05cf0c | 2021-08-19 03:16:50 +0000 | [diff] [blame^] | 1 | // Copyright 2020 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 zos && s390x |
| 6 | // +build zos,s390x |
| 7 | |
| 8 | // Hand edited based on ztypes_linux_s390x.go |
| 9 | // TODO: auto-generate. |
| 10 | |
| 11 | package unix |
| 12 | |
| 13 | const ( |
| 14 | SizeofPtr = 0x8 |
| 15 | SizeofShort = 0x2 |
| 16 | SizeofInt = 0x4 |
| 17 | SizeofLong = 0x8 |
| 18 | SizeofLongLong = 0x8 |
| 19 | PathMax = 0x1000 |
| 20 | ) |
| 21 | |
| 22 | const ( |
| 23 | SizeofSockaddrAny = 128 |
| 24 | SizeofCmsghdr = 12 |
| 25 | SizeofIPMreq = 8 |
| 26 | SizeofIPv6Mreq = 20 |
| 27 | SizeofICMPv6Filter = 32 |
| 28 | SizeofIPv6MTUInfo = 32 |
| 29 | SizeofLinger = 8 |
| 30 | SizeofSockaddrInet4 = 16 |
| 31 | SizeofSockaddrInet6 = 28 |
| 32 | SizeofTCPInfo = 0x68 |
| 33 | ) |
| 34 | |
| 35 | type ( |
| 36 | _C_short int16 |
| 37 | _C_int int32 |
| 38 | _C_long int64 |
| 39 | _C_long_long int64 |
| 40 | ) |
| 41 | |
| 42 | type Timespec struct { |
| 43 | Sec int64 |
| 44 | Nsec int64 |
| 45 | } |
| 46 | |
| 47 | type Timeval struct { |
| 48 | Sec int64 |
| 49 | Usec int64 |
| 50 | } |
| 51 | |
| 52 | type timeval_zos struct { //correct (with padding and all) |
| 53 | Sec int64 |
| 54 | _ [4]byte // pad |
| 55 | Usec int32 |
| 56 | } |
| 57 | |
| 58 | type Tms struct { //clock_t is 4-byte unsigned int in zos |
| 59 | Utime uint32 |
| 60 | Stime uint32 |
| 61 | Cutime uint32 |
| 62 | Cstime uint32 |
| 63 | } |
| 64 | |
| 65 | type Time_t int64 |
| 66 | |
| 67 | type Utimbuf struct { |
| 68 | Actime int64 |
| 69 | Modtime int64 |
| 70 | } |
| 71 | |
| 72 | type Utsname struct { |
| 73 | Sysname [65]byte |
| 74 | Nodename [65]byte |
| 75 | Release [65]byte |
| 76 | Version [65]byte |
| 77 | Machine [65]byte |
| 78 | Domainname [65]byte |
| 79 | } |
| 80 | |
| 81 | type RawSockaddrInet4 struct { |
| 82 | Len uint8 |
| 83 | Family uint8 |
| 84 | Port uint16 |
| 85 | Addr [4]byte /* in_addr */ |
| 86 | Zero [8]uint8 |
| 87 | } |
| 88 | |
| 89 | type RawSockaddrInet6 struct { |
| 90 | Len uint8 |
| 91 | Family uint8 |
| 92 | Port uint16 |
| 93 | Flowinfo uint32 |
| 94 | Addr [16]byte /* in6_addr */ |
| 95 | Scope_id uint32 |
| 96 | } |
| 97 | |
| 98 | type RawSockaddrUnix struct { |
| 99 | Len uint8 |
| 100 | Family uint8 |
| 101 | Path [108]int8 |
| 102 | } |
| 103 | |
| 104 | type RawSockaddr struct { |
| 105 | Len uint8 |
| 106 | Family uint8 |
| 107 | Data [14]uint8 |
| 108 | } |
| 109 | |
| 110 | type RawSockaddrAny struct { |
| 111 | Addr RawSockaddr |
| 112 | _ [112]uint8 // pad |
| 113 | } |
| 114 | |
| 115 | type _Socklen uint32 |
| 116 | |
| 117 | type Linger struct { |
| 118 | Onoff int32 |
| 119 | Linger int32 |
| 120 | } |
| 121 | |
| 122 | type Iovec struct { |
| 123 | Base *byte |
| 124 | Len uint64 |
| 125 | } |
| 126 | |
| 127 | type IPMreq struct { |
| 128 | Multiaddr [4]byte /* in_addr */ |
| 129 | Interface [4]byte /* in_addr */ |
| 130 | } |
| 131 | |
| 132 | type IPv6Mreq struct { |
| 133 | Multiaddr [16]byte /* in6_addr */ |
| 134 | Interface uint32 |
| 135 | } |
| 136 | |
| 137 | type Msghdr struct { |
| 138 | Name *byte |
| 139 | Iov *Iovec |
| 140 | Control *byte |
| 141 | Flags int32 |
| 142 | Namelen int32 |
| 143 | Iovlen int32 |
| 144 | Controllen int32 |
| 145 | } |
| 146 | |
| 147 | type Cmsghdr struct { |
| 148 | Len int32 |
| 149 | Level int32 |
| 150 | Type int32 |
| 151 | } |
| 152 | |
| 153 | type Inet4Pktinfo struct { |
| 154 | Addr [4]byte /* in_addr */ |
| 155 | Ifindex uint32 |
| 156 | } |
| 157 | |
| 158 | type Inet6Pktinfo struct { |
| 159 | Addr [16]byte /* in6_addr */ |
| 160 | Ifindex uint32 |
| 161 | } |
| 162 | |
| 163 | type IPv6MTUInfo struct { |
| 164 | Addr RawSockaddrInet6 |
| 165 | Mtu uint32 |
| 166 | } |
| 167 | |
| 168 | type ICMPv6Filter struct { |
| 169 | Data [8]uint32 |
| 170 | } |
| 171 | |
| 172 | type TCPInfo struct { |
| 173 | State uint8 |
| 174 | Ca_state uint8 |
| 175 | Retransmits uint8 |
| 176 | Probes uint8 |
| 177 | Backoff uint8 |
| 178 | Options uint8 |
| 179 | Rto uint32 |
| 180 | Ato uint32 |
| 181 | Snd_mss uint32 |
| 182 | Rcv_mss uint32 |
| 183 | Unacked uint32 |
| 184 | Sacked uint32 |
| 185 | Lost uint32 |
| 186 | Retrans uint32 |
| 187 | Fackets uint32 |
| 188 | Last_data_sent uint32 |
| 189 | Last_ack_sent uint32 |
| 190 | Last_data_recv uint32 |
| 191 | Last_ack_recv uint32 |
| 192 | Pmtu uint32 |
| 193 | Rcv_ssthresh uint32 |
| 194 | Rtt uint32 |
| 195 | Rttvar uint32 |
| 196 | Snd_ssthresh uint32 |
| 197 | Snd_cwnd uint32 |
| 198 | Advmss uint32 |
| 199 | Reordering uint32 |
| 200 | Rcv_rtt uint32 |
| 201 | Rcv_space uint32 |
| 202 | Total_retrans uint32 |
| 203 | } |
| 204 | |
| 205 | type _Gid_t uint32 |
| 206 | |
| 207 | type rusage_zos struct { |
| 208 | Utime timeval_zos |
| 209 | Stime timeval_zos |
| 210 | } |
| 211 | |
| 212 | type Rusage struct { |
| 213 | Utime Timeval |
| 214 | Stime Timeval |
| 215 | Maxrss int64 |
| 216 | Ixrss int64 |
| 217 | Idrss int64 |
| 218 | Isrss int64 |
| 219 | Minflt int64 |
| 220 | Majflt int64 |
| 221 | Nswap int64 |
| 222 | Inblock int64 |
| 223 | Oublock int64 |
| 224 | Msgsnd int64 |
| 225 | Msgrcv int64 |
| 226 | Nsignals int64 |
| 227 | Nvcsw int64 |
| 228 | Nivcsw int64 |
| 229 | } |
| 230 | |
| 231 | type Rlimit struct { |
| 232 | Cur uint64 |
| 233 | Max uint64 |
| 234 | } |
| 235 | |
| 236 | // { int, short, short } in poll.h |
| 237 | type PollFd struct { |
| 238 | Fd int32 |
| 239 | Events int16 |
| 240 | Revents int16 |
| 241 | } |
| 242 | |
| 243 | type Stat_t struct { //Linux Definition |
| 244 | Dev uint64 |
| 245 | Ino uint64 |
| 246 | Nlink uint64 |
| 247 | Mode uint32 |
| 248 | Uid uint32 |
| 249 | Gid uint32 |
| 250 | _ int32 |
| 251 | Rdev uint64 |
| 252 | Size int64 |
| 253 | Atim Timespec |
| 254 | Mtim Timespec |
| 255 | Ctim Timespec |
| 256 | Blksize int64 |
| 257 | Blocks int64 |
| 258 | _ [3]int64 |
| 259 | } |
| 260 | |
| 261 | type Stat_LE_t struct { |
| 262 | _ [4]byte // eye catcher |
| 263 | Length uint16 |
| 264 | Version uint16 |
| 265 | Mode int32 |
| 266 | Ino uint32 |
| 267 | Dev uint32 |
| 268 | Nlink int32 |
| 269 | Uid int32 |
| 270 | Gid int32 |
| 271 | Size int64 |
| 272 | Atim31 [4]byte |
| 273 | Mtim31 [4]byte |
| 274 | Ctim31 [4]byte |
| 275 | Rdev uint32 |
| 276 | Auditoraudit uint32 |
| 277 | Useraudit uint32 |
| 278 | Blksize int32 |
| 279 | Creatim31 [4]byte |
| 280 | AuditID [16]byte |
| 281 | _ [4]byte // rsrvd1 |
| 282 | File_tag struct { |
| 283 | Ccsid uint16 |
| 284 | Txtflag uint16 // aggregating Txflag:1 deferred:1 rsvflags:14 |
| 285 | } |
| 286 | CharsetID [8]byte |
| 287 | Blocks int64 |
| 288 | Genvalue uint32 |
| 289 | Reftim31 [4]byte |
| 290 | Fid [8]byte |
| 291 | Filefmt byte |
| 292 | Fspflag2 byte |
| 293 | _ [2]byte // rsrvd2 |
| 294 | Ctimemsec int32 |
| 295 | Seclabel [8]byte |
| 296 | _ [4]byte // rsrvd3 |
| 297 | _ [4]byte // rsrvd4 |
| 298 | Atim Time_t |
| 299 | Mtim Time_t |
| 300 | Ctim Time_t |
| 301 | Creatim Time_t |
| 302 | Reftim Time_t |
| 303 | _ [24]byte // rsrvd5 |
| 304 | } |
| 305 | |
| 306 | type Statvfs_t struct { |
| 307 | ID [4]byte |
| 308 | Len int32 |
| 309 | Bsize uint64 |
| 310 | Blocks uint64 |
| 311 | Usedspace uint64 |
| 312 | Bavail uint64 |
| 313 | Flag uint64 |
| 314 | Maxfilesize int64 |
| 315 | _ [16]byte |
| 316 | Frsize uint64 |
| 317 | Bfree uint64 |
| 318 | Files uint32 |
| 319 | Ffree uint32 |
| 320 | Favail uint32 |
| 321 | Namemax31 uint32 |
| 322 | Invarsec uint32 |
| 323 | _ [4]byte |
| 324 | Fsid uint64 |
| 325 | Namemax uint64 |
| 326 | } |
| 327 | |
| 328 | type Statfs_t struct { |
| 329 | Type uint32 |
| 330 | Bsize uint64 |
| 331 | Blocks uint64 |
| 332 | Bfree uint64 |
| 333 | Bavail uint64 |
| 334 | Files uint32 |
| 335 | Ffree uint32 |
| 336 | Fsid uint64 |
| 337 | Namelen uint64 |
| 338 | Frsize uint64 |
| 339 | Flags uint64 |
| 340 | } |
| 341 | |
| 342 | type Dirent struct { |
| 343 | Reclen uint16 |
| 344 | Namlen uint16 |
| 345 | Ino uint32 |
| 346 | Extra uintptr |
| 347 | Name [256]byte |
| 348 | } |
| 349 | |
| 350 | type FdSet struct { |
| 351 | Bits [64]int32 |
| 352 | } |
| 353 | |
| 354 | // This struct is packed on z/OS so it can't be used directly. |
| 355 | type Flock_t struct { |
| 356 | Type int16 |
| 357 | Whence int16 |
| 358 | Start int64 |
| 359 | Len int64 |
| 360 | Pid int32 |
| 361 | } |
| 362 | |
| 363 | type Termios struct { |
| 364 | Cflag uint32 |
| 365 | Iflag uint32 |
| 366 | Lflag uint32 |
| 367 | Oflag uint32 |
| 368 | Cc [11]uint8 |
| 369 | } |
| 370 | |
| 371 | type Winsize struct { |
| 372 | Row uint16 |
| 373 | Col uint16 |
| 374 | Xpixel uint16 |
| 375 | Ypixel uint16 |
| 376 | } |
| 377 | |
| 378 | type W_Mnth struct { |
| 379 | Hid [4]byte |
| 380 | Size int32 |
| 381 | Cur1 int32 //32bit pointer |
| 382 | Cur2 int32 //^ |
| 383 | Devno uint32 |
| 384 | _ [4]byte |
| 385 | } |
| 386 | |
| 387 | type W_Mntent struct { |
| 388 | Fstype uint32 |
| 389 | Mode uint32 |
| 390 | Dev uint32 |
| 391 | Parentdev uint32 |
| 392 | Rootino uint32 |
| 393 | Status byte |
| 394 | Ddname [9]byte |
| 395 | Fstname [9]byte |
| 396 | Fsname [45]byte |
| 397 | Pathlen uint32 |
| 398 | Mountpoint [1024]byte |
| 399 | Jobname [8]byte |
| 400 | PID int32 |
| 401 | Parmoffset int32 |
| 402 | Parmlen int16 |
| 403 | Owner [8]byte |
| 404 | Quiesceowner [8]byte |
| 405 | _ [38]byte |
| 406 | } |