Browse code

Simplify Utsname string conversion

Update golang.org/x/sys to 95c6576299259db960f6c5b9b69ea52422860fce in
order to get the unix.Utsname with byte array instead of int8/uint8
members.

This allows to use simple byte slice to string conversions instead of
using charsToString or its open-coded version.

Also see golang/go#20753 for details.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>

Tobias Klauser authored on 2017/10/31 18:32:03
Showing 122 changed files
... ...
@@ -17,18 +17,8 @@ func GetKernelVersion() (*VersionInfo, error) {
17 17
 		return nil, err
18 18
 	}
19 19
 
20
-	release := make([]byte, len(uts.Release))
21
-
22
-	i := 0
23
-	for _, c := range uts.Release {
24
-		release[i] = byte(c)
25
-		i++
26
-	}
27
-
28 20
 	// Remove the \x00 from the release for Atoi to parse correctly
29
-	release = release[:bytes.IndexByte(release, 0)]
30
-
31
-	return ParseRelease(string(release))
21
+	return ParseRelease(string(uts.Release[:bytes.IndexByte(uts.Release[:], 0)]))
32 22
 }
33 23
 
34 24
 // CheckKernelVersion checks if current kernel is newer than (or equal to)
... ...
@@ -3,6 +3,8 @@
3 3
 package platform
4 4
 
5 5
 import (
6
+	"bytes"
7
+
6 8
 	"golang.org/x/sys/unix"
7 9
 )
8 10
 
... ...
@@ -12,5 +14,5 @@ func runtimeArchitecture() (string, error) {
12 12
 	if err := unix.Uname(utsname); err != nil {
13 13
 		return "", err
14 14
 	}
15
-	return charsToString(utsname.Machine), nil
15
+	return string(utsname.Machine[:bytes.IndexByte(utsname.Machine[:], 0)]), nil
16 16
 }
17 17
deleted file mode 100644
... ...
@@ -1,18 +0,0 @@
1
-// +build linux,386 linux,amd64 linux,arm64 s390x
2
-// see golang's sources golang.org/x/sys/unix/ztypes_linux_*.go that use int8
3
-
4
-package platform
5
-
6
-// Convert the OS/ARCH-specific utsname.Machine to string
7
-// given as an array of signed int8
8
-func charsToString(ca [65]int8) string {
9
-	s := make([]byte, len(ca))
10
-	var lens int
11
-	for ; lens < len(ca); lens++ {
12
-		if ca[lens] == 0 {
13
-			break
14
-		}
15
-		s[lens] = uint8(ca[lens])
16
-	}
17
-	return string(s[0:lens])
18
-}
19 1
deleted file mode 100644
... ...
@@ -1,16 +0,0 @@
1
-// +build linux,386 linux,amd64 linux,arm64 s390x
2
-
3
-package platform
4
-
5
-import (
6
-	"testing"
7
-
8
-	"github.com/stretchr/testify/assert"
9
-)
10
-
11
-func TestCharToString(t *testing.T) {
12
-	machineInBytes := [65]int8{120, 56, 54, 95, 54, 52}
13
-	machineInString := charsToString(machineInBytes)
14
-	assert.NotNil(t, machineInString, "Unable to convert char into string.")
15
-	assert.Equal(t, string("x86_64"), machineInString, "Parsed machine code not equal.")
16
-}
17 1
deleted file mode 100644
... ...
@@ -1,18 +0,0 @@
1
-// +build linux,arm linux,ppc64 linux,ppc64le
2
-// see golang's sources golang.org/x/sys/unix/ztypes_linux_*.go that use uint8
3
-
4
-package platform
5
-
6
-// Convert the OS/ARCH-specific utsname.Machine to string
7
-// given as an array of unsigned uint8
8
-func charsToString(ca [65]uint8) string {
9
-	s := make([]byte, len(ca))
10
-	var lens int
11
-	for ; lens < len(ca); lens++ {
12
-		if ca[lens] == 0 {
13
-			break
14
-		}
15
-		s[lens] = ca[lens]
16
-	}
17
-	return string(s[0:lens])
18
-}
19 1
deleted file mode 100644
... ...
@@ -1,16 +0,0 @@
1
-// +build linux,arm linux,ppc64 linux,ppc64le
2
-
3
-package platform
4
-
5
-import (
6
-	"testing"
7
-
8
-	"github.com/stretchr/testify/assert"
9
-)
10
-
11
-func TestTestCharToString(t *testing.T) {
12
-	machineInBytes := [65]uint8{120, 56, 54, 95, 54, 52}
13
-	machineInString := charsToString(machineInBytes)
14
-	assert.NotNil(t, machineInString, "Unable to convert char into string.")
15
-	assert.Equal(t, string("x86_64"), machineInString, "Parsed machine code not equal.")
16
-}
... ...
@@ -14,7 +14,7 @@ github.com/sirupsen/logrus v1.0.3
14 14
 github.com/tchap/go-patricia v2.2.6
15 15
 github.com/vdemeester/shakers 24d7f1d6a71aa5d9cbe7390e4afb66b7eef9e1b3
16 16
 golang.org/x/net 7dcfb8076726a3fdd9353b6b8a1f1b6be6811bd6
17
-golang.org/x/sys 8dbc5d05d6edcc104950cc299a1ce6641235bc86
17
+golang.org/x/sys 95c6576299259db960f6c5b9b69ea52422860fce
18 18
 github.com/docker/go-units 9e638d38cf6977a37a8ea0078f3ee75a7cdb2dd1
19 19
 github.com/docker/go-connections 3ede32e2033de7505e6500d6c868c2b9ed9f169d
20 20
 golang.org/x/text f72d8390a633d5dfb0cc84043294db9f6c935756
... ...
@@ -1,4 +1,4 @@
1
-// Copyright 2010 The Go Authors.  All rights reserved.
1
+// Copyright 2010 The Go Authors. All rights reserved.
2 2
 // Use of this source code is governed by a BSD-style
3 3
 // license that can be found in the LICENSE file.
4 4
 
... ...
@@ -1,4 +1,4 @@
1
-// Copyright 2014 The Go Authors.  All rights reserved.
1
+// Copyright 2014 The Go Authors. All rights reserved.
2 2
 // Use of this source code is governed by a BSD-style
3 3
 // license that can be found in the LICENSE file.
4 4
 
... ...
@@ -1,4 +1,4 @@
1
-// Copyright 2015 The Go Authors.  All rights reserved.
1
+// Copyright 2015 The Go Authors. All rights reserved.
2 2
 // Use of this source code is governed by a BSD-style
3 3
 // license that can be found in the LICENSE file.
4 4
 
... ...
@@ -8,7 +8,7 @@ package unix
8 8
 
9 9
 import "syscall"
10 10
 
11
-// We can't use the gc-syntax .s files for gccgo.  On the plus side
11
+// We can't use the gc-syntax .s files for gccgo. On the plus side
12 12
 // much of the functionality can be written directly in Go.
13 13
 
14 14
 //extern gccgoRealSyscall
... ...
@@ -1,4 +1,4 @@
1
-// Copyright 2015 The Go Authors.  All rights reserved.
1
+// Copyright 2015 The Go Authors. All rights reserved.
2 2
 // Use of this source code is governed by a BSD-style
3 3
 // license that can be found in the LICENSE file.
4 4
 
... ...
@@ -1,4 +1,4 @@
1
-// Copyright 2015 The Go Authors.  All rights reserved.
1
+// Copyright 2015 The Go Authors. All rights reserved.
2 2
 // Use of this source code is governed by a BSD-style
3 3
 // license that can be found in the LICENSE file.
4 4
 
... ...
@@ -1,4 +1,4 @@
1
-// Copyright 2017 The Go Authors.  All rights reserved.
1
+// Copyright 2017 The Go Authors. All rights reserved.
2 2
 // Use of this source code is governed by a BSD-style
3 3
 // license that can be found in the LICENSE file.
4 4
 
... ...
@@ -1,4 +1,4 @@
1
-// Copyright 2012 The Go Authors.  All rights reserved.
1
+// Copyright 2012 The Go Authors. All rights reserved.
2 2
 // Use of this source code is governed by a BSD-style
3 3
 // license that can be found in the LICENSE file.
4 4
 
... ...
@@ -1,4 +1,4 @@
1
-// Copyright 2012 The Go Authors.  All rights reserved.
1
+// Copyright 2012 The Go Authors. All rights reserved.
2 2
 // Use of this source code is governed by a BSD-style
3 3
 // license that can be found in the LICENSE file.
4 4
 
... ...
@@ -1,4 +1,4 @@
1
-// Copyright 2011 The Go Authors.  All rights reserved.
1
+// Copyright 2011 The Go Authors. All rights reserved.
2 2
 // Use of this source code is governed by a BSD-style
3 3
 // license that can be found in the LICENSE file.
4 4
 
... ...
@@ -5,10 +5,10 @@
5 5
 // +build darwin dragonfly freebsd linux netbsd openbsd solaris
6 6
 
7 7
 // Package unix contains an interface to the low-level operating system
8
-// primitives.  OS details vary depending on the underlying system, and
8
+// primitives. OS details vary depending on the underlying system, and
9 9
 // by default, godoc will display OS-specific documentation for the current
10
-// system.  If you want godoc to display OS documentation for another
11
-// system, set $GOOS and $GOARCH to the desired system.  For example, if
10
+// system. If you want godoc to display OS documentation for another
11
+// system, set $GOOS and $GOARCH to the desired system. For example, if
12 12
 // you want to view documentation for freebsd/arm on linux/amd64, set $GOOS
13 13
 // to freebsd and $GOARCH to arm.
14 14
 // The primary use of this package is inside other packages that provide a more
