1
2
3
4
5
6 package unix
7
8 const (
9 SizeofPtr = 0x8
10 SizeofShort = 0x2
11 SizeofInt = 0x4
12 SizeofLong = 0x8
13 SizeofLongLong = 0x8
14 )
15
16 type (
17 _C_short int16
18 _C_int int32
19 _C_long int64
20 _C_long_long int64
21 )
22
23 type Timespec struct {
24 Sec int64
25 Nsec int64
26 }
27
28 type Timeval struct {
29 Sec int64
30 Usec int64
31 }
32
33 type Rusage struct {
34 Utime Timeval
35 Stime Timeval
36 Maxrss int64
37 Ixrss int64
38 Idrss int64
39 Isrss int64
40 Minflt int64
41 Majflt int64
42 Nswap int64
43 Inblock int64
44 Oublock int64
45 Msgsnd int64
46 Msgrcv int64
47 Nsignals int64
48 Nvcsw int64
49 Nivcsw int64
50 }
51
52 type Rlimit struct {
53 Cur int64
54 Max int64
55 }
56
57 type _Gid_t uint32
58
59 type Stat_t struct {
60 Ino uint64
61 Nlink uint32
62 Dev uint32
63 Mode uint16
64 _1 uint16
65 Uid uint32
66 Gid uint32
67 Rdev uint32
68 Atim Timespec
69 Mtim Timespec
70 Ctim Timespec
71 Size int64
72 Blocks int64
73 _ uint32
74 Flags uint32
75 Gen uint32
76 Lspare int32
77 Blksize int64
78 Qspare2 int64
79 }
80
81 type Statfs_t struct {
82 Spare2 int64
83 Bsize int64
84 Iosize int64
85 Blocks int64
86 Bfree int64
87 Bavail int64
88 Files int64
89 Ffree int64
90 Fsid Fsid
91 Owner uint32
92 Type int32
93 Flags int32
94 Syncwrites int64
95 Asyncwrites int64
96 Fstypename [16]byte
97 Mntonname [80]byte
98 Syncreads int64
99 Asyncreads int64
100 Spares1 int16
101 Mntfromname [80]byte
102 Spares2 int16
103 Spare [2]int64
104 }
105
106 type Flock_t struct {
107 Start int64
108 Len int64
109 Pid int32
110 Type int16
111 Whence int16
112 }
113
114 type Dirent struct {
115 Fileno uint64
116 Namlen uint16
117 Type uint8
118 Unused1 uint8
119 Unused2 uint32
120 Name [256]int8
121 }
122
123 type Fsid struct {
124 Val [2]int32
125 }
126
127 const (
128 PathMax = 0x400
129 )
130
131 type RawSockaddrInet4 struct {
132 Len uint8
133 Family uint8
134 Port uint16
135 Addr [4]byte
136 Zero [8]int8
137 }
138
139 type RawSockaddrInet6 struct {
140 Len uint8
141 Family uint8
142 Port uint16
143 Flowinfo uint32
144 Addr [16]byte
145 Scope_id uint32
146 }
147
148 type RawSockaddrUnix struct {
149 Len uint8
150 Family uint8
151 Path [104]int8
152 }
153
154 type RawSockaddrDatalink struct {
155 Len uint8
156 Family uint8
157 Index uint16
158 Type uint8
159 Nlen uint8
160 Alen uint8
161 Slen uint8
162 Data [12]int8
163 Rcf uint16
164 Route [16]uint16
165 }
166
167 type RawSockaddr struct {
168 Len uint8
169 Family uint8
170 Data [14]int8
171 }
172
173 type RawSockaddrAny struct {
174 Addr RawSockaddr
175 Pad [92]int8
176 }
177
178 type _Socklen uint32
179
180 type Linger struct {
181 Onoff int32
182 Linger int32
183 }
184
185 type Iovec struct {
186 Base *byte
187 Len uint64
188 }
189
190 type IPMreq struct {
191 Multiaddr [4]byte
192 Interface [4]byte
193 }
194
195 type IPv6Mreq struct {
196 Multiaddr [16]byte
197 Interface uint32
198 }
199
200 type Msghdr struct {
201 Name *byte
202 Namelen uint32
203 Iov *Iovec
204 Iovlen int32
205 Control *byte
206 Controllen uint32
207 Flags int32
208 }
209
210 type Cmsghdr struct {
211 Len uint32
212 Level int32
213 Type int32
214 }
215
216 type Inet6Pktinfo struct {
217 Addr [16]byte
218 Ifindex uint32
219 }
220
221 type IPv6MTUInfo struct {
222 Addr RawSockaddrInet6
223 Mtu uint32
224 }
225
226 type ICMPv6Filter struct {
227 Filt [8]uint32
228 }
229
230 const (
231 SizeofSockaddrInet4 = 0x10
232 SizeofSockaddrInet6 = 0x1c
233 SizeofSockaddrAny = 0x6c
234 SizeofSockaddrUnix = 0x6a
235 SizeofSockaddrDatalink = 0x36
236 SizeofLinger = 0x8
237 SizeofIovec = 0x10
238 SizeofIPMreq = 0x8
239 SizeofIPv6Mreq = 0x14
240 SizeofMsghdr = 0x30
241 SizeofCmsghdr = 0xc
242 SizeofInet6Pktinfo = 0x14
243 SizeofIPv6MTUInfo = 0x20
244 SizeofICMPv6Filter = 0x20
245 )
246
247 const (
248 PTRACE_TRACEME = 0x0
249 PTRACE_CONT = 0x7
250 PTRACE_KILL = 0x8
251 )
252
253 type Kevent_t struct {
254 Ident uint64
255 Filter int16
256 Flags uint16
257 Fflags uint32
258 Data int64
259 Udata *byte
260 }
261
262 type FdSet struct {
263 Bits [16]uint64
264 }
265
266 const (
267 SizeofIfMsghdr = 0xb0
268 SizeofIfData = 0xa0
269 SizeofIfaMsghdr = 0x18
270 SizeofIfmaMsghdr = 0x10
271 SizeofIfAnnounceMsghdr = 0x18
272 SizeofRtMsghdr = 0x98
273 SizeofRtMetrics = 0x70
274 )
275
276 type IfMsghdr struct {
277 Msglen uint16
278 Version uint8
279 Type uint8
280 Index uint16
281 Flags int32
282 Addrs int32
283 Data IfData
284 }
285
286 type IfData struct {
287 Type uint8
288 Physical uint8
289 Addrlen uint8
290 Hdrlen uint8
291 Recvquota uint8
292 Xmitquota uint8
293 Mtu uint64
294 Metric uint64
295 Link_state uint64
296 Baudrate uint64
297 Ipackets uint64
298 Ierrors uint64
299 Opackets uint64
300 Oerrors uint64
301 Collisions uint64
302 Ibytes uint64
303 Obytes uint64
304 Imcasts uint64
305 Omcasts uint64
306 Iqdrops uint64
307 Noproto uint64
308 Hwassist uint64
309 Oqdrops uint64
310 Lastchange Timeval
311 }
312
313 type IfaMsghdr struct {
314 Msglen uint16
315 Version uint8
316 Type uint8
317 Index uint16
318 Flags int32
319 Addrs int32
320 Addrflags int32
321 Metric int32
322 }
323
324 type IfmaMsghdr struct {
325 Msglen uint16
326 Version uint8
327 Type uint8
328 Index uint16
329 Flags int32
330 Addrs int32
331 }
332
333 type IfAnnounceMsghdr struct {
334 Msglen uint16
335 Version uint8
336 Type uint8
337 Index uint16
338 Name [16]int8
339 What uint16
340 }
341
342 type RtMsghdr struct {
343 Msglen uint16
344 Version uint8
345 Type uint8
346 Index uint16
347 Flags int32
348 Addrs int32
349 Pid int32
350 Seq int32
351 Errno int32
352 Use int32
353 Inits uint64
354 Rmx RtMetrics
355 }
356
357 type RtMetrics struct {
358 Locks uint64
359 Mtu uint64
360 Pksent uint64
361 Expire uint64
362 Sendpipe uint64
363 Ssthresh uint64
364 Rtt uint64
365 Rttvar uint64
366 Recvpipe uint64
367 Hopcount uint64
368 Mssopt uint16
369 Pad uint16
370 Msl uint64
371 Iwmaxsegs uint64
372 Iwcapsegs uint64
373 }
374
375 const (
376 SizeofBpfVersion = 0x4
377 SizeofBpfStat = 0x8
378 SizeofBpfProgram = 0x10
379 SizeofBpfInsn = 0x8
380 SizeofBpfHdr = 0x20
381 )
382
383 type BpfVersion struct {
384 Major uint16
385 Minor uint16
386 }
387
388 type BpfStat struct {
389 Recv uint32
390 Drop uint32
391 }
392
393 type BpfProgram struct {
394 Len uint32
395 Insns *BpfInsn
396 }
397
398 type BpfInsn struct {
399 Code uint16
400 Jt uint8
401 Jf uint8
402 K uint32
403 }
404
405 type BpfHdr struct {
406 Tstamp Timeval
407 Caplen uint32
408 Datalen uint32
409 Hdrlen uint16
410 _ [6]byte
411 }
412
413 type Termios struct {
414 Iflag uint32
415 Oflag uint32
416 Cflag uint32
417 Lflag uint32
418 Cc [20]uint8
419 Ispeed uint32
420 Ospeed uint32
421 }
422
423 type Winsize struct {
424 Row uint16
425 Col uint16
426 Xpixel uint16
427 Ypixel uint16
428 }
429
430 const (
431 AT_FDCWD = 0xfffafdcd
432 AT_SYMLINK_NOFOLLOW = 0x1
433 AT_REMOVEDIR = 0x2
434 AT_EACCESS = 0x4
435 AT_SYMLINK_FOLLOW = 0x8
436 )
437
438 type PollFd struct {
439 Fd int32
440 Events int16
441 Revents int16
442 }
443
444 const (
445 POLLERR = 0x8
446 POLLHUP = 0x10
447 POLLIN = 0x1
448 POLLNVAL = 0x20
449 POLLOUT = 0x4
450 POLLPRI = 0x2
451 POLLRDBAND = 0x80
452 POLLRDNORM = 0x40
453 POLLWRBAND = 0x100
454 POLLWRNORM = 0x4
455 )
456
457 type Utsname struct {
458 Sysname [32]byte
459 Nodename [32]byte
460 Release [32]byte
461 Version [32]byte
462 Machine [32]byte
463 }
464
465 const SizeofClockinfo = 0x14
466
467 type Clockinfo struct {
468 Hz int32
469 Tick int32
470 Tickadj int32
471 Stathz int32
472 Profhz int32
473 }
474
View as plain text