... ...
@@ -49,21 +49,3 @@ func BytePtrFromString(s string) (*byte, error) {
49 49
 // Single-word zero for use when we need a valid pointer to 0 bytes.
50 50
 // See mkunix.pl.
51 51
 var _zero uintptr
52
-
53
-func (ts *Timespec) Unix() (sec int64, nsec int64) {
54
-	return int64(ts.Sec), int64(ts.Nsec)
55
-}
56
-
57
-func (tv *Timeval) Unix() (sec int64, nsec int64) {
58
-	return int64(tv.Sec), int64(tv.Usec) * 1000
59
-}
60
-
61
-func (ts *Timespec) Nano() int64 {
62
-	return int64(ts.Sec)*1e9 + int64(ts.Nsec)
63
-}
64
-
65
-func (tv *Timeval) Nano() int64 {
66
-	return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000
67
-}
68
-
69
-func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
... ...
@@ -34,7 +34,7 @@ func Getgroups() (gids []int, err error) {
34 34
 		return nil, nil
35 35
 	}
36 36
 
37
-	// Sanity check group count.  Max is 16 on BSD.
37
+	// Sanity check group count. Max is 16 on BSD.
38 38
 	if n < 0 || n > 1000 {
39 39
 		return nil, EINVAL
40 40
 	}
... ...
@@ -607,6 +607,15 @@ func Futimes(fd int, tv []Timeval) error {
607 607
 
608 608
 //sys	fcntl(fd int, cmd int, arg int) (val int, err error)
609 609
 
610
+//sys   poll(fds *PollFd, nfds int, timeout int) (n int, err error)
611
+
612
+func Poll(fds []PollFd, timeout int) (n int, err error) {
613
+	if len(fds) == 0 {
614
+		return poll(nil, 0, timeout)
615
+	}
616
+	return poll(&fds[0], len(fds), timeout)
617
+}
618
+
610 619
 // TODO: wrap
611 620
 //	Acct(name nil-string) (err error)
612 621
 //	Gethostuuid(uuid *byte, timeout *Timespec) (err error)
... ...
@@ -54,7 +54,7 @@ func nametomib(name string) (mib []_C_int, err error) {
54 54
 
55 55
 	// NOTE(rsc): It seems strange to set the buffer to have
56 56
 	// size CTL_MAXNAME+2 but use only CTL_MAXNAME
57
-	// as the size.  I don't know why the +2 is here, but the
57
+	// as the size. I don't know why the +2 is here, but the
58 58
 	// kernel uses +2 for its own implementation of this function.
59 59
 	// I am scared that if we don't include the +2 here, the kernel
60 60
 	// will silently write 2 words farther than we specify
... ...
@@ -377,7 +377,6 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
377 377
 // Searchfs
378 378
 // Delete
379 379
 // Copyfile
380
-// Poll
381 380
 // Watchevent
382 381
 // Waitevent
383 382
 // Modwatch
... ...
@@ -11,25 +11,18 @@ import (
11 11
 	"unsafe"
12 12
 )
13 13
 
14
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
15
-
16
-func NsecToTimespec(nsec int64) (ts Timespec) {
17
-	ts.Sec = int32(nsec / 1e9)
18
-	ts.Nsec = int32(nsec % 1e9)
19
-	return
14
+func setTimespec(sec, nsec int64) Timespec {
15
+	return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
20 16
 }
21 17
 
22
-func NsecToTimeval(nsec int64) (tv Timeval) {
23
-	nsec += 999 // round up to microsecond
24
-	tv.Usec = int32(nsec % 1e9 / 1e3)
25
-	tv.Sec = int32(nsec / 1e9)
26
-	return
18
+func setTimeval(sec, usec int64) Timeval {
19
+	return Timeval{Sec: int32(sec), Usec: int32(usec)}
27 20
 }
28 21
 
29 22
 //sysnb	gettimeofday(tp *Timeval) (sec int32, usec int32, err error)
30 23
 func Gettimeofday(tv *Timeval) (err error) {
31 24
 	// The tv passed to gettimeofday must be non-nil
32
-	// but is otherwise unused.  The answers come back
25
+	// but is otherwise unused. The answers come back
33 26
 	// in the two registers.
34 27
 	sec, usec, err := gettimeofday(tv)
35 28
 	tv.Sec = int32(sec)
... ...
@@ -11,25 +11,18 @@ import (
11 11
 	"unsafe"
12 12
 )
13 13
 
14
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
15
-
16
-func NsecToTimespec(nsec int64) (ts Timespec) {
17
-	ts.Sec = nsec / 1e9
18
-	ts.Nsec = nsec % 1e9
19
-	return
14
+func setTimespec(sec, nsec int64) Timespec {
15
+	return Timespec{Sec: sec, Nsec: nsec}
20 16
 }
21 17
 
22
-func NsecToTimeval(nsec int64) (tv Timeval) {
23
-	nsec += 999 // round up to microsecond
24
-	tv.Usec = int32(nsec % 1e9 / 1e3)
25
-	tv.Sec = int64(nsec / 1e9)
26
-	return
18
+func setTimeval(sec, usec int64) Timeval {
19
+	return Timeval{Sec: sec, Usec: int32(usec)}
27 20
 }
28 21
 
29 22
 //sysnb	gettimeofday(tp *Timeval) (sec int64, usec int32, err error)
30 23
 func Gettimeofday(tv *Timeval) (err error) {
31 24
 	// The tv passed to gettimeofday must be non-nil
32
-	// but is otherwise unused.  The answers come back
25
+	// but is otherwise unused. The answers come back
33 26
 	// in the two registers.
34 27
 	sec, usec, err := gettimeofday(tv)
35 28
 	tv.Sec = sec
... ...
@@ -9,25 +9,18 @@ import (
9 9
 	"unsafe"
10 10
 )
11 11
 
12
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
13
-
14
-func NsecToTimespec(nsec int64) (ts Timespec) {
15
-	ts.Sec = int32(nsec / 1e9)
16
-	ts.Nsec = int32(nsec % 1e9)
17
-	return
12
+func setTimespec(sec, nsec int64) Timespec {
13
+	return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
18 14
 }
19 15
 
20
-func NsecToTimeval(nsec int64) (tv Timeval) {
21
-	nsec += 999 // round up to microsecond
22
-	tv.Usec = int32(nsec % 1e9 / 1e3)
23
-	tv.Sec = int32(nsec / 1e9)
24
-	return
16
+func setTimeval(sec, usec int64) Timeval {
17
+	return Timeval{Sec: int32(sec), Usec: int32(usec)}
25 18
 }
26 19
 
27 20
 //sysnb	gettimeofday(tp *Timeval) (sec int32, usec int32, err error)
28 21
 func Gettimeofday(tv *Timeval) (err error) {
29 22
 	// The tv passed to gettimeofday must be non-nil
30
-	// but is otherwise unused.  The answers come back
23
+	// but is otherwise unused. The answers come back
31 24
 	// in the two registers.
32 25
 	sec, usec, err := gettimeofday(tv)
33 26
 	tv.Sec = int32(sec)
... ...
@@ -11,25 +11,18 @@ import (
11 11
 	"unsafe"
12 12
 )
13 13
 
14
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
15
-
16
-func NsecToTimespec(nsec int64) (ts Timespec) {
17
-	ts.Sec = nsec / 1e9
18
-	ts.Nsec = nsec % 1e9
19
-	return
14
+func setTimespec(sec, nsec int64) Timespec {
15
+	return Timespec{Sec: sec, Nsec: nsec}
20 16
 }
21 17
 
22
-func NsecToTimeval(nsec int64) (tv Timeval) {
23
-	nsec += 999 // round up to microsecond
24
-	tv.Usec = int32(nsec % 1e9 / 1e3)
25
-	tv.Sec = int64(nsec / 1e9)
26
-	return
18
+func setTimeval(sec, usec int64) Timeval {
19
+	return Timeval{Sec: sec, Usec: int32(usec)}
27 20
 }
28 21
 
29 22
 //sysnb	gettimeofday(tp *Timeval) (sec int64, usec int32, err error)
30 23
 func Gettimeofday(tv *Timeval) (err error) {
31 24
 	// The tv passed to gettimeofday must be non-nil
32
-	// but is otherwise unused.  The answers come back
25
+	// but is otherwise unused. The answers come back
33 26
 	// in the two registers.
34 27
 	sec, usec, err := gettimeofday(tv)
35 28
 	tv.Sec = sec
... ...
@@ -257,7 +257,6 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
257 257
 // Searchfs
258 258
 // Delete
259 259
 // Copyfile
260
-// Poll
261 260
 // Watchevent
262 261
 // Waitevent
263 262
 // Modwatch
... ...
@@ -403,7 +402,6 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
403 403
 // Pread_nocancel
404 404
 // Pwrite_nocancel
405 405
 // Waitid_nocancel
406
-// Poll_nocancel
407 406
 // Msgsnd_nocancel
408 407
 // Msgrcv_nocancel
409 408
 // Sem_wait_nocancel
... ...
@@ -11,19 +11,12 @@ import (
11 11
 	"unsafe"
12 12
 )
13 13
 
14
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
15
-
16
-func NsecToTimespec(nsec int64) (ts Timespec) {
17
-	ts.Sec = nsec / 1e9
18
-	ts.Nsec = nsec % 1e9
19
-	return
14
+func setTimespec(sec, nsec int64) Timespec {
15
+	return Timespec{Sec: sec, Nsec: nsec}
20 16
 }
21 17
 
22
-func NsecToTimeval(nsec int64) (tv Timeval) {
23
-	nsec += 999 // round up to microsecond
24
-	tv.Usec = nsec % 1e9 / 1e3
25
-	tv.Sec = int64(nsec / 1e9)
26
-	return
18
+func setTimeval(sec, usec int64) Timeval {
19
+	return Timeval{Sec: sec, Usec: usec}
27 20
 }
28 21
 
29 22
 func SetKevent(k *Kevent_t, fd, mode, flags int) {
... ...
@@ -32,7 +32,7 @@ func nametomib(name string) (mib []_C_int, err error) {
32 32
 
33 33
 	// NOTE(rsc): It seems strange to set the buffer to have
34 34
 	// size CTL_MAXNAME+2 but use only CTL_MAXNAME
35
-	// as the size.  I don't know why the +2 is here, but the
35
+	// as the size. I don't know why the +2 is here, but the
36 36
 	// kernel uses +2 for its own implementation of this function.
37 37
 	// I am scared that if we don't include the +2 here, the kernel
38 38
 	// will silently write 2 words farther than we specify
... ...
@@ -550,7 +550,6 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
550 550
 // Searchfs
551 551
 // Delete
552 552
 // Copyfile
553
-// Poll
554 553
 // Watchevent
555 554
 // Waitevent
556 555
 // Modwatch
... ...
@@ -11,19 +11,12 @@ import (
11 11
 	"unsafe"
12 12
 )
13 13
 
14
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
15
-
16
-func NsecToTimespec(nsec int64) (ts Timespec) {
17
-	ts.Sec = int32(nsec / 1e9)
18
-	ts.Nsec = int32(nsec % 1e9)
19
-	return
14
+func setTimespec(sec, nsec int64) Timespec {
15
+	return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
20 16
 }
21 17
 
22
-func NsecToTimeval(nsec int64) (tv Timeval) {
23
-	nsec += 999 // round up to microsecond
24
-	tv.Usec = int32(nsec % 1e9 / 1e3)
25
-	tv.Sec = int32(nsec / 1e9)
26
-	return
18
+func setTimeval(sec, usec int64) Timeval {
19
+	return Timeval{Sec: int32(sec), Usec: int32(usec)}
27 20
 }
28 21
 
29 22
 func SetKevent(k *Kevent_t, fd, mode, flags int) {
... ...
@@ -11,19 +11,12 @@ import (
11 11
 	"unsafe"
12 12
 )
13 13
 
14
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
15
-
16
-func NsecToTimespec(nsec int64) (ts Timespec) {
17
-	ts.Sec = nsec / 1e9
18
-	ts.Nsec = nsec % 1e9
19
-	return
14
+func setTimespec(sec, nsec int64) Timespec {
15
+	return Timespec{Sec: sec, Nsec: nsec}
20 16
 }
21 17
 
22
-func NsecToTimeval(nsec int64) (tv Timeval) {
23
-	nsec += 999 // round up to microsecond
24
-	tv.Usec = nsec % 1e9 / 1e3
25
-	tv.Sec = int64(nsec / 1e9)
26
-	return
18
+func setTimeval(sec, usec int64) Timeval {
19
+	return Timeval{Sec: sec, Usec: usec}
27 20
 }
28 21
 
29 22
 func SetKevent(k *Kevent_t, fd, mode, flags int) {
... ...
@@ -11,19 +11,12 @@ import (
11 11
 	"unsafe"
12 12
 )
13 13
 
14
-func TimespecToNsec(ts Timespec) int64 { return ts.Sec*1e9 + int64(ts.Nsec) }
15
-
16
-func NsecToTimespec(nsec int64) (ts Timespec) {
17
-	ts.Sec = nsec / 1e9
18
-	ts.Nsec = int32(nsec % 1e9)
19
-	return
14
+func setTimespec(sec, nsec int64) Timespec {
15
+	return Timespec{Sec: sec, Nsec: int32(nsec)}
20 16
 }
21 17
 
22
-func NsecToTimeval(nsec int64) (tv Timeval) {
23
-	nsec += 999 // round up to microsecond
24
-	tv.Usec = int32(nsec % 1e9 / 1e3)
25
-	tv.Sec = nsec / 1e9
26
-	return
18
+func setTimeval(sec, usec int64) Timeval {
19
+	return Timeval{Sec: sec, Usec: int32(usec)}
27 20
 }
28 21
 
29 22
 func SetKevent(k *Kevent_t, fd, mode, flags int) {
... ...
@@ -255,7 +255,7 @@ func Getgroups() (gids []int, err error) {
255 255
 		return nil, nil
256 256
 	}
257 257
 
258
-	// Sanity check group count.  Max is 1<<16 on Linux.
258
+	// Sanity check group count. Max is 1<<16 on Linux.
259 259
 	if n < 0 || n > 1<<20 {
260 260
 		return nil, EINVAL
261 261
 	}
... ...
@@ -290,8 +290,8 @@ type WaitStatus uint32
290 290
 // 0x7F (stopped), or a signal number that caused an exit.
291 291
 // The 0x80 bit is whether there was a core dump.
292 292
 // An extra number (exit code, signal causing a stop)
293
-// is in the high bits.  At least that's the idea.
294
-// There are various irregularities.  For example, the
293
+// is in the high bits. At least that's the idea.
294
+// There are various irregularities. For example, the
295 295
 // "continued" status is 0xFFFF, distinguishing itself
296 296
 // from stopped via the core dump bit.
297 297
 
... ...
@@ -926,7 +926,7 @@ func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from
926 926
 	msg.Namelen = uint32(SizeofSockaddrAny)
927 927
 	var iov Iovec
928 928
 	if len(p) > 0 {
929
-		iov.Base = (*byte)(unsafe.Pointer(&p[0]))
929
+		iov.Base = &p[0]
930 930
 		iov.SetLen(len(p))
931 931
 	}
932 932
 	var dummy byte
... ...
@@ -941,7 +941,7 @@ func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from
941 941
 			iov.Base = &dummy
942 942
 			iov.SetLen(1)
943 943
 		}
944
-		msg.Control = (*byte)(unsafe.Pointer(&oob[0]))
944
+		msg.Control = &oob[0]
945 945
 		msg.SetControllen(len(oob))
946 946
 	}
947 947
 	msg.Iov = &iov
... ...
@@ -974,11 +974,11 @@ func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error)
974 974
 		}
975 975
 	}
976 976
 	var msg Msghdr
977
-	msg.Name = (*byte)(unsafe.Pointer(ptr))
977
+	msg.Name = (*byte)(ptr)
978 978
 	msg.Namelen = uint32(salen)
979 979
 	var iov Iovec
980 980
 	if len(p) > 0 {
981
-		iov.Base = (*byte)(unsafe.Pointer(&p[0]))
981
+		iov.Base = &p[0]
982 982
 		iov.SetLen(len(p))
983 983
 	}
984 984
 	var dummy byte
... ...
@@ -993,7 +993,7 @@ func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error)
993 993
 			iov.Base = &dummy
994 994
 			iov.SetLen(1)
995 995
 		}
996
-		msg.Control = (*byte)(unsafe.Pointer(&oob[0]))
996
+		msg.Control = &oob[0]
997 997
 		msg.SetControllen(len(oob))
998 998
 	}
999 999
 	msg.Iov = &iov
... ...
@@ -1023,7 +1023,7 @@ func ptracePeek(req int, pid int, addr uintptr, out []byte) (count int, err erro
1023 1023
 
1024 1024
 	var buf [sizeofPtr]byte
1025 1025
 
1026
-	// Leading edge.  PEEKTEXT/PEEKDATA don't require aligned
1026
+	// Leading edge. PEEKTEXT/PEEKDATA don't require aligned
1027 1027
 	// access (PEEKUSER warns that it might), but if we don't
1028 1028
 	// align our reads, we might straddle an unmapped page
1029 1029
 	// boundary and not get the bytes leading up to the page
... ...
@@ -14,19 +14,12 @@ import (
14 14
 	"unsafe"
15 15
 )
16 16
 
17
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
18
-
19
-func NsecToTimespec(nsec int64) (ts Timespec) {
20
-	ts.Sec = int32(nsec / 1e9)
21
-	ts.Nsec = int32(nsec % 1e9)
22
-	return
17
+func setTimespec(sec, nsec int64) Timespec {
18
+	return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
23 19
 }
24 20
 
25
-func NsecToTimeval(nsec int64) (tv Timeval) {
26
-	nsec += 999 // round up to microsecond
27
-	tv.Sec = int32(nsec / 1e9)
28
-	tv.Usec = int32(nsec % 1e9 / 1e3)
29
-	return
21
+func setTimeval(sec, usec int64) Timeval {
22
+	return Timeval{Sec: int32(sec), Usec: int32(usec)}
30 23
 }
31 24
 
32 25
 //sysnb	pipe(p *[2]_C_int) (err error)
... ...
@@ -183,9 +176,9 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
183 183
 
184 184
 // On x86 Linux, all the socket calls go through an extra indirection,
185 185
 // I think because the 5-register system call interface can't handle
186
-// the 6-argument calls like sendto and recvfrom.  Instead the
186
+// the 6-argument calls like sendto and recvfrom. Instead the
187 187
 // arguments to the underlying system call are the number below
188
-// and a pointer to an array of uintptr.  We hide the pointer in the
188
+// and a pointer to an array of uintptr. We hide the pointer in the
189 189
 // socketcall assembly to avoid allocation on every system call.
190 190
 
191 191
 const (
... ...
@@ -83,19 +83,12 @@ func Time(t *Time_t) (tt Time_t, err error) {
83 83
 
84 84
 //sys	Utime(path string, buf *Utimbuf) (err error)
85 85
 
86
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
87
-
88
-func NsecToTimespec(nsec int64) (ts Timespec) {
89
-	ts.Sec = nsec / 1e9
90
-	ts.Nsec = nsec % 1e9
91
-	return
86
+func setTimespec(sec, nsec int64) Timespec {
87
+	return Timespec{Sec: sec, Nsec: nsec}
92 88
 }
93 89
 
94
-func NsecToTimeval(nsec int64) (tv Timeval) {
95
-	nsec += 999 // round up to microsecond
96
-	tv.Sec = nsec / 1e9
97
-	tv.Usec = nsec % 1e9 / 1e3
98
-	return
90
+func setTimeval(sec, usec int64) Timeval {
91
+	return Timeval{Sec: sec, Usec: usec}
99 92
 }
100 93
 
101 94
 //sysnb	pipe(p *[2]_C_int) (err error)
... ...
@@ -11,19 +11,12 @@ import (
11 11
 	"unsafe"
12 12
 )
13 13
 
14
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
15
-
16
-func NsecToTimespec(nsec int64) (ts Timespec) {
17
-	ts.Sec = int32(nsec / 1e9)
18
-	ts.Nsec = int32(nsec % 1e9)
19
-	return
14
+func setTimespec(sec, nsec int64) Timespec {
15
+	return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
20 16
 }
21 17
 
22
-func NsecToTimeval(nsec int64) (tv Timeval) {
23
-	nsec += 999 // round up to microsecond
24
-	tv.Sec = int32(nsec / 1e9)
25
-	tv.Usec = int32(nsec % 1e9 / 1e3)
26
-	return
18
+func setTimeval(sec, usec int64) Timeval {
19
+	return Timeval{Sec: int32(sec), Usec: int32(usec)}
27 20
 }
28 21
 
29 22
 func Pipe(p []int) (err error) {
... ...
@@ -73,19 +73,12 @@ func Lstat(path string, stat *Stat_t) (err error) {
73 73
 
74 74
 //sysnb	Gettimeofday(tv *Timeval) (err error)
75 75
 
76
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
77
-
78
-func NsecToTimespec(nsec int64) (ts Timespec) {
79
-	ts.Sec = nsec / 1e9
80
-	ts.Nsec = nsec % 1e9
81
-	return
76
+func setTimespec(sec, nsec int64) Timespec {
77
+	return Timespec{Sec: sec, Nsec: nsec}
82 78
 }
83 79
 
84
-func NsecToTimeval(nsec int64) (tv Timeval) {
85
-	nsec += 999 // round up to microsecond
86
-	tv.Sec = nsec / 1e9
87
-	tv.Usec = nsec % 1e9 / 1e3
88
-	return
80
+func setTimeval(sec, usec int64) Timeval {
81
+	return Timeval{Sec: sec, Usec: usec}
89 82
 }
90 83
 
91 84
 func Time(t *Time_t) (Time_t, error) {
... ...
@@ -76,19 +76,12 @@ func Time(t *Time_t) (tt Time_t, err error) {
76 76
 
77 77
 //sys	Utime(path string, buf *Utimbuf) (err error)
78 78
 
79
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
80
-
81
-func NsecToTimespec(nsec int64) (ts Timespec) {
82
-	ts.Sec = nsec / 1e9
83
-	ts.Nsec = nsec % 1e9
84
-	return
79
+func setTimespec(sec, nsec int64) Timespec {
80
+	return Timespec{Sec: sec, Nsec: nsec}
85 81
 }
86 82
 
87
-func NsecToTimeval(nsec int64) (tv Timeval) {
88
-	nsec += 999 // round up to microsecond
89
-	tv.Sec = nsec / 1e9
90
-	tv.Usec = nsec % 1e9 / 1e3
91
-	return
83
+func setTimeval(sec, usec int64) Timeval {
84
+	return Timeval{Sec: sec, Usec: usec}
92 85
 }
93 86
 
94 87
 func Pipe(p []int) (err error) {
... ...
@@ -99,19 +99,12 @@ func Seek(fd int, offset int64, whence int) (off int64, err error) {
99 99
 	return
100 100
 }
101 101
 
102
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
103
-
104
-func NsecToTimespec(nsec int64) (ts Timespec) {
105
-	ts.Sec = int32(nsec / 1e9)
106
-	ts.Nsec = int32(nsec % 1e9)
107
-	return
102
+func setTimespec(sec, nsec int64) Timespec {
103
+	return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
108 104
 }
109 105
 
110
-func NsecToTimeval(nsec int64) (tv Timeval) {
111
-	nsec += 999 // round up to microsecond
112
-	tv.Sec = int32(nsec / 1e9)
113
-	tv.Usec = int32(nsec % 1e9 / 1e3)
114
-	return
106
+func setTimeval(sec, usec int64) Timeval {
107
+	return Timeval{Sec: int32(sec), Usec: int32(usec)}
115 108
 }
116 109
 
117 110
 //sysnb pipe2(p *[2]_C_int, flags int) (err error)
... ...
@@ -66,19 +66,12 @@ package unix
66 66
 
67 67
 //sys	Utime(path string, buf *Utimbuf) (err error)
68 68
 
69
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
70
-
71
-func NsecToTimespec(nsec int64) (ts Timespec) {
72
-	ts.Sec = nsec / 1e9
73
-	ts.Nsec = nsec % 1e9
74
-	return
69
+func setTimespec(sec, nsec int64) Timespec {
70
+	return Timespec{Sec: sec, Nsec: nsec}
75 71
 }
76 72
 
77
-func NsecToTimeval(nsec int64) (tv Timeval) {
78
-	nsec += 999 // round up to microsecond
79
-	tv.Sec = nsec / 1e9
80
-	tv.Usec = nsec % 1e9 / 1e3
81
-	return
73
+func setTimeval(sec, usec int64) Timeval {
74
+	return Timeval{Sec: sec, Usec: usec}
82 75
 }
83 76
 
84 77
 func (r *PtraceRegs) PC() uint64 { return r.Nip }
... ...
@@ -62,19 +62,12 @@ func Time(t *Time_t) (tt Time_t, err error) {
62 62
 
63 63
 //sys	Utime(path string, buf *Utimbuf) (err error)
64 64
 
65
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
66
-
67
-func NsecToTimespec(nsec int64) (ts Timespec) {
68
-	ts.Sec = nsec / 1e9
69
-	ts.Nsec = nsec % 1e9
70
-	return
65
+func setTimespec(sec, nsec int64) Timespec {
66
+	return Timespec{Sec: sec, Nsec: nsec}
71 67
 }
72 68
 
73
-func NsecToTimeval(nsec int64) (tv Timeval) {
74
-	nsec += 999 // round up to microsecond
75
-	tv.Sec = nsec / 1e9
76
-	tv.Usec = nsec % 1e9 / 1e3
77
-	return
69
+func setTimeval(sec, usec int64) Timeval {
70
+	return Timeval{Sec: sec, Usec: usec}
78 71
 }
79 72
 
80 73
 //sysnb pipe2(p *[2]_C_int, flags int) (err error)
... ...
@@ -82,19 +82,12 @@ func Time(t *Time_t) (tt Time_t, err error) {
82 82
 
83 83
 //sys	Utime(path string, buf *Utimbuf) (err error)
84 84
 
85
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
86
-
87
-func NsecToTimespec(nsec int64) (ts Timespec) {
88
-	ts.Sec = nsec / 1e9
89
-	ts.Nsec = nsec % 1e9
90
-	return
85
+func setTimespec(sec, nsec int64) Timespec {
86
+	return Timespec{Sec: sec, Nsec: nsec}
91 87
 }
92 88
 
93
-func NsecToTimeval(nsec int64) (tv Timeval) {
94
-	nsec += 999 // round up to microsecond
95
-	tv.Sec = nsec / 1e9
96
-	tv.Usec = int32(nsec % 1e9 / 1e3)
97
-	return
89
+func setTimeval(sec, usec int64) Timeval {
90
+	return Timeval{Sec: sec, Usec: int32(usec)}
98 91
 }
99 92
 
100 93
 func (r *PtraceRegs) PC() uint64 { return r.Tpc }
... ...
@@ -422,7 +422,6 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
422 422
 // ntp_adjtime
423 423
 // pmc_control
424 424
 // pmc_get_info
425
-// poll
426 425
 // pollts
427 426
 // preadv
428 427
 // profil
... ...
@@ -6,19 +6,12 @@
6 6
 
7 7
 package unix
8 8
 
9
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
10
-
11
-func NsecToTimespec(nsec int64) (ts Timespec) {
12
-	ts.Sec = int64(nsec / 1e9)
13
-	ts.Nsec = int32(nsec % 1e9)
14
-	return
9
+func setTimespec(sec, nsec int64) Timespec {
10
+	return Timespec{Sec: sec, Nsec: int32(nsec)}
15 11
 }
16 12
 
17
-func NsecToTimeval(nsec int64) (tv Timeval) {
18
-	nsec += 999 // round up to microsecond
19
-	tv.Usec = int32(nsec % 1e9 / 1e3)
20
-	tv.Sec = int64(nsec / 1e9)
21
-	return
13
+func setTimeval(sec, usec int64) Timeval {
14
+	return Timeval{Sec: sec, Usec: int32(usec)}
22 15
 }
23 16
 
24 17
 func SetKevent(k *Kevent_t, fd, mode, flags int) {
... ...
@@ -6,19 +6,12 @@
6 6
 
7 7
 package unix
8 8
 
9
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
10
-
11
-func NsecToTimespec(nsec int64) (ts Timespec) {
12
-	ts.Sec = int64(nsec / 1e9)
13
-	ts.Nsec = int64(nsec % 1e9)
14
-	return
9
+func setTimespec(sec, nsec int64) Timespec {
10
+	return Timespec{Sec: sec, Nsec: nsec}
15 11
 }
16 12
 
17
-func NsecToTimeval(nsec int64) (tv Timeval) {
18
-	nsec += 999 // round up to microsecond
19
-	tv.Usec = int32(nsec % 1e9 / 1e3)
20
-	tv.Sec = int64(nsec / 1e9)
21
-	return
13
+func setTimeval(sec, usec int64) Timeval {
14
+	return Timeval{Sec: sec, Usec: int32(usec)}
22 15
 }
23 16
 
24 17
 func SetKevent(k *Kevent_t, fd, mode, flags int) {
... ...
@@ -6,19 +6,12 @@
6 6
 
7 7
 package unix
8 8
 
9
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
10
-
11
-func NsecToTimespec(nsec int64) (ts Timespec) {
12
-	ts.Sec = int64(nsec / 1e9)
13
-	ts.Nsec = int32(nsec % 1e9)
14
-	return
9
+func setTimespec(sec, nsec int64) Timespec {
10
+	return Timespec{Sec: sec, Nsec: int32(nsec)}
15 11
 }
16 12
 
17
-func NsecToTimeval(nsec int64) (tv Timeval) {
18
-	nsec += 999 // round up to microsecond
19
-	tv.Usec = int32(nsec % 1e9 / 1e3)
20
-	tv.Sec = int64(nsec / 1e9)
21
-	return
13
+func setTimeval(sec, usec int64) Timeval {
14
+	return Timeval{Sec: sec, Usec: int32(usec)}
22 15
 }
23 16
 
24 17
 func SetKevent(k *Kevent_t, fd, mode, flags int) {
... ...
@@ -243,7 +243,6 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
243 243
 // nfssvc
244 244
 // nnpfspioctl
245 245
 // openat
246
-// poll
247 246
 // preadv
248 247
 // profil
249 248
 // pwritev
... ...
@@ -6,19 +6,12 @@
6 6
 
7 7
 package unix
8 8
 
9
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
10
-
11
-func NsecToTimespec(nsec int64) (ts Timespec) {
12
-	ts.Sec = int64(nsec / 1e9)
13
-	ts.Nsec = int32(nsec % 1e9)
14
-	return
9
+func setTimespec(sec, nsec int64) Timespec {
10
+	return Timespec{Sec: sec, Nsec: int32(nsec)}
15 11
 }
16 12
 
17
-func NsecToTimeval(nsec int64) (tv Timeval) {
18
-	nsec += 999 // round up to microsecond
19
-	tv.Usec = int32(nsec % 1e9 / 1e3)
20
-	tv.Sec = int64(nsec / 1e9)
21
-	return
13
+func setTimeval(sec, usec int64) Timeval {
14
+	return Timeval{Sec: sec, Usec: int32(usec)}
22 15
 }
23 16
 
24 17
 func SetKevent(k *Kevent_t, fd, mode, flags int) {
... ...
@@ -6,19 +6,12 @@
6 6
 
7 7
 package unix
8 8
 
9
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
10
-
11
-func NsecToTimespec(nsec int64) (ts Timespec) {
12
-	ts.Sec = nsec / 1e9
13
-	ts.Nsec = nsec % 1e9
14
-	return
9
+func setTimespec(sec, nsec int64) Timespec {
10
+	return Timespec{Sec: sec, Nsec: nsec}
15 11
 }
16 12
 
17
-func NsecToTimeval(nsec int64) (tv Timeval) {
18
-	nsec += 999 // round up to microsecond
19
-	tv.Usec = nsec % 1e9 / 1e3
20
-	tv.Sec = nsec / 1e9
21
-	return
13
+func setTimeval(sec, usec int64) Timeval {
14
+	return Timeval{Sec: sec, Usec: usec}
22 15
 }
23 16
 
24 17
 func SetKevent(k *Kevent_t, fd, mode, flags int) {
... ...
@@ -6,19 +6,12 @@
6 6
 
7 7
 package unix
8 8
 
9
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
10
-
11
-func NsecToTimespec(nsec int64) (ts Timespec) {
12
-	ts.Sec = int64(nsec / 1e9)
13
-	ts.Nsec = int32(nsec % 1e9)
14
-	return
9
+func setTimespec(sec, nsec int64) Timespec {
10
+	return Timespec{Sec: sec, Nsec: int32(nsec)}
15 11
 }
16 12
 
17
-func NsecToTimeval(nsec int64) (tv Timeval) {
18
-	nsec += 999 // round up to microsecond
19
-	tv.Usec = int32(nsec % 1e9 / 1e3)
20
-	tv.Sec = int64(nsec / 1e9)
21
-	return
13
+func setTimeval(sec, usec int64) Timeval {
14
+	return Timeval{Sec: sec, Usec: int32(usec)}
22 15
 }
23 16
 
24 17
 func SetKevent(k *Kevent_t, fd, mode, flags int) {
... ...
@@ -166,7 +166,7 @@ func Getwd() (wd string, err error) {
166 166
 
167 167
 func Getgroups() (gids []int, err error) {
168 168
 	n, err := getgroups(0, nil)
169
-	// Check for error and sanity check group count.  Newer versions of
169
+	// Check for error and sanity check group count. Newer versions of
170 170
 	// Solaris allow up to 1024 (NGROUPS_MAX).
171 171
 	if n < 0 || n > 1024 {
172 172
 		if err != nil {
... ...
@@ -350,7 +350,7 @@ func Futimesat(dirfd int, path string, tv []Timeval) error {
350 350
 }
351 351
 
352 352
 // Solaris doesn't have an futimes function because it allows NULL to be
353
-// specified as the path for futimesat.  However, Go doesn't like
353
+// specified as the path for futimesat. However, Go doesn't like
354 354
 // NULL-style string interfaces, so this simple wrapper is provided.
355 355
 func Futimes(fd int, tv []Timeval) error {
356 356
 	if tv == nil {
... ...
@@ -578,6 +578,15 @@ func IoctlGetTermio(fd int, req uint) (*Termio, error) {
578 578
 	return &value, err
579 579
 }
580 580
 
581
+//sys   poll(fds *PollFd, nfds int, timeout int) (n int, err error)
582
+
583
+func Poll(fds []PollFd, timeout int) (n int, err error) {
584
+	if len(fds) == 0 {
585
+		return poll(nil, 0, timeout)
586
+	}
587
+	return poll(&fds[0], len(fds), timeout)
588
+}
589
+
581 590
 /*
582 591
  * Exposed directly
583 592
  */
... ...
@@ -6,19 +6,12 @@
6 6
 
7 7
 package unix
8 8
 
9
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
10
-
11
-func NsecToTimespec(nsec int64) (ts Timespec) {
12
-	ts.Sec = nsec / 1e9
13
-	ts.Nsec = nsec % 1e9
14
-	return
9
+func setTimespec(sec, nsec int64) Timespec {
10
+	return Timespec{Sec: sec, Nsec: nsec}
15 11
 }
16 12
 
17
-func NsecToTimeval(nsec int64) (tv Timeval) {
18
-	nsec += 999 // round up to microsecond
19
-	tv.Usec = nsec % 1e9 / 1e3
20
-	tv.Sec = int64(nsec / 1e9)
21
-	return
13
+func setTimeval(sec, usec int64) Timeval {
14
+	return Timeval{Sec: sec, Usec: usec}
22 15
 }
23 16
 
24 17
 func (iov *Iovec) SetLen(length int) {
25 18
new file mode 100644
... ...
@@ -0,0 +1,62 @@
0
+// Copyright 2017 The Go Authors. All rights reserved.
1
+// Use of this source code is governed by a BSD-style
2
+// license that can be found in the LICENSE file.
3
+
4
+// +build darwin dragonfly freebsd linux netbsd openbsd solaris
5
+
6
+package unix
7
+
8
+// TimespecToNsec converts a Timespec value into a number of
9
+// nanoseconds since the Unix epoch.
10
+func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
11
+
12
+// NsecToTimespec takes a number of nanoseconds since the Unix epoch
13
+// and returns the corresponding Timespec value.
14
+func NsecToTimespec(nsec int64) Timespec {
15
+	sec := nsec / 1e9
16
+	nsec = nsec % 1e9
17
+	if nsec < 0 {
18
+		nsec += 1e9
19
+		sec--
20
+	}
21
+	return setTimespec(sec, nsec)
22
+}
23
+
24
+// TimevalToNsec converts a Timeval value into a number of nanoseconds
25
+// since the Unix epoch.
26
+func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
27
+
28
+// NsecToTimeval takes a number of nanoseconds since the Unix epoch
29
+// and returns the corresponding Timeval value.
30
+func NsecToTimeval(nsec int64) Timeval {
31
+	nsec += 999 // round up to microsecond
32
+	usec := nsec % 1e9 / 1e3
33
+	sec := nsec / 1e9
34
+	if usec < 0 {
35
+		usec += 1e6
36
+		sec--
37
+	}
38
+	return setTimeval(sec, usec)
39
+}
40
+
41
+// Unix returns ts as the number of seconds and nanoseconds elapsed since the
42
+// Unix epoch.
43
+func (ts *Timespec) Unix() (sec int64, nsec int64) {
44
+	return int64(ts.Sec), int64(ts.Nsec)
45
+}
46
+
47
+// Unix returns tv as the number of seconds and nanoseconds elapsed since the
48
+// Unix epoch.
49
+func (tv *Timeval) Unix() (sec int64, nsec int64) {
50
+	return int64(tv.Sec), int64(tv.Usec) * 1000
51
+}
52
+
53
+// Nano returns ts as the number of nanoseconds elapsed since the Unix epoch.
54
+func (ts *Timespec) Nano() int64 {
55
+	return int64(ts.Sec)*1e9 + int64(ts.Nsec)
56
+}
57
+
58
+// Nano returns tv as the number of nanoseconds elapsed since the Unix epoch.
59
+func (tv *Timeval) Nano() int64 {
60
+	return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000
61
+}
... ...
@@ -1277,7 +1277,7 @@ const (
1277 1277
 	RLIMIT_RTTIME                        = 0xf
1278 1278
 	RLIMIT_SIGPENDING                    = 0xb
1279 1279
 	RLIMIT_STACK                         = 0x3
1280
-	RLIM_INFINITY                        = -0x1
1280
+	RLIM_INFINITY                        = 0xffffffffffffffff
1281 1281
 	RTAX_ADVMSS                          = 0x8
1282 1282
 	RTAX_CC_ALGO                         = 0x10
1283 1283
 	RTAX_CWND                            = 0x7
... ...
@@ -1842,6 +1842,8 @@ const (
1842 1842
 	TUNSETVNETHDRSZ                      = 0x400454d8
1843 1843
 	TUNSETVNETLE                         = 0x400454dc
1844 1844
 	UMOUNT_NOFOLLOW                      = 0x8
1845
+	UTIME_NOW                            = 0x3fffffff
1846
+	UTIME_OMIT                           = 0x3ffffffe
1845 1847
 	VDISCARD                             = 0xd
1846 1848
 	VEOF                                 = 0x4
1847 1849
 	VEOL                                 = 0xb
... ...
@@ -1871,6 +1873,17 @@ const (
1871 1871
 	WALL                                 = 0x40000000
1872 1872
 	WCLONE                               = 0x80000000
1873 1873
 	WCONTINUED                           = 0x8
1874
+	WDIOC_GETBOOTSTATUS                  = 0x80045702
1875
+	WDIOC_GETPRETIMEOUT                  = 0x80045709
1876
+	WDIOC_GETSTATUS                      = 0x80045701
1877
+	WDIOC_GETSUPPORT                     = 0x80285700
1878
+	WDIOC_GETTEMP                        = 0x80045703
1879
+	WDIOC_GETTIMELEFT                    = 0x8004570a
1880
+	WDIOC_GETTIMEOUT                     = 0x80045707
1881
+	WDIOC_KEEPALIVE                      = 0x80045705
1882
+	WDIOC_SETOPTIONS                     = 0x80045704
1883
+	WDIOC_SETPRETIMEOUT                  = 0xc0045708
1884
+	WDIOC_SETTIMEOUT                     = 0xc0045706
1874 1885
 	WEXITED                              = 0x4
1875 1886
 	WNOHANG                              = 0x1
1876 1887
 	WNOTHREAD                            = 0x20000000
... ...
@@ -1187,7 +1187,7 @@ const (
1187 1187
 	PR_SET_NO_NEW_PRIVS                  = 0x26
1188 1188
 	PR_SET_PDEATHSIG                     = 0x1
1189 1189
 	PR_SET_PTRACER                       = 0x59616d61
1190
-	PR_SET_PTRACER_ANY                   = -0x1
1190
+	PR_SET_PTRACER_ANY                   = 0xffffffffffffffff
1191 1191
 	PR_SET_SECCOMP                       = 0x16
1192 1192
 	PR_SET_SECUREBITS                    = 0x1c
1193 1193
 	PR_SET_THP_DISABLE                   = 0x29
... ...
@@ -1278,7 +1278,7 @@ const (
1278 1278
 	RLIMIT_RTTIME                        = 0xf
1279 1279
 	RLIMIT_SIGPENDING                    = 0xb
1280 1280
 	RLIMIT_STACK                         = 0x3
1281
-	RLIM_INFINITY                        = -0x1
1281
+	RLIM_INFINITY                        = 0xffffffffffffffff
1282 1282
 	RTAX_ADVMSS                          = 0x8
1283 1283
 	RTAX_CC_ALGO                         = 0x10
1284 1284
 	RTAX_CWND                            = 0x7
... ...
@@ -1843,6 +1843,8 @@ const (
1843 1843
 	TUNSETVNETHDRSZ                      = 0x400454d8
1844 1844
 	TUNSETVNETLE                         = 0x400454dc
1845 1845
 	UMOUNT_NOFOLLOW                      = 0x8
1846
+	UTIME_NOW                            = 0x3fffffff
1847
+	UTIME_OMIT                           = 0x3ffffffe
1846 1848
 	VDISCARD                             = 0xd
1847 1849
 	VEOF                                 = 0x4
1848 1850
 	VEOL                                 = 0xb
... ...
@@ -1872,6 +1874,17 @@ const (
1872 1872
 	WALL                                 = 0x40000000
1873 1873
 	WCLONE                               = 0x80000000
1874 1874
 	WCONTINUED                           = 0x8
1875
+	WDIOC_GETBOOTSTATUS                  = 0x80045702
1876
+	WDIOC_GETPRETIMEOUT                  = 0x80045709
1877
+	WDIOC_GETSTATUS                      = 0x80045701
1878
+	WDIOC_GETSUPPORT                     = 0x80285700
1879
+	WDIOC_GETTEMP                        = 0x80045703
1880
+	WDIOC_GETTIMELEFT                    = 0x8004570a
1881
+	WDIOC_GETTIMEOUT                     = 0x80045707
1882
+	WDIOC_KEEPALIVE                      = 0x80045705
1883
+	WDIOC_SETOPTIONS                     = 0x80045704
1884
+	WDIOC_SETPRETIMEOUT                  = 0xc0045708
1885
+	WDIOC_SETTIMEOUT                     = 0xc0045706
1875 1886
 	WEXITED                              = 0x4
1876 1887
 	WNOHANG                              = 0x1
1877 1888
 	WNOTHREAD                            = 0x20000000
... ...
@@ -1282,7 +1282,7 @@ const (
1282 1282
 	RLIMIT_RTTIME                        = 0xf
1283 1283
 	RLIMIT_SIGPENDING                    = 0xb
1284 1284
 	RLIMIT_STACK                         = 0x3
1285
-	RLIM_INFINITY                        = -0x1
1285
+	RLIM_INFINITY                        = 0xffffffffffffffff
1286 1286
 	RTAX_ADVMSS                          = 0x8
1287 1287
 	RTAX_CC_ALGO                         = 0x10
1288 1288
 	RTAX_CWND                            = 0x7
... ...
@@ -1847,6 +1847,8 @@ const (
1847 1847
 	TUNSETVNETHDRSZ                      = 0x400454d8
1848 1848
 	TUNSETVNETLE                         = 0x400454dc
1849 1849
 	UMOUNT_NOFOLLOW                      = 0x8
1850
+	UTIME_NOW                            = 0x3fffffff
1851
+	UTIME_OMIT                           = 0x3ffffffe
1850 1852
 	VDISCARD                             = 0xd
1851 1853
 	VEOF                                 = 0x4
1852 1854
 	VEOL                                 = 0xb
... ...
@@ -1876,6 +1878,17 @@ const (
1876 1876
 	WALL                                 = 0x40000000
1877 1877
 	WCLONE                               = 0x80000000
1878 1878
 	WCONTINUED                           = 0x8
1879
+	WDIOC_GETBOOTSTATUS                  = 0x80045702
1880
+	WDIOC_GETPRETIMEOUT                  = 0x80045709
1881
+	WDIOC_GETSTATUS                      = 0x80045701
1882
+	WDIOC_GETSUPPORT                     = 0x80285700
1883
+	WDIOC_GETTEMP                        = 0x80045703
1884
+	WDIOC_GETTIMELEFT                    = 0x8004570a
1885
+	WDIOC_GETTIMEOUT                     = 0x80045707
1886
+	WDIOC_KEEPALIVE                      = 0x80045705
1887
+	WDIOC_SETOPTIONS                     = 0x80045704
1888
+	WDIOC_SETPRETIMEOUT                  = 0xc0045708
1889
+	WDIOC_SETTIMEOUT                     = 0xc0045706
1879 1890
 	WEXITED                              = 0x4
1880 1891
 	WNOHANG                              = 0x1
1881 1892
 	WNOTHREAD                            = 0x20000000
... ...
@@ -1188,7 +1188,7 @@ const (
1188 1188
 	PR_SET_NO_NEW_PRIVS                  = 0x26
1189 1189
 	PR_SET_PDEATHSIG                     = 0x1
1190 1190
 	PR_SET_PTRACER                       = 0x59616d61
1191
-	PR_SET_PTRACER_ANY                   = -0x1
1191
+	PR_SET_PTRACER_ANY                   = 0xffffffffffffffff
1192 1192
 	PR_SET_SECCOMP                       = 0x16
1193 1193
 	PR_SET_SECUREBITS                    = 0x1c
1194 1194
 	PR_SET_THP_DISABLE                   = 0x29
... ...
@@ -1268,7 +1268,7 @@ const (
1268 1268
 	RLIMIT_RTTIME                        = 0xf
1269 1269
 	RLIMIT_SIGPENDING                    = 0xb
1270 1270
 	RLIMIT_STACK                         = 0x3
1271
-	RLIM_INFINITY                        = -0x1
1271
+	RLIM_INFINITY                        = 0xffffffffffffffff
1272 1272
 	RTAX_ADVMSS                          = 0x8
1273 1273
 	RTAX_CC_ALGO                         = 0x10
1274 1274
 	RTAX_CWND                            = 0x7
... ...
@@ -1833,6 +1833,8 @@ const (
1833 1833
 	TUNSETVNETHDRSZ                      = 0x400454d8
1834 1834
 	TUNSETVNETLE                         = 0x400454dc
1835 1835
 	UMOUNT_NOFOLLOW                      = 0x8
1836
+	UTIME_NOW                            = 0x3fffffff
1837
+	UTIME_OMIT                           = 0x3ffffffe
1836 1838
 	VDISCARD                             = 0xd
1837 1839
 	VEOF                                 = 0x4
1838 1840
 	VEOL                                 = 0xb
... ...
@@ -1862,6 +1864,17 @@ const (
1862 1862
 	WALL                                 = 0x40000000
1863 1863
 	WCLONE                               = 0x80000000
1864 1864
 	WCONTINUED                           = 0x8
1865
+	WDIOC_GETBOOTSTATUS                  = 0x80045702
1866
+	WDIOC_GETPRETIMEOUT                  = 0x80045709
1867
+	WDIOC_GETSTATUS                      = 0x80045701
1868
+	WDIOC_GETSUPPORT                     = 0x80285700
1869
+	WDIOC_GETTEMP                        = 0x80045703
1870
+	WDIOC_GETTIMELEFT                    = 0x8004570a
1871
+	WDIOC_GETTIMEOUT                     = 0x80045707
1872
+	WDIOC_KEEPALIVE                      = 0x80045705
1873
+	WDIOC_SETOPTIONS                     = 0x80045704
1874
+	WDIOC_SETPRETIMEOUT                  = 0xc0045708
1875
+	WDIOC_SETTIMEOUT                     = 0xc0045706
1865 1876
 	WEXITED                              = 0x4
1866 1877
 	WNOHANG                              = 0x1
1867 1878
 	WNOTHREAD                            = 0x20000000
... ...
@@ -1279,7 +1279,7 @@ const (
1279 1279
 	RLIMIT_RTTIME                        = 0xf
1280 1280
 	RLIMIT_SIGPENDING                    = 0xb
1281 1281
 	RLIMIT_STACK                         = 0x3
1282
-	RLIM_INFINITY                        = -0x1
1282
+	RLIM_INFINITY                        = 0xffffffffffffffff
1283 1283
 	RTAX_ADVMSS                          = 0x8
1284 1284
 	RTAX_CC_ALGO                         = 0x10
1285 1285
 	RTAX_CWND                            = 0x7
... ...
@@ -1846,6 +1846,8 @@ const (
1846 1846
 	TUNSETVNETHDRSZ                      = 0x800454d8
1847 1847
 	TUNSETVNETLE                         = 0x800454dc
1848 1848
 	UMOUNT_NOFOLLOW                      = 0x8
1849
+	UTIME_NOW                            = 0x3fffffff
1850
+	UTIME_OMIT                           = 0x3ffffffe
1849 1851
 	VDISCARD                             = 0xd
1850 1852
 	VEOF                                 = 0x10
1851 1853
 	VEOL                                 = 0x11
... ...
@@ -1876,6 +1878,17 @@ const (
1876 1876
 	WALL                                 = 0x40000000
1877 1877
 	WCLONE                               = 0x80000000
1878 1878
 	WCONTINUED                           = 0x8
1879
+	WDIOC_GETBOOTSTATUS                  = 0x40045702
1880
+	WDIOC_GETPRETIMEOUT                  = 0x40045709
1881
+	WDIOC_GETSTATUS                      = 0x40045701
1882
+	WDIOC_GETSUPPORT                     = 0x40285700
1883
+	WDIOC_GETTEMP                        = 0x40045703
1884
+	WDIOC_GETTIMELEFT                    = 0x4004570a
1885
+	WDIOC_GETTIMEOUT                     = 0x40045707
1886
+	WDIOC_KEEPALIVE                      = 0x40045705
1887
+	WDIOC_SETOPTIONS                     = 0x40045704
1888
+	WDIOC_SETPRETIMEOUT                  = 0xc0045708
1889
+	WDIOC_SETTIMEOUT                     = 0xc0045706
1879 1890
 	WEXITED                              = 0x4
1880 1891
 	WNOHANG                              = 0x1
1881 1892
 	WNOTHREAD                            = 0x20000000
... ...
@@ -1187,7 +1187,7 @@ const (
1187 1187
 	PR_SET_NO_NEW_PRIVS                  = 0x26
1188 1188
 	PR_SET_PDEATHSIG                     = 0x1
1189 1189
 	PR_SET_PTRACER                       = 0x59616d61
1190
-	PR_SET_PTRACER_ANY                   = -0x1
1190
+	PR_SET_PTRACER_ANY                   = 0xffffffffffffffff
1191 1191
 	PR_SET_SECCOMP                       = 0x16
1192 1192
 	PR_SET_SECUREBITS                    = 0x1c
1193 1193
 	PR_SET_THP_DISABLE                   = 0x29
... ...
@@ -1279,7 +1279,7 @@ const (
1279 1279
 	RLIMIT_RTTIME                        = 0xf
1280 1280
 	RLIMIT_SIGPENDING                    = 0xb
1281 1281
 	RLIMIT_STACK                         = 0x3
1282
-	RLIM_INFINITY                        = -0x1
1282
+	RLIM_INFINITY                        = 0xffffffffffffffff
1283 1283
 	RTAX_ADVMSS                          = 0x8
1284 1284
 	RTAX_CC_ALGO                         = 0x10
1285 1285
 	RTAX_CWND                            = 0x7
... ...
@@ -1846,6 +1846,8 @@ const (
1846 1846
 	TUNSETVNETHDRSZ                      = 0x800454d8
1847 1847
 	TUNSETVNETLE                         = 0x800454dc
1848 1848
 	UMOUNT_NOFOLLOW                      = 0x8
1849
+	UTIME_NOW                            = 0x3fffffff
1850
+	UTIME_OMIT                           = 0x3ffffffe
1849 1851
 	VDISCARD                             = 0xd
1850 1852
 	VEOF                                 = 0x10
1851 1853
 	VEOL                                 = 0x11
... ...
@@ -1876,6 +1878,17 @@ const (
1876 1876
 	WALL                                 = 0x40000000
1877 1877
 	WCLONE                               = 0x80000000
1878 1878
 	WCONTINUED                           = 0x8
1879
+	WDIOC_GETBOOTSTATUS                  = 0x40045702
1880
+	WDIOC_GETPRETIMEOUT                  = 0x40045709
1881
+	WDIOC_GETSTATUS                      = 0x40045701
1882
+	WDIOC_GETSUPPORT                     = 0x40285700
1883
+	WDIOC_GETTEMP                        = 0x40045703
1884
+	WDIOC_GETTIMELEFT                    = 0x4004570a
1885
+	WDIOC_GETTIMEOUT                     = 0x40045707
1886
+	WDIOC_KEEPALIVE                      = 0x40045705
1887
+	WDIOC_SETOPTIONS                     = 0x40045704
1888
+	WDIOC_SETPRETIMEOUT                  = 0xc0045708
1889
+	WDIOC_SETTIMEOUT                     = 0xc0045706
1879 1890
 	WEXITED                              = 0x4
1880 1891
 	WNOHANG                              = 0x1
1881 1892
 	WNOTHREAD                            = 0x20000000
... ...
@@ -1187,7 +1187,7 @@ const (
1187 1187
 	PR_SET_NO_NEW_PRIVS                  = 0x26
1188 1188
 	PR_SET_PDEATHSIG                     = 0x1
1189 1189
 	PR_SET_PTRACER                       = 0x59616d61
1190
-	PR_SET_PTRACER_ANY                   = -0x1
1190
+	PR_SET_PTRACER_ANY                   = 0xffffffffffffffff
1191 1191
 	PR_SET_SECCOMP                       = 0x16
1192 1192
 	PR_SET_SECUREBITS                    = 0x1c
1193 1193
 	PR_SET_THP_DISABLE                   = 0x29
... ...
@@ -1279,7 +1279,7 @@ const (
1279 1279
 	RLIMIT_RTTIME                        = 0xf
1280 1280
 	RLIMIT_SIGPENDING                    = 0xb
1281 1281
 	RLIMIT_STACK                         = 0x3
1282
-	RLIM_INFINITY                        = -0x1
1282
+	RLIM_INFINITY                        = 0xffffffffffffffff
1283 1283
 	RTAX_ADVMSS                          = 0x8
1284 1284
 	RTAX_CC_ALGO                         = 0x10
1285 1285
 	RTAX_CWND                            = 0x7
... ...
@@ -1846,6 +1846,8 @@ const (
1846 1846
 	TUNSETVNETHDRSZ                      = 0x800454d8
1847 1847
 	TUNSETVNETLE                         = 0x800454dc
1848 1848
 	UMOUNT_NOFOLLOW                      = 0x8
1849
+	UTIME_NOW                            = 0x3fffffff
1850
+	UTIME_OMIT                           = 0x3ffffffe
1849 1851
 	VDISCARD                             = 0xd
1850 1852
 	VEOF                                 = 0x10
1851 1853
 	VEOL                                 = 0x11
... ...
@@ -1876,6 +1878,17 @@ const (
1876 1876
 	WALL                                 = 0x40000000
1877 1877
 	WCLONE                               = 0x80000000
1878 1878
 	WCONTINUED                           = 0x8
1879
+	WDIOC_GETBOOTSTATUS                  = 0x40045702
1880
+	WDIOC_GETPRETIMEOUT                  = 0x40045709
1881
+	WDIOC_GETSTATUS                      = 0x40045701
1882
+	WDIOC_GETSUPPORT                     = 0x40285700
1883
+	WDIOC_GETTEMP                        = 0x40045703
1884
+	WDIOC_GETTIMELEFT                    = 0x4004570a
1885
+	WDIOC_GETTIMEOUT                     = 0x40045707
1886
+	WDIOC_KEEPALIVE                      = 0x40045705
1887
+	WDIOC_SETOPTIONS                     = 0x40045704
1888
+	WDIOC_SETPRETIMEOUT                  = 0xc0045708
1889
+	WDIOC_SETTIMEOUT                     = 0xc0045706
1879 1890
 	WEXITED                              = 0x4
1880 1891
 	WNOHANG                              = 0x1
1881 1892
 	WNOTHREAD                            = 0x20000000
... ...
@@ -1279,7 +1279,7 @@ const (
1279 1279
 	RLIMIT_RTTIME                        = 0xf
1280 1280
 	RLIMIT_SIGPENDING                    = 0xb
1281 1281
 	RLIMIT_STACK                         = 0x3
1282
-	RLIM_INFINITY                        = -0x1
1282
+	RLIM_INFINITY                        = 0xffffffffffffffff
1283 1283
 	RTAX_ADVMSS                          = 0x8
1284 1284
 	RTAX_CC_ALGO                         = 0x10
1285 1285
 	RTAX_CWND                            = 0x7
... ...
@@ -1846,6 +1846,8 @@ const (
1846 1846
 	TUNSETVNETHDRSZ                      = 0x800454d8
1847 1847
 	TUNSETVNETLE                         = 0x800454dc
1848 1848
 	UMOUNT_NOFOLLOW                      = 0x8
1849
+	UTIME_NOW                            = 0x3fffffff
1850
+	UTIME_OMIT                           = 0x3ffffffe
1849 1851
 	VDISCARD                             = 0xd
1850 1852
 	VEOF                                 = 0x10
1851 1853
 	VEOL                                 = 0x11
... ...
@@ -1876,6 +1878,17 @@ const (
1876 1876
 	WALL                                 = 0x40000000
1877 1877
 	WCLONE                               = 0x80000000
1878 1878
 	WCONTINUED                           = 0x8
1879
+	WDIOC_GETBOOTSTATUS                  = 0x40045702
1880
+	WDIOC_GETPRETIMEOUT                  = 0x40045709
1881
+	WDIOC_GETSTATUS                      = 0x40045701
1882
+	WDIOC_GETSUPPORT                     = 0x40285700
1883
+	WDIOC_GETTEMP                        = 0x40045703
1884
+	WDIOC_GETTIMELEFT                    = 0x4004570a
1885
+	WDIOC_GETTIMEOUT                     = 0x40045707
1886
+	WDIOC_KEEPALIVE                      = 0x40045705
1887
+	WDIOC_SETOPTIONS                     = 0x40045704
1888
+	WDIOC_SETPRETIMEOUT                  = 0xc0045708
1889
+	WDIOC_SETTIMEOUT                     = 0xc0045706
1879 1890
 	WEXITED                              = 0x4
1880 1891
 	WNOHANG                              = 0x1
1881 1892
 	WNOTHREAD                            = 0x20000000
... ...
@@ -1189,7 +1189,7 @@ const (
1189 1189
 	PR_SET_NO_NEW_PRIVS                  = 0x26
1190 1190
 	PR_SET_PDEATHSIG                     = 0x1
1191 1191
 	PR_SET_PTRACER                       = 0x59616d61
1192
-	PR_SET_PTRACER_ANY                   = -0x1
1192
+	PR_SET_PTRACER_ANY                   = 0xffffffffffffffff
1193 1193
 	PR_SET_SECCOMP                       = 0x16
1194 1194
 	PR_SET_SECUREBITS                    = 0x1c
1195 1195
 	PR_SET_THP_DISABLE                   = 0x29
... ...
@@ -1335,7 +1335,7 @@ const (
1335 1335
 	RLIMIT_RTTIME                        = 0xf
1336 1336
 	RLIMIT_SIGPENDING                    = 0xb
1337 1337
 	RLIMIT_STACK                         = 0x3
1338
-	RLIM_INFINITY                        = -0x1
1338
+	RLIM_INFINITY                        = 0xffffffffffffffff
1339 1339
 	RTAX_ADVMSS                          = 0x8
1340 1340
 	RTAX_CC_ALGO                         = 0x10
1341 1341
 	RTAX_CWND                            = 0x7
... ...
@@ -1904,6 +1904,8 @@ const (
1904 1904
 	TUNSETVNETHDRSZ                      = 0x800454d8
1905 1905
 	TUNSETVNETLE                         = 0x800454dc
1906 1906
 	UMOUNT_NOFOLLOW                      = 0x8
1907
+	UTIME_NOW                            = 0x3fffffff
1908
+	UTIME_OMIT                           = 0x3ffffffe
1907 1909
 	VDISCARD                             = 0x10
1908 1910
 	VEOF                                 = 0x4
1909 1911
 	VEOL                                 = 0x6
... ...
@@ -1933,6 +1935,17 @@ const (
1933 1933
 	WALL                                 = 0x40000000
1934 1934
 	WCLONE                               = 0x80000000
1935 1935
 	WCONTINUED                           = 0x8
1936
+	WDIOC_GETBOOTSTATUS                  = 0x40045702
1937
+	WDIOC_GETPRETIMEOUT                  = 0x40045709
1938
+	WDIOC_GETSTATUS                      = 0x40045701
1939
+	WDIOC_GETSUPPORT                     = 0x40285700
1940
+	WDIOC_GETTEMP                        = 0x40045703
1941
+	WDIOC_GETTIMELEFT                    = 0x4004570a
1942
+	WDIOC_GETTIMEOUT                     = 0x40045707
1943
+	WDIOC_KEEPALIVE                      = 0x40045705
1944
+	WDIOC_SETOPTIONS                     = 0x40045704
1945
+	WDIOC_SETPRETIMEOUT                  = 0xc0045708
1946
+	WDIOC_SETTIMEOUT                     = 0xc0045706
1936 1947
 	WEXITED                              = 0x4
1937 1948
 	WNOHANG                              = 0x1
1938 1949
 	WNOTHREAD                            = 0x20000000
... ...
@@ -1189,7 +1189,7 @@ const (
1189 1189
 	PR_SET_NO_NEW_PRIVS                  = 0x26
1190 1190
 	PR_SET_PDEATHSIG                     = 0x1
1191 1191
 	PR_SET_PTRACER                       = 0x59616d61
1192
-	PR_SET_PTRACER_ANY                   = -0x1
1192
+	PR_SET_PTRACER_ANY                   = 0xffffffffffffffff
1193 1193
 	PR_SET_SECCOMP                       = 0x16
1194 1194
 	PR_SET_SECUREBITS                    = 0x1c
1195 1195
 	PR_SET_THP_DISABLE                   = 0x29
... ...
@@ -1335,7 +1335,7 @@ const (
1335 1335
 	RLIMIT_RTTIME                        = 0xf
1336 1336
 	RLIMIT_SIGPENDING                    = 0xb
1337 1337
 	RLIMIT_STACK                         = 0x3
1338
-	RLIM_INFINITY                        = -0x1
1338
+	RLIM_INFINITY                        = 0xffffffffffffffff
1339 1339
 	RTAX_ADVMSS                          = 0x8
1340 1340
 	RTAX_CC_ALGO                         = 0x10
1341 1341
 	RTAX_CWND                            = 0x7
... ...
@@ -1904,6 +1904,8 @@ const (
1904 1904
 	TUNSETVNETHDRSZ                      = 0x800454d8
1905 1905
 	TUNSETVNETLE                         = 0x800454dc
1906 1906
 	UMOUNT_NOFOLLOW                      = 0x8
1907
+	UTIME_NOW                            = 0x3fffffff
1908
+	UTIME_OMIT                           = 0x3ffffffe
1907 1909
 	VDISCARD                             = 0x10
1908 1910
 	VEOF                                 = 0x4
1909 1911
 	VEOL                                 = 0x6
... ...
@@ -1933,6 +1935,17 @@ const (
1933 1933
 	WALL                                 = 0x40000000
1934 1934
 	WCLONE                               = 0x80000000
1935 1935
 	WCONTINUED                           = 0x8
1936
+	WDIOC_GETBOOTSTATUS                  = 0x40045702
1937
+	WDIOC_GETPRETIMEOUT                  = 0x40045709
1938
+	WDIOC_GETSTATUS                      = 0x40045701
1939
+	WDIOC_GETSUPPORT                     = 0x40285700
1940
+	WDIOC_GETTEMP                        = 0x40045703
1941
+	WDIOC_GETTIMELEFT                    = 0x4004570a
1942
+	WDIOC_GETTIMEOUT                     = 0x40045707
1943
+	WDIOC_KEEPALIVE                      = 0x40045705
1944
+	WDIOC_SETOPTIONS                     = 0x40045704
1945
+	WDIOC_SETPRETIMEOUT                  = 0xc0045708
1946
+	WDIOC_SETTIMEOUT                     = 0xc0045706
1936 1947
 	WEXITED                              = 0x4
1937 1948
 	WNOHANG                              = 0x1
1938 1949
 	WNOTHREAD                            = 0x20000000
... ...
@@ -1186,7 +1186,7 @@ const (
1186 1186
 	PR_SET_NO_NEW_PRIVS                  = 0x26
1187 1187
 	PR_SET_PDEATHSIG                     = 0x1
1188 1188
 	PR_SET_PTRACER                       = 0x59616d61
1189
-	PR_SET_PTRACER_ANY                   = -0x1
1189
+	PR_SET_PTRACER_ANY                   = 0xffffffffffffffff
1190 1190
 	PR_SET_SECCOMP                       = 0x16
1191 1191
 	PR_SET_SECUREBITS                    = 0x1c
1192 1192
 	PR_SET_THP_DISABLE                   = 0x29
... ...
@@ -1339,7 +1339,7 @@ const (
1339 1339
 	RLIMIT_RTTIME                        = 0xf
1340 1340
 	RLIMIT_SIGPENDING                    = 0xb
1341 1341
 	RLIMIT_STACK                         = 0x3
1342
-	RLIM_INFINITY                        = -0x1
1342
+	RLIM_INFINITY                        = 0xffffffffffffffff
1343 1343
 	RTAX_ADVMSS                          = 0x8
1344 1344
 	RTAX_CC_ALGO                         = 0x10
1345 1345
 	RTAX_CWND                            = 0x7
... ...
@@ -1904,6 +1904,8 @@ const (
1904 1904
 	TUNSETVNETHDRSZ                      = 0x400454d8
1905 1905
 	TUNSETVNETLE                         = 0x400454dc
1906 1906
 	UMOUNT_NOFOLLOW                      = 0x8
1907
+	UTIME_NOW                            = 0x3fffffff
1908
+	UTIME_OMIT                           = 0x3ffffffe
1907 1909
 	VDISCARD                             = 0xd
1908 1910
 	VEOF                                 = 0x4
1909 1911
 	VEOL                                 = 0xb
... ...
@@ -1933,6 +1935,17 @@ const (
1933 1933
 	WALL                                 = 0x40000000
1934 1934
 	WCLONE                               = 0x80000000
1935 1935
 	WCONTINUED                           = 0x8
1936
+	WDIOC_GETBOOTSTATUS                  = 0x80045702
1937
+	WDIOC_GETPRETIMEOUT                  = 0x80045709
1938
+	WDIOC_GETSTATUS                      = 0x80045701
1939
+	WDIOC_GETSUPPORT                     = 0x80285700
1940
+	WDIOC_GETTEMP                        = 0x80045703
1941
+	WDIOC_GETTIMELEFT                    = 0x8004570a
1942
+	WDIOC_GETTIMEOUT                     = 0x80045707
1943
+	WDIOC_KEEPALIVE                      = 0x80045705
1944
+	WDIOC_SETOPTIONS                     = 0x80045704
1945
+	WDIOC_SETPRETIMEOUT                  = 0xc0045708
1946
+	WDIOC_SETTIMEOUT                     = 0xc0045706
1936 1947
 	WEXITED                              = 0x4
1937 1948
 	WNOHANG                              = 0x1
1938 1949
 	WNOTHREAD                            = 0x20000000
1939 1950
new file mode 100644
... ...
@@ -0,0 +1,80 @@
0
+// Code generated by linux/mkall.go generatePtracePair(386, amd64). DO NOT EDIT.
1
+
2
+// +build linux
3
+// +build 386 amd64
4
+
5
+package unix
6
+
7
+import "unsafe"
8
+
9
+// PtraceRegs386 is the registers used by 386 binaries.
10
+type PtraceRegs386 struct {
11
+	Ebx      int32
12
+	Ecx      int32
13
+	Edx      int32
14
+	Esi      int32
15
+	Edi      int32
16
+	Ebp      int32
17
+	Eax      int32
18
+	Xds      int32
19
+	Xes      int32
20
+	Xfs      int32
21
+	Xgs      int32
22
+	Orig_eax int32
23
+	Eip      int32
24
+	Xcs      int32
25
+	Eflags   int32
26
+	Esp      int32
27
+	Xss      int32
28
+}
29
+
30
+// PtraceGetRegs386 fetches the registers used by 386 binaries.
31
+func PtraceGetRegs386(pid int, regsout *PtraceRegs386) error {
32
+	return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
33
+}
34
+
35
+// PtraceSetRegs386 sets the registers used by 386 binaries.
36
+func PtraceSetRegs386(pid int, regs *PtraceRegs386) error {
37
+	return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
38
+}
39
+
40
+// PtraceRegsAmd64 is the registers used by amd64 binaries.
41
+type PtraceRegsAmd64 struct {
42
+	R15      uint64
43
+	R14      uint64
44
+	R13      uint64
45
+	R12      uint64
46
+	Rbp      uint64
47
+	Rbx      uint64
48
+	R11      uint64
49
+	R10      uint64
50
+	R9       uint64
51
+	R8       uint64
52
+	Rax      uint64
53
+	Rcx      uint64
54
+	Rdx      uint64
55
+	Rsi      uint64
56
+	Rdi      uint64
57
+	Orig_rax uint64
58
+	Rip      uint64
59
+	Cs       uint64
60
+	Eflags   uint64
61
+	Rsp      uint64
62
+	Ss       uint64
63
+	Fs_base  uint64
64
+	Gs_base  uint64
65
+	Ds       uint64
66
+	Es       uint64
67
+	Fs       uint64
68
+	Gs       uint64
69
+}
70
+
71
+// PtraceGetRegsAmd64 fetches the registers used by amd64 binaries.
72
+func PtraceGetRegsAmd64(pid int, regsout *PtraceRegsAmd64) error {
73
+	return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
74
+}
75
+
76
+// PtraceSetRegsAmd64 sets the registers used by amd64 binaries.
77
+func PtraceSetRegsAmd64(pid int, regs *PtraceRegsAmd64) error {
78
+	return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
79
+}
0 80
new file mode 100644
... ...
@@ -0,0 +1,41 @@
0
+// Code generated by linux/mkall.go generatePtracePair(arm, arm64). DO NOT EDIT.
1
+
2
+// +build linux
3
+// +build arm arm64
4
+
5
+package unix
6
+
7
+import "unsafe"
8
+
9
+// PtraceRegsArm is the registers used by arm binaries.
10
+type PtraceRegsArm struct {
11
+	Uregs [18]uint32
12
+}
13
+
14
+// PtraceGetRegsArm fetches the registers used by arm binaries.
15
+func PtraceGetRegsArm(pid int, regsout *PtraceRegsArm) error {
16
+	return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
17
+}
18
+
19
+// PtraceSetRegsArm sets the registers used by arm binaries.
20
+func PtraceSetRegsArm(pid int, regs *PtraceRegsArm) error {
21
+	return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
22
+}
23
+
24
+// PtraceRegsArm64 is the registers used by arm64 binaries.
25
+type PtraceRegsArm64 struct {
26
+	Regs   [31]uint64
27
+	Sp     uint64
28
+	Pc     uint64
29
+	Pstate uint64
30
+}
31
+
32
+// PtraceGetRegsArm64 fetches the registers used by arm64 binaries.
33
+func PtraceGetRegsArm64(pid int, regsout *PtraceRegsArm64) error {
34
+	return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
35
+}
36
+
37
+// PtraceSetRegsArm64 sets the registers used by arm64 binaries.
38
+func PtraceSetRegsArm64(pid int, regs *PtraceRegsArm64) error {
39
+	return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
40
+}
0 41
new file mode 100644
... ...
@@ -0,0 +1,50 @@
0
+// Code generated by linux/mkall.go generatePtracePair(mips, mips64). DO NOT EDIT.
1
+
2
+// +build linux
3
+// +build mips mips64
4
+
5
+package unix
6
+
7
+import "unsafe"
8
+
9
+// PtraceRegsMips is the registers used by mips binaries.
10
+type PtraceRegsMips struct {
11
+	Regs     [32]uint64
12
+	Lo       uint64
13
+	Hi       uint64
14
+	Epc      uint64
15
+	Badvaddr uint64
16
+	Status   uint64
17
+	Cause    uint64
18
+}
19
+
20
+// PtraceGetRegsMips fetches the registers used by mips binaries.
21
+func PtraceGetRegsMips(pid int, regsout *PtraceRegsMips) error {
22
+	return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
23
+}
24
+
25
+// PtraceSetRegsMips sets the registers used by mips binaries.
26
+func PtraceSetRegsMips(pid int, regs *PtraceRegsMips) error {
27
+	return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
28
+}
29
+
30
+// PtraceRegsMips64 is the registers used by mips64 binaries.
31
+type PtraceRegsMips64 struct {
32
+	Regs     [32]uint64
33
+	Lo       uint64
34
+	Hi       uint64
35
+	Epc      uint64
36
+	Badvaddr uint64
37
+	Status   uint64
38
+	Cause    uint64
39
+}
40
+
41
+// PtraceGetRegsMips64 fetches the registers used by mips64 binaries.
42
+func PtraceGetRegsMips64(pid int, regsout *PtraceRegsMips64) error {
43
+	return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
44
+}
45
+
46
+// PtraceSetRegsMips64 sets the registers used by mips64 binaries.
47
+func PtraceSetRegsMips64(pid int, regs *PtraceRegsMips64) error {
48
+	return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
49
+}
0 50
new file mode 100644
... ...
@@ -0,0 +1,50 @@
0
+// Code generated by linux/mkall.go generatePtracePair(mipsle, mips64le). DO NOT EDIT.
1
+
2
+// +build linux
3
+// +build mipsle mips64le
4
+
5
+package unix
6
+
7
+import "unsafe"
8
+
9
+// PtraceRegsMipsle is the registers used by mipsle binaries.
10
+type PtraceRegsMipsle struct {
11
+	Regs     [32]uint64
12
+	Lo       uint64
13
+	Hi       uint64
14
+	Epc      uint64
15
+	Badvaddr uint64
16
+	Status   uint64
17
+	Cause    uint64
18
+}
19
+
20
+// PtraceGetRegsMipsle fetches the registers used by mipsle binaries.
21
+func PtraceGetRegsMipsle(pid int, regsout *PtraceRegsMipsle) error {
22
+	return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
23
+}
24
+
25
+// PtraceSetRegsMipsle sets the registers used by mipsle binaries.
26
+func PtraceSetRegsMipsle(pid int, regs *PtraceRegsMipsle) error {
27
+	return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
28
+}
29
+
30
+// PtraceRegsMips64le is the registers used by mips64le binaries.
31
+type PtraceRegsMips64le struct {
32
+	Regs     [32]uint64
33
+	Lo       uint64
34
+	Hi       uint64
35
+	Epc      uint64
36
+	Badvaddr uint64
37
+	Status   uint64
38
+	Cause    uint64
39
+}
40
+
41
+// PtraceGetRegsMips64le fetches the registers used by mips64le binaries.
42
+func PtraceGetRegsMips64le(pid int, regsout *PtraceRegsMips64le) error {
43
+	return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
44
+}
45
+
46
+// PtraceSetRegsMips64le sets the registers used by mips64le binaries.
47
+func PtraceSetRegsMips64le(pid int, regs *PtraceRegsMips64le) error {
48
+	return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
49
+}
... ...
@@ -408,6 +408,17 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
408 408
 
409 409
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
410 410
 
411
+func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
412
+	r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout))
413
+	n = int(r0)
414
+	if e1 != 0 {
415
+		err = errnoErr(e1)
416
+	}
417
+	return
418
+}
419
+
420
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
421
+
411 422
 func Access(path string, mode uint32) (err error) {
412 423
 	var _p0 *byte
413 424
 	_p0, err = BytePtrFromString(path)
... ...
@@ -408,6 +408,17 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
408 408
 
409 409
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
410 410
 
411
+func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
412
+	r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout))
413
+	n = int(r0)
414
+	if e1 != 0 {
415
+		err = errnoErr(e1)
416
+	}
417
+	return
418
+}
419
+
420
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
421
+
411 422
 func Access(path string, mode uint32) (err error) {
412 423
 	var _p0 *byte
413 424
 	_p0, err = BytePtrFromString(path)
... ...
@@ -408,6 +408,17 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
408 408
 
409 409
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
410 410
 
411
+func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
412
+	r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout))
413
+	n = int(r0)
414
+	if e1 != 0 {
415
+		err = errnoErr(e1)
416
+	}
417
+	return
418
+}
419
+
420
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
421
+
411 422
 func Access(path string, mode uint32) (err error) {
412 423
 	var _p0 *byte
413 424
 	_p0, err = BytePtrFromString(path)
... ...
@@ -408,6 +408,17 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
408 408
 
409 409
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
410 410
 
411
+func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
412
+	r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout))
413
+	n = int(r0)
414
+	if e1 != 0 {
415
+		err = errnoErr(e1)
416
+	}
417
+	return
418
+}
419
+
420
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
421
+
411 422
 func Access(path string, mode uint32) (err error) {
412 423
 	var _p0 *byte
413 424
 	_p0, err = BytePtrFromString(path)
... ...
@@ -266,6 +266,17 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) {
266 266
 
267 267
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
268 268
 
269
+func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
270
+	r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout))
271
+	n = int(r0)
272
+	if e1 != 0 {
273
+		err = errnoErr(e1)
274
+	}
275
+	return
276
+}
277
+
278
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
279
+
269 280
 func Madvise(b []byte, behav int) (err error) {
270 281
 	var _p0 unsafe.Pointer
271 282
 	if len(b) > 0 {
... ...
@@ -266,6 +266,17 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) {
266 266
 
267 267
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
268 268
 
269
+func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
270
+	r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout))
271
+	n = int(r0)
272
+	if e1 != 0 {
273
+		err = errnoErr(e1)
274
+	}
275
+	return
276
+}
277
+
278
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
279
+
269 280
 func Madvise(b []byte, behav int) (err error) {
270 281
 	var _p0 unsafe.Pointer
271 282
 	if len(b) > 0 {
... ...
@@ -266,6 +266,17 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) {
266 266
 
267 267
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
268 268
 
269
+func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
270
+	r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout))
271
+	n = int(r0)
272
+	if e1 != 0 {
273
+		err = errnoErr(e1)
274
+	}
275
+	return
276
+}
277
+
278
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
279
+
269 280
 func Madvise(b []byte, behav int) (err error) {
270 281
 	var _p0 unsafe.Pointer
271 282
 	if len(b) > 0 {
... ...
@@ -266,6 +266,17 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) {
266 266
 
267 267
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
268 268
 
269
+func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
270
+	r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout))
271
+	n = int(r0)
272
+	if e1 != 0 {
273
+		err = errnoErr(e1)
274
+	}
275
+	return
276
+}
277
+
278
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
279
+
269 280
 func Madvise(b []byte, behav int) (err error) {
270 281
 	var _p0 unsafe.Pointer
271 282
 	if len(b) > 0 {
... ...
@@ -266,6 +266,17 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) {
266 266
 
267 267
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
268 268
 
269
+func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
270
+	r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout))
271
+	n = int(r0)
272
+	if e1 != 0 {
273
+		err = errnoErr(e1)
274
+	}
275
+	return
276
+}
277
+
278
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
279
+
269 280
 func Madvise(b []byte, behav int) (err error) {
270 281
 	var _p0 unsafe.Pointer
271 282
 	if len(b) > 0 {
... ...
@@ -266,6 +266,17 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) {
266 266
 
267 267
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
268 268
 
269
+func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
270
+	r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout))
271
+	n = int(r0)
272
+	if e1 != 0 {
273
+		err = errnoErr(e1)
274
+	}
275
+	return
276
+}
277
+
278
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
279
+
269 280
 func Madvise(b []byte, behav int) (err error) {
270 281
 	var _p0 unsafe.Pointer
271 282
 	if len(b) > 0 {
... ...
@@ -266,6 +266,17 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) {
266 266
 
267 267
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
268 268
 
269
+func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
270
+	r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout))
271
+	n = int(r0)
272
+	if e1 != 0 {
273
+		err = errnoErr(e1)
274
+	}
275
+	return
276
+}
277
+
278
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
279
+
269 280
 func Madvise(b []byte, behav int) (err error) {
270 281
 	var _p0 unsafe.Pointer
271 282
 	if len(b) > 0 {
... ...
@@ -266,6 +266,17 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) {
266 266
 
267 267
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
268 268
 
269
+func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
270
+	r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout))
271
+	n = int(r0)
272
+	if e1 != 0 {
273
+		err = errnoErr(e1)
274
+	}
275
+	return
276
+}
277
+
278
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
279
+
269 280
 func Madvise(b []byte, behav int) (err error) {
270 281
 	var _p0 unsafe.Pointer
271 282
 	if len(b) > 0 {
... ...
@@ -266,6 +266,17 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) {
266 266
 
267 267
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
268 268
 
269
+func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
270
+	r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout))
271
+	n = int(r0)
272
+	if e1 != 0 {
273
+		err = errnoErr(e1)
274
+	}
275
+	return
276
+}
277
+
278
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
279
+
269 280
 func Madvise(b []byte, behav int) (err error) {
270 281
 	var _p0 unsafe.Pointer
271 282
 	if len(b) > 0 {
... ...
@@ -266,6 +266,17 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) {
266 266
 
267 267
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
268 268
 
269
+func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
270
+	r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout))
271
+	n = int(r0)
272
+	if e1 != 0 {
273
+		err = errnoErr(e1)
274
+	}
275
+	return
276
+}
277
+
278
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
279
+
269 280
 func Madvise(b []byte, behav int) (err error) {
270 281
 	var _p0 unsafe.Pointer
271 282
 	if len(b) > 0 {
... ...
@@ -29,6 +29,7 @@ import (
29 29
 //go:cgo_import_dynamic libc___major __major "libc.so"
30 30
 //go:cgo_import_dynamic libc___minor __minor "libc.so"
31 31
 //go:cgo_import_dynamic libc_ioctl ioctl "libc.so"
32
+//go:cgo_import_dynamic libc_poll poll "libc.so"
32 33
 //go:cgo_import_dynamic libc_access access "libc.so"
33 34
 //go:cgo_import_dynamic libc_adjtime adjtime "libc.so"
34 35
 //go:cgo_import_dynamic libc_chdir chdir "libc.so"
... ...
@@ -153,6 +154,7 @@ import (
153 153
 //go:linkname proc__major libc___major
154 154
 //go:linkname proc__minor libc___minor
155 155
 //go:linkname procioctl libc_ioctl
156
+//go:linkname procpoll libc_poll
156 157
 //go:linkname procAccess libc_access
157 158
 //go:linkname procAdjtime libc_adjtime
158 159
 //go:linkname procChdir libc_chdir
... ...
@@ -278,6 +280,7 @@ var (
278 278
 	proc__major,
279 279
 	proc__minor,
280 280
 	procioctl,
281
+	procpoll,
281 282
 	procAccess,
282 283
 	procAdjtime,
283 284
 	procChdir,
... ...
@@ -557,6 +560,15 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
557 557
 	return
558 558
 }
559 559
 
560
+func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
561
+	r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procpoll)), 3, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout), 0, 0, 0)
562
+	n = int(r0)
563
+	if e1 != 0 {
564
+		err = e1
565
+	}
566
+	return
567
+}
568
+
560 569
 func Access(path string, mode uint32) (err error) {
561 570
 	var _p0 *byte
562 571
 	_p0, err = BytePtrFromString(path)
... ...
@@ -460,3 +460,22 @@ const (
460 460
 	AT_SYMLINK_FOLLOW   = 0x40
461 461
 	AT_SYMLINK_NOFOLLOW = 0x20
462 462
 )
463
+
464
+type PollFd struct {
465
+	Fd      int32
466
+	Events  int16
467
+	Revents int16
468
+}
469
+
470
+const (
471
+	POLLERR    = 0x8
472
+	POLLHUP    = 0x10
473
+	POLLIN     = 0x1
474
+	POLLNVAL   = 0x20
475
+	POLLOUT    = 0x4
476
+	POLLPRI    = 0x2
477
+	POLLRDBAND = 0x80
478
+	POLLRDNORM = 0x40
479
+	POLLWRBAND = 0x100
480
+	POLLWRNORM = 0x4
481
+)
... ...
@@ -470,3 +470,22 @@ const (
470 470
 	AT_SYMLINK_FOLLOW   = 0x40
471 471
 	AT_SYMLINK_NOFOLLOW = 0x20
472 472
 )
473
+
474
+type PollFd struct {
475
+	Fd      int32
476
+	Events  int16
477
+	Revents int16
478
+}
479
+
480
+const (
481
+	POLLERR    = 0x8
482
+	POLLHUP    = 0x10
483
+	POLLIN     = 0x1
484
+	POLLNVAL   = 0x20
485
+	POLLOUT    = 0x4
486
+	POLLPRI    = 0x2
487
+	POLLRDBAND = 0x80
488
+	POLLRDNORM = 0x40
489
+	POLLWRBAND = 0x100
490
+	POLLWRNORM = 0x4
491
+)
... ...
@@ -461,3 +461,22 @@ const (
461 461
 	AT_SYMLINK_FOLLOW   = 0x40
462 462
 	AT_SYMLINK_NOFOLLOW = 0x20
463 463
 )
464
+
465
+type PollFd struct {
466
+	Fd      int32
467
+	Events  int16
468
+	Revents int16
469
+}
470
+
471
+const (
472
+	POLLERR    = 0x8
473
+	POLLHUP    = 0x10
474
+	POLLIN     = 0x1
475
+	POLLNVAL   = 0x20
476
+	POLLOUT    = 0x4
477
+	POLLPRI    = 0x2
478
+	POLLRDBAND = 0x80
479
+	POLLRDNORM = 0x40
480
+	POLLWRBAND = 0x100
481
+	POLLWRNORM = 0x4
482
+)
... ...
@@ -1,6 +1,7 @@
1
+// cgo -godefs types_darwin.go | go run mkpost.go
2
+// Code generated by the command above; see README.md. DO NOT EDIT.
3
+
1 4
 // +build arm64,darwin
2
-// Created by cgo -godefs - DO NOT EDIT
3
-// cgo -godefs types_darwin.go
4 5
 
5 6
 package unix
6 7
 
... ...
@@ -469,3 +470,22 @@ const (
469 469
 	AT_SYMLINK_FOLLOW   = 0x40
470 470
 	AT_SYMLINK_NOFOLLOW = 0x20
471 471
 )
472
+
473
+type PollFd struct {
474
+	Fd      int32
475
+	Events  int16
476
+	Revents int16
477
+}
478
+
479
+const (
480
+	POLLERR    = 0x8
481
+	POLLHUP    = 0x10
482
+	POLLIN     = 0x1
483
+	POLLNVAL   = 0x20
484
+	POLLOUT    = 0x4
485
+	POLLPRI    = 0x2
486
+	POLLRDBAND = 0x80
487
+	POLLRDNORM = 0x40
488
+	POLLWRBAND = 0x100
489
+	POLLWRNORM = 0x4
490
+)
... ...
@@ -446,3 +446,22 @@ const (
446 446
 	AT_FDCWD            = 0xfffafdcd
447 447
 	AT_SYMLINK_NOFOLLOW = 0x1
448 448
 )
449
+
450
+type PollFd struct {
451
+	Fd      int32
452
+	Events  int16
453
+	Revents int16
454
+}
455
+
456
+const (
457
+	POLLERR    = 0x8
458
+	POLLHUP    = 0x10
459
+	POLLIN     = 0x1
460
+	POLLNVAL   = 0x20
461
+	POLLOUT    = 0x4
462
+	POLLPRI    = 0x2
463
+	POLLRDBAND = 0x80
464
+	POLLRDNORM = 0x40
465
+	POLLWRBAND = 0x100
466
+	POLLWRNORM = 0x4
467
+)
... ...
@@ -516,6 +516,26 @@ const (
516 516
 	AT_SYMLINK_NOFOLLOW = 0x200
517 517
 )
518 518
 
519
+type PollFd struct {
520
+	Fd      int32
521
+	Events  int16
522
+	Revents int16
523
+}
524
+
525
+const (
526
+	POLLERR      = 0x8
527
+	POLLHUP      = 0x10
528
+	POLLIN       = 0x1
529
+	POLLINIGNEOF = 0x2000
530
+	POLLNVAL     = 0x20
531
+	POLLOUT      = 0x4
532
+	POLLPRI      = 0x2
533
+	POLLRDBAND   = 0x80
534
+	POLLRDNORM   = 0x40
535
+	POLLWRBAND   = 0x100
536
+	POLLWRNORM   = 0x4
537
+)
538
+
519 539
 type CapRights struct {
520 540
 	Rights [2]uint64
521 541
 }
... ...
@@ -519,6 +519,26 @@ const (
519 519
 	AT_SYMLINK_NOFOLLOW = 0x200
520 520
 )
521 521
 
522
+type PollFd struct {
523
+	Fd      int32
524
+	Events  int16
525
+	Revents int16
526
+}
527
+
528
+const (
529
+	POLLERR      = 0x8
530
+	POLLHUP      = 0x10
531
+	POLLIN       = 0x1
532
+	POLLINIGNEOF = 0x2000
533
+	POLLNVAL     = 0x20
534
+	POLLOUT      = 0x4
535
+	POLLPRI      = 0x2
536
+	POLLRDBAND   = 0x80
537
+	POLLRDNORM   = 0x40
538
+	POLLWRBAND   = 0x100
539
+	POLLWRNORM   = 0x4
540
+)
541
+
522 542
 type CapRights struct {
523 543
 	Rights [2]uint64
524 544
 }
... ...
@@ -519,6 +519,26 @@ const (
519 519
 	AT_SYMLINK_NOFOLLOW = 0x200
520 520
 )
521 521
 
522
+type PollFd struct {
523
+	Fd      int32
524
+	Events  int16
525
+	Revents int16
526
+}
527
+
528
+const (
529
+	POLLERR      = 0x8
530
+	POLLHUP      = 0x10
531
+	POLLIN       = 0x1
532
+	POLLINIGNEOF = 0x2000
533
+	POLLNVAL     = 0x20
534
+	POLLOUT      = 0x4
535
+	POLLPRI      = 0x2
536
+	POLLRDBAND   = 0x80
537
+	POLLRDNORM   = 0x40
538
+	POLLWRBAND   = 0x100
539
+	POLLWRNORM   = 0x4
540
+)
541
+
522 542
 type CapRights struct {
523 543
 	Rights [2]uint64
524 544
 }
... ...
@@ -621,12 +621,12 @@ type Sysinfo_t struct {
621 621
 }
622 622
 
623 623
 type Utsname struct {
624
-	Sysname    [65]int8
625
-	Nodename   [65]int8
626
-	Release    [65]int8
627
-	Version    [65]int8
628
-	Machine    [65]int8
629
-	Domainname [65]int8
624
+	Sysname    [65]byte
625
+	Nodename   [65]byte
626
+	Release    [65]byte
627
+	Version    [65]byte
628
+	Machine    [65]byte
629
+	Domainname [65]byte
630 630
 }
631 631
 
632 632
 type Ustat_t struct {
... ...
@@ -637,12 +637,12 @@ type Sysinfo_t struct {
637 637
 }
638 638
 
639 639
 type Utsname struct {
640
-	Sysname    [65]int8
641
-	Nodename   [65]int8
642
-	Release    [65]int8
643
-	Version    [65]int8
644
-	Machine    [65]int8
645
-	Domainname [65]int8
640
+	Sysname    [65]byte
641
+	Nodename   [65]byte
642
+	Release    [65]byte
643
+	Version    [65]byte
644
+	Machine    [65]byte
645
+	Domainname [65]byte
646 646
 }
647 647
 
648 648
 type Ustat_t struct {
... ...
@@ -609,12 +609,12 @@ type Sysinfo_t struct {
609 609
 }
610 610
 
611 611
 type Utsname struct {
612
-	Sysname    [65]uint8
613
-	Nodename   [65]uint8
614
-	Release    [65]uint8
615
-	Version    [65]uint8
616
-	Machine    [65]uint8
617
-	Domainname [65]uint8
612
+	Sysname    [65]byte
613
+	Nodename   [65]byte
614
+	Release    [65]byte
615
+	Version    [65]byte
616
+	Machine    [65]byte
617
+	Domainname [65]byte
618 618
 }
619 619
 
620 620
 type Ustat_t struct {
... ...
@@ -615,12 +615,12 @@ type Sysinfo_t struct {
615 615
 }
616 616
 
617 617
 type Utsname struct {
618
-	Sysname    [65]int8
619
-	Nodename   [65]int8
620
-	Release    [65]int8
621
-	Version    [65]int8
622
-	Machine    [65]int8
623
-	Domainname [65]int8
618
+	Sysname    [65]byte
619
+	Nodename   [65]byte
620
+	Release    [65]byte
621
+	Version    [65]byte
622
+	Machine    [65]byte
623
+	Domainname [65]byte
624 624
 }
625 625
 
626 626
 type Ustat_t struct {
... ...
@@ -614,12 +614,12 @@ type Sysinfo_t struct {
614 614
 }
615 615
 
616 616
 type Utsname struct {
617
-	Sysname    [65]int8
618
-	Nodename   [65]int8
619
-	Release    [65]int8
620
-	Version    [65]int8
621
-	Machine    [65]int8
622
-	Domainname [65]int8
617
+	Sysname    [65]byte
618
+	Nodename   [65]byte
619
+	Release    [65]byte
620
+	Version    [65]byte
621
+	Machine    [65]byte
622
+	Domainname [65]byte
623 623
 }
624 624
 
625 625
 type Ustat_t struct {
... ...
@@ -618,12 +618,12 @@ type Sysinfo_t struct {
618 618
 }
619 619
 
620 620
 type Utsname struct {
621
-	Sysname    [65]int8
622
-	Nodename   [65]int8
623
-	Release    [65]int8
624
-	Version    [65]int8
625
-	Machine    [65]int8
626
-	Domainname [65]int8
621
+	Sysname    [65]byte
622
+	Nodename   [65]byte
623
+	Release    [65]byte
624
+	Version    [65]byte
625
+	Machine    [65]byte
626
+	Domainname [65]byte
627 627
 }
628 628
 
629 629
 type Ustat_t struct {
... ...
@@ -618,12 +618,12 @@ type Sysinfo_t struct {
618 618
 }
619 619
 
620 620
 type Utsname struct {
621
-	Sysname    [65]int8
622
-	Nodename   [65]int8
623
-	Release    [65]int8
624
-	Version    [65]int8
625
-	Machine    [65]int8
626
-	Domainname [65]int8
621
+	Sysname    [65]byte
622
+	Nodename   [65]byte
623
+	Release    [65]byte
624
+	Version    [65]byte
625
+	Machine    [65]byte
626
+	Domainname [65]byte
627 627
 }
628 628
 
629 629
 type Ustat_t struct {
... ...
@@ -614,12 +614,12 @@ type Sysinfo_t struct {
614 614
 }
615 615
 
616 616
 type Utsname struct {
617
-	Sysname    [65]int8
618
-	Nodename   [65]int8
619
-	Release    [65]int8
620
-	Version    [65]int8
621
-	Machine    [65]int8
622
-	Domainname [65]int8
617
+	Sysname    [65]byte
618
+	Nodename   [65]byte
619
+	Release    [65]byte
620
+	Version    [65]byte
621
+	Machine    [65]byte
622
+	Domainname [65]byte
623 623
 }
624 624
 
625 625
 type Ustat_t struct {
... ...
@@ -625,12 +625,12 @@ type Sysinfo_t struct {
625 625
 }
626 626
 
627 627
 type Utsname struct {
628
-	Sysname    [65]uint8
629
-	Nodename   [65]uint8
630
-	Release    [65]uint8
631
-	Version    [65]uint8
632
-	Machine    [65]uint8
633
-	Domainname [65]uint8
628
+	Sysname    [65]byte
629
+	Nodename   [65]byte
630
+	Release    [65]byte
631
+	Version    [65]byte
632
+	Machine    [65]byte
633
+	Domainname [65]byte
634 634
 }
635 635
 
636 636
 type Ustat_t struct {
... ...
@@ -625,12 +625,12 @@ type Sysinfo_t struct {
625 625
 }
626 626
 
627 627
 type Utsname struct {
628
-	Sysname    [65]uint8
629
-	Nodename   [65]uint8
630
-	Release    [65]uint8
631
-	Version    [65]uint8
632
-	Machine    [65]uint8
633
-	Domainname [65]uint8
628
+	Sysname    [65]byte
629
+	Nodename   [65]byte
630
+	Release    [65]byte
631
+	Version    [65]byte
632
+	Machine    [65]byte
633
+	Domainname [65]byte
634 634
 }
635 635
 
636 636
 type Ustat_t struct {
... ...
@@ -642,12 +642,12 @@ type Sysinfo_t struct {
642 642
 }
643 643
 
644 644
 type Utsname struct {
645
-	Sysname    [65]int8
646
-	Nodename   [65]int8
647
-	Release    [65]int8
648
-	Version    [65]int8
649
-	Machine    [65]int8
650
-	Domainname [65]int8
645
+	Sysname    [65]byte
646
+	Nodename   [65]byte
647
+	Release    [65]byte
648
+	Version    [65]byte
649
+	Machine    [65]byte
650
+	Domainname [65]byte
651 651
 }
652 652
 
653 653
 type Ustat_t struct {
... ...
@@ -601,12 +601,12 @@ type Sysinfo_t struct {
601 601
 }
602 602
 
603 603
 type Utsname struct {
604
-	Sysname    [65]int8
605
-	Nodename   [65]int8
606
-	Release    [65]int8
607
-	Version    [65]int8
608
-	Machine    [65]int8
609
-	Domainname [65]int8
604
+	Sysname    [65]byte
605
+	Nodename   [65]byte
606
+	Release    [65]byte
607
+	Version    [65]byte
608
+	Machine    [65]byte
609
+	Domainname [65]byte
610 610
 }
611 611
 
612 612
 type Ustat_t struct {
... ...
@@ -652,8 +652,6 @@ type Sigset_t struct {
652 652
 	X__val [16]uint64
653 653
 }
654 654
 
655
-const _SC_PAGESIZE = 0x1e
656
-
657 655
 type Termios struct {
658 656
 	Iflag  uint32
659 657
 	Oflag  uint32
... ...
@@ -1,5 +1,5 @@
1
-// Created by cgo -godefs - DO NOT EDIT
2
-// cgo -godefs types_netbsd.go
1
+// cgo -godefs types_netbsd.go | go run mkpost.go
2
+// Code generated by the command above; see README.md. DO NOT EDIT.
3 3
 
4 4
 // +build 386,netbsd
5 5
 
... ...
@@ -387,6 +387,25 @@ const (
387 387
 	AT_SYMLINK_NOFOLLOW = 0x200
388 388
 )
389 389
 
390
+type PollFd struct {
391
+	Fd      int32
392
+	Events  int16
393
+	Revents int16
394
+}
395
+
396
+const (
397
+	POLLERR    = 0x8
398
+	POLLHUP    = 0x10
399
+	POLLIN     = 0x1
400
+	POLLNVAL   = 0x20
401
+	POLLOUT    = 0x4
402
+	POLLPRI    = 0x2
403
+	POLLRDBAND = 0x80
404
+	POLLRDNORM = 0x40
405
+	POLLWRBAND = 0x100
406
+	POLLWRNORM = 0x4
407
+)
408
+
390 409
 type Sysctlnode struct {
391 410
 	Flags           uint32
392 411
 	Num             int32
... ...
@@ -1,5 +1,5 @@
1
-// Created by cgo -godefs - DO NOT EDIT
2
-// cgo -godefs types_netbsd.go
1
+// cgo -godefs types_netbsd.go | go run mkpost.go
2
+// Code generated by the command above; see README.md. DO NOT EDIT.
3 3
 
4 4
 // +build amd64,netbsd
5 5
 
... ...
@@ -394,6 +394,25 @@ const (
394 394
 	AT_SYMLINK_NOFOLLOW = 0x200
395 395
 )
396 396
 
397
+type PollFd struct {
398
+	Fd      int32
399
+	Events  int16
400
+	Revents int16
401
+}
402
+
403
+const (
404
+	POLLERR    = 0x8
405
+	POLLHUP    = 0x10
406
+	POLLIN     = 0x1
407
+	POLLNVAL   = 0x20
408
+	POLLOUT    = 0x4
409
+	POLLPRI    = 0x2
410
+	POLLRDBAND = 0x80
411
+	POLLRDNORM = 0x40
412
+	POLLWRBAND = 0x100
413
+	POLLWRNORM = 0x4
414
+)
415
+
397 416
 type Sysctlnode struct {
398 417
 	Flags           uint32
399 418
 	Num             int32
... ...
@@ -1,5 +1,5 @@
1
-// Created by cgo -godefs - DO NOT EDIT
2
-// cgo -godefs types_netbsd.go
1
+// cgo -godefs types_netbsd.go | go run mkpost.go
2
+// Code generated by the command above; see README.md. DO NOT EDIT.
3 3
 
4 4
 // +build arm,netbsd
5 5
 
... ...
@@ -392,6 +392,25 @@ const (
392 392
 	AT_SYMLINK_NOFOLLOW = 0x200
393 393
 )
394 394
 
395
+type PollFd struct {
396
+	Fd      int32
397
+	Events  int16
398
+	Revents int16
399
+}
400
+
401
+const (
402
+	POLLERR    = 0x8
403
+	POLLHUP    = 0x10
404
+	POLLIN     = 0x1
405
+	POLLNVAL   = 0x20
406
+	POLLOUT    = 0x4
407
+	POLLPRI    = 0x2
408
+	POLLRDBAND = 0x80
409
+	POLLRDNORM = 0x40
410
+	POLLWRBAND = 0x100
411
+	POLLWRNORM = 0x4
412
+)
413
+
395 414
 type Sysctlnode struct {
396 415
 	Flags           uint32
397 416
 	Num             int32
... ...
@@ -1,5 +1,5 @@
1
-// Created by cgo -godefs - DO NOT EDIT
2
-// cgo -godefs types_openbsd.go
1
+// cgo -godefs types_openbsd.go | go run mkpost.go
2
+// Code generated by the command above; see README.md. DO NOT EDIT.
3 3
 
4 4
 // +build 386,openbsd
5 5
 
... ...
@@ -444,3 +444,22 @@ const (
444 444
 	AT_FDCWD            = -0x64
445 445
 	AT_SYMLINK_NOFOLLOW = 0x2
446 446
 )
447
+
448
+type PollFd struct {
449
+	Fd      int32
450
+	Events  int16
451
+	Revents int16
452
+}
453
+
454
+const (
455
+	POLLERR    = 0x8
456
+	POLLHUP    = 0x10
457
+	POLLIN     = 0x1
458
+	POLLNVAL   = 0x20
459
+	POLLOUT    = 0x4
460
+	POLLPRI    = 0x2
461
+	POLLRDBAND = 0x80
462
+	POLLRDNORM = 0x40
463
+	POLLWRBAND = 0x100
464
+	POLLWRNORM = 0x4
465
+)
... ...
@@ -1,5 +1,5 @@
1
-// Created by cgo -godefs - DO NOT EDIT
2
-// cgo -godefs types_openbsd.go
1
+// cgo -godefs types_openbsd.go | go run mkpost.go
2
+// Code generated by the command above; see README.md. DO NOT EDIT.
3 3
 
4 4
 // +build amd64,openbsd
5 5
 
... ...
@@ -451,3 +451,22 @@ const (
451 451
 	AT_FDCWD            = -0x64
452 452
 	AT_SYMLINK_NOFOLLOW = 0x2
453 453
 )
454
+
455
+type PollFd struct {
456
+	Fd      int32
457
+	Events  int16
458
+	Revents int16
459
+}
460
+
461
+const (
462
+	POLLERR    = 0x8
463
+	POLLHUP    = 0x10
464
+	POLLIN     = 0x1
465
+	POLLNVAL   = 0x20
466
+	POLLOUT    = 0x4
467
+	POLLPRI    = 0x2
468
+	POLLRDBAND = 0x80
469
+	POLLRDNORM = 0x40
470
+	POLLWRBAND = 0x100
471
+	POLLWRNORM = 0x4
472
+)
... ...
@@ -1,5 +1,5 @@
1
-// Created by cgo -godefs - DO NOT EDIT
2
-// cgo -godefs types_openbsd.go
1
+// cgo -godefs types_openbsd.go | go run mkpost.go
2
+// Code generated by the command above; see README.md. DO NOT EDIT.
3 3
 
4 4
 // +build arm,openbsd
5 5
 
... ...
@@ -437,3 +437,22 @@ const (
437 437
 	AT_FDCWD            = -0x64
438 438
 	AT_SYMLINK_NOFOLLOW = 0x2
439 439
 )
440
+
441
+type PollFd struct {
442
+	Fd      int32
443
+	Events  int16
444
+	Revents int16
445
+}
446
+
447
+const (
448
+	POLLERR    = 0x8
449
+	POLLHUP    = 0x10
450
+	POLLIN     = 0x1
451
+	POLLNVAL   = 0x20
452
+	POLLOUT    = 0x4
453
+	POLLPRI    = 0x2
454
+	POLLRDBAND = 0x80
455
+	POLLRDNORM = 0x40
456
+	POLLWRBAND = 0x100
457
+	POLLWRNORM = 0x4
458
+)
... ...
@@ -263,11 +263,11 @@ type FdSet struct {
263 263
 }
264 264
 
265 265
 type Utsname struct {
266
-	Sysname  [257]int8
267
-	Nodename [257]int8
268
-	Release  [257]int8
269
-	Version  [257]int8
270
-	Machine  [257]int8
266
+	Sysname  [257]byte
267
+	Nodename [257]byte
268
+	Release  [257]byte
269
+	Version  [257]byte
270
+	Machine  [257]byte
271 271
 }
272 272
 
273 273
 type Ustat_t struct {
... ...
@@ -438,3 +438,22 @@ type Winsize struct {
438 438
 	Xpixel uint16
439 439
 	Ypixel uint16
440 440
 }
441
+
442
+type PollFd struct {
443
+	Fd      int32
444
+	Events  int16
445
+	Revents int16
446
+}
447
+
448
+const (
449
+	POLLERR    = 0x8
450
+	POLLHUP    = 0x10
451
+	POLLIN     = 0x1
452
+	POLLNVAL   = 0x20
453
+	POLLOUT    = 0x4
454
+	POLLPRI    = 0x2
455
+	POLLRDBAND = 0x80
456
+	POLLRDNORM = 0x40
457
+	POLLWRBAND = 0x100
458
+	POLLWRNORM = 0x4
459
+)
... ...
@@ -1,4 +1,4 @@
1
-// Copyright 2011 The Go Authors.  All rights reserved.
1
+// Copyright 2011 The Go Authors. All rights reserved.
2 2
 // Use of this source code is governed by a BSD-style
3 3
 // license that can be found in the LICENSE file.
4 4
 
... ...
@@ -116,7 +116,7 @@ func (p *Proc) Addr() uintptr {
116 116
 
117 117
 //go:uintptrescapes
118 118
 
119
-// Call executes procedure p with arguments a. It will panic, if more then 15 arguments
119
+// Call executes procedure p with arguments a. It will panic, if more than 15 arguments
120 120
 // are supplied.
121 121
 //
122 122
 // The returned error is always non-nil, constructed from the result of GetLastError.
... ...
@@ -289,6 +289,7 @@ func (p *LazyProc) mustFind() {
289 289
 
290 290
 // Addr returns the address of the procedure represented by p.
291 291
 // The return value can be passed to Syscall to run the procedure.
292
+// It will panic if the procedure cannot be found.
292 293
 func (p *LazyProc) Addr() uintptr {
293 294
 	p.mustFind()
294 295
 	return p.proc.Addr()
... ...
@@ -296,8 +297,8 @@ func (p *LazyProc) Addr() uintptr {
296 296
 
297 297
 //go:uintptrescapes
298 298
 
299
-// Call executes procedure p with arguments a. It will panic, if more then 15 arguments
300
-// are supplied.
299
+// Call executes procedure p with arguments a. It will panic, if more than 15 arguments
300
+// are supplied. It will also panic if the procedure cannot be found.
301 301
 //
302 302
 // The returned error is always non-nil, constructed from the result of GetLastError.
303 303
 // Callers must inspect the primary return value to decide whether an error occurred
... ...
@@ -1,4 +1,4 @@
1
-// Copyright 2014 The Go Authors.  All rights reserved.
1
+// Copyright 2014 The Go Authors. All rights reserved.
2 2
 // Use of this source code is governed by a BSD-style
3 3
 // license that can be found in the LICENSE file.
4 4
 
... ...
@@ -1,4 +1,4 @@
1
-// Copyright 2010 The Go Authors.  All rights reserved.
1
+// Copyright 2010 The Go Authors. All rights reserved.
2 2
 // Use of this source code is governed by a BSD-style
3 3
 // license that can be found in the LICENSE file.
4 4
 
... ...
@@ -1,4 +1,4 @@
1
-// Copyright 2017 The Go Authors.  All rights reserved.
1
+// Copyright 2017 The Go Authors. All rights reserved.
2 2
 // Use of this source code is governed by a BSD-style
3 3
 // license that can be found in the LICENSE file.
4 4
 
... ...
@@ -1,4 +1,4 @@
1
-// Copyright 2009 The Go Authors.  All rights reserved.
1
+// Copyright 2009 The Go Authors. All rights reserved.
2 2
 // Use of this source code is governed by a BSD-style
3 3
 // license that can be found in the LICENSE file.
4 4
 
... ...
@@ -1,4 +1,4 @@
1
-// Copyright 2012 The Go Authors.  All rights reserved.
1
+// Copyright 2012 The Go Authors. All rights reserved.
2 2
 // Use of this source code is governed by a BSD-style
3 3
 // license that can be found in the LICENSE file.
4 4
 
... ...
@@ -1,4 +1,4 @@
1
-// Copyright 2012 The Go Authors.  All rights reserved.
1
+// Copyright 2012 The Go Authors. All rights reserved.
2 2
 // Use of this source code is governed by a BSD-style
3 3
 // license that can be found in the LICENSE file.
4 4
 
... ...
@@ -1,4 +1,4 @@
1
-// Copyright 2012 The Go Authors.  All rights reserved.
1
+// Copyright 2012 The Go Authors. All rights reserved.
2 2
 // Use of this source code is governed by a BSD-style
3 3
 // license that can be found in the LICENSE file.
4 4
 
... ...
@@ -1,4 +1,4 @@
1
-// Copyright 2014 The Go Authors.  All rights reserved.
1
+// Copyright 2014 The Go Authors. All rights reserved.
2 2
 // Use of this source code is governed by a BSD-style
3 3
 // license that can be found in the LICENSE file.
4 4
 
... ...
@@ -1,4 +1,4 @@
1
-// Copyright 2014 The Go Authors.  All rights reserved.
1
+// Copyright 2014 The Go Authors. All rights reserved.
2 2
 // Use of this source code is governed by a BSD-style
3 3
 // license that can be found in the LICENSE file.
4 4
 
... ...
@@ -5,10 +5,10 @@
5 5
 // +build windows
6 6
 
7 7
 // Package windows contains an interface to the low-level operating system
8
-// primitives.  OS details vary depending on the underlying system, and
8
+// primitives. OS details vary depending on the underlying system, and
9 9
 // by default, godoc will display the OS-specific documentation for the current
10
-// system.  If you want godoc to display syscall documentation for another
11
-// system, set $GOOS and $GOARCH to the desired system.  For example, if
10
+// system. If you want godoc to display syscall documentation for another
11
+// system, set $GOOS and $GOARCH to the desired system. For example, if
12 12
 // you want to view documentation for freebsd/arm on linux/amd64, set $GOOS
13 13
 // to freebsd and $GOARCH to arm.
14 14
 // The primary use of this package is inside other packages that provide a more
... ...
@@ -1,4 +1,4 @@
1
-// Copyright 2009 The Go Authors.  All rights reserved.
1
+// Copyright 2009 The Go Authors. All rights reserved.
2 2
 // Use of this source code is governed by a BSD-style
3 3
 // license that can be found in the LICENSE file.
4 4
 
... ...
@@ -1,4 +1,4 @@
1
-// Copyright 2011 The Go Authors.  All rights reserved.
1
+// Copyright 2011 The Go Authors. All rights reserved.
2 2
 // Use of this source code is governed by a BSD-style
3 3
 // license that can be found in the LICENSE file.
4 4
 
... ...
@@ -1,4 +1,4 @@
1
-// Copyright 2011 The Go Authors.  All rights reserved.
1
+// Copyright 2011 The Go Authors. All rights reserved.
2 2
 // Use of this source code is governed by a BSD-style
3 3
 // license that can be found in the LICENSE file.
4 4
 
... ...
@@ -1,4 +1,4 @@
1
-// Copyright 2011 The Go Authors.  All rights reserved.
1
+// Copyright 2011 The Go Authors. All rights reserved.
2 2
 // Use of this source code is governed by a BSD-style
3 3
 // license that can be found in the LICENSE file.
4 4