* Use export GOPROXY=https://goproxy.cn before build * Add go version to generate command * Reproduced the entire build procedure - see notes I've used: sudo go clean -i -r -cache -testcache -modcache make clean make generate make golangci-lint make revive make swagger-check make swagger-validate make test-vendor <--- this now fails make vendor <--- this now produced changes git commit -a <--- this commit * Add fix from #8059 to complete CI teststags/v1.10.0-rc1
@@ -102,14 +102,16 @@ require ( | |||
github.com/willf/bitset v0.0.0-20180426185212-8ce1146b8621 // indirect | |||
github.com/yohcop/openid-go v0.0.0-20160914080427-2c050d2dae53 | |||
go.etcd.io/bbolt v1.3.3 // indirect | |||
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586 | |||
golang.org/x/crypto v0.0.0-20190829043050-9756ffdc2472 | |||
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 | |||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 | |||
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456 | |||
golang.org/x/sys v0.0.0-20190902133755-9109b7679e13 | |||
golang.org/x/text v0.3.2 | |||
golang.org/x/tools v0.0.0-20190828213141-aed303cbaa74 // indirect | |||
golang.org/x/tools v0.0.0-20190830223141-573d9926052a // indirect | |||
google.golang.org/appengine v1.6.2 // indirect | |||
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect | |||
gopkg.in/asn1-ber.v1 v1.0.0-20150924051756-4e86f4367175 // indirect | |||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect | |||
gopkg.in/editorconfig/editorconfig-core-go.v1 v1.3.0 | |||
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df | |||
gopkg.in/ini.v1 v1.46.0 |
@@ -431,6 +431,8 @@ golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49N | |||
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= | |||
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586 h1:7KByu05hhLed2MO29w7p1XfZvZ13m8mub3shuVftRs0= | |||
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= | |||
golang.org/x/crypto v0.0.0-20190829043050-9756ffdc2472 h1:Gv7RPwsi3eZ2Fgewe3CBsuOebPwO27PoXzRpJPsvSSM= | |||
golang.org/x/crypto v0.0.0-20190829043050-9756ffdc2472/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= | |||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= | |||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= | |||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= | |||
@@ -490,8 +492,8 @@ golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7w | |||
golang.org/x/sys v0.0.0-20190730183949-1393eb018365/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | |||
golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3 h1:4y9KwBHBgBNwDbtu44R5o1fdOCQUEXhbk/P4A9WmJq0= | |||
golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | |||
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456 h1:ng0gs1AKnRRuEMZoTLLlbOd+C17zUDepwGQBb/n+JVg= | |||
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | |||
golang.org/x/sys v0.0.0-20190902133755-9109b7679e13 h1:tdsQdquKbTNMsSZLqnLELJGzCANp9oXhu6zFBW6ODx4= | |||
golang.org/x/sys v0.0.0-20190902133755-9109b7679e13/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | |||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= | |||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= | |||
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= | |||
@@ -512,8 +514,8 @@ golang.org/x/tools v0.0.0-20190606050223-4d9ae51c2468/go.mod h1:/rFqwRUd4F7ZHNgw | |||
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= | |||
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= | |||
golang.org/x/tools v0.0.0-20190729092621-ff9f1409240a/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI= | |||
golang.org/x/tools v0.0.0-20190828213141-aed303cbaa74 h1:4cFkmztxtMslUX2SctSl+blCyXfpzhGOy9LhKAqSMA4= | |||
golang.org/x/tools v0.0.0-20190828213141-aed303cbaa74/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= | |||
golang.org/x/tools v0.0.0-20190830223141-573d9926052a h1:XAHT1kdPpnU8Hk+FPi42KZFhtNFEk4vBg1U4OmIeHTU= | |||
golang.org/x/tools v0.0.0-20190830223141-573d9926052a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= | |||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= | |||
google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= | |||
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= | |||
@@ -526,6 +528,8 @@ google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 | |||
google.golang.org/appengine v1.6.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= | |||
google.golang.org/appengine v1.6.1 h1:QzqyMA1tlu6CgqCDUtU9V+ZKhLFT2dkJuANu5QaxI3I= | |||
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= | |||
google.golang.org/appengine v1.6.2 h1:j8RI1yW0SkI+paT6uGwMlrMI/6zwYA6/CFil8rxOzGI= | |||
google.golang.org/appengine v1.6.2/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= | |||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= | |||
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= | |||
google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= | |||
@@ -545,6 +549,8 @@ gopkg.in/asn1-ber.v1 v1.0.0-20150924051756-4e86f4367175/go.mod h1:cuepJuh7vyXfUy | |||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | |||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= | |||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | |||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= | |||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | |||
gopkg.in/editorconfig/editorconfig-core-go.v1 v1.3.0 h1:oxOEwvhxLMpWpN+0pb2r9TWrM0DCFBHxbuIlS27tmFg= | |||
gopkg.in/editorconfig/editorconfig-core-go.v1 v1.3.0/go.mod h1:s2mQFI9McjArkyCwyEwU//+luQENTnD/Lfb/7Sj3/kQ= | |||
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= |
@@ -100,7 +100,7 @@ func TestPullCreate_TitleEscape(t *testing.T) { | |||
htmlDoc = NewHTMLParser(t, resp.Body) | |||
titleHTML, err := htmlDoc.doc.Find(".comments .event .text b").First().Html() | |||
assert.NoError(t, err) | |||
assert.Equal(t, "<i>XSS PR</i>", titleHTML) | |||
assert.Equal(t, "<strike><i>XSS PR</i></strike>", titleHTML) | |||
titleHTML, err = htmlDoc.doc.Find(".comments .event .text b").Next().Html() | |||
assert.NoError(t, err) | |||
assert.Equal(t, "<u>XSS PR</u>", titleHTML) |
@@ -7,6 +7,7 @@ | |||
package unix | |||
import ( | |||
"math/bits" | |||
"unsafe" | |||
) | |||
@@ -79,50 +80,7 @@ func (s *CPUSet) IsSet(cpu int) bool { | |||
func (s *CPUSet) Count() int { | |||
c := 0 | |||
for _, b := range s { | |||
c += onesCount64(uint64(b)) | |||
c += bits.OnesCount64(uint64(b)) | |||
} | |||
return c | |||
} | |||
// onesCount64 is a copy of Go 1.9's math/bits.OnesCount64. | |||
// Once this package can require Go 1.9, we can delete this | |||
// and update the caller to use bits.OnesCount64. | |||
func onesCount64(x uint64) int { | |||
const m0 = 0x5555555555555555 // 01010101 ... | |||
const m1 = 0x3333333333333333 // 00110011 ... | |||
const m2 = 0x0f0f0f0f0f0f0f0f // 00001111 ... | |||
// Unused in this function, but definitions preserved for | |||
// documentation purposes: | |||
// | |||
// const m3 = 0x00ff00ff00ff00ff // etc. | |||
// const m4 = 0x0000ffff0000ffff | |||
// | |||
// Implementation: Parallel summing of adjacent bits. | |||
// See "Hacker's Delight", Chap. 5: Counting Bits. | |||
// The following pattern shows the general approach: | |||
// | |||
// x = x>>1&(m0&m) + x&(m0&m) | |||
// x = x>>2&(m1&m) + x&(m1&m) | |||
// x = x>>4&(m2&m) + x&(m2&m) | |||
// x = x>>8&(m3&m) + x&(m3&m) | |||
// x = x>>16&(m4&m) + x&(m4&m) | |||
// x = x>>32&(m5&m) + x&(m5&m) | |||
// return int(x) | |||
// | |||
// Masking (& operations) can be left away when there's no | |||
// danger that a field's sum will carry over into the next | |||
// field: Since the result cannot be > 64, 8 bits is enough | |||
// and we can ignore the masks for the shifts by 8 and up. | |||
// Per "Hacker's Delight", the first line can be simplified | |||
// more, but it saves at best one instruction, so we leave | |||
// it alone for clarity. | |||
const m = 1<<64 - 1 | |||
x = x>>1&(m0&m) + x&(m0&m) | |||
x = x>>2&(m1&m) + x&(m1&m) | |||
x = (x>>4 + x) & (m2 & m) | |||
x += x >> 8 | |||
x += x >> 16 | |||
x += x >> 32 | |||
return int(x) & (1<<7 - 1) | |||
} |
@@ -6,7 +6,19 @@ | |||
package unix | |||
import "runtime" | |||
import ( | |||
"runtime" | |||
"unsafe" | |||
) | |||
// ioctl itself should not be exposed directly, but additional get/set | |||
// functions for specific types are permissible. | |||
// IoctlSetInt performs an ioctl operation which sets an integer value | |||
// on fd, using the specified request number. | |||
func IoctlSetInt(fd int, req uint, value int) error { | |||
return ioctl(fd, req, uintptr(value)) | |||
} | |||
// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument. | |||
// | |||
@@ -14,7 +26,7 @@ import "runtime" | |||
func IoctlSetWinsize(fd int, req uint, value *Winsize) error { | |||
// TODO: if we get the chance, remove the req parameter and | |||
// hardcode TIOCSWINSZ. | |||
err := ioctlSetWinsize(fd, req, value) | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(value))) | |||
runtime.KeepAlive(value) | |||
return err | |||
} | |||
@@ -24,7 +36,30 @@ func IoctlSetWinsize(fd int, req uint, value *Winsize) error { | |||
// The req value will usually be TCSETA or TIOCSETA. | |||
func IoctlSetTermios(fd int, req uint, value *Termios) error { | |||
// TODO: if we get the chance, remove the req parameter. | |||
err := ioctlSetTermios(fd, req, value) | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(value))) | |||
runtime.KeepAlive(value) | |||
return err | |||
} | |||
// IoctlGetInt performs an ioctl operation which gets an integer value | |||
// from fd, using the specified request number. | |||
// | |||
// A few ioctl requests use the return value as an output parameter; | |||
// for those, IoctlRetInt should be used instead of this function. | |||
func IoctlGetInt(fd int, req uint) (int, error) { | |||
var value int | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) | |||
return value, err | |||
} | |||
func IoctlGetWinsize(fd int, req uint) (*Winsize, error) { | |||
var value Winsize | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) | |||
return &value, err | |||
} | |||
func IoctlGetTermios(fd int, req uint) (*Termios, error) { | |||
var value Termios | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) | |||
return &value, err | |||
} |
@@ -206,6 +206,7 @@ struct ltchars { | |||
#include <linux/netfilter/nfnetlink.h> | |||
#include <linux/netlink.h> | |||
#include <linux/net_namespace.h> | |||
#include <linux/nsfs.h> | |||
#include <linux/perf_event.h> | |||
#include <linux/random.h> | |||
#include <linux/reboot.h> | |||
@@ -451,6 +452,7 @@ ccflags="$@" | |||
$2 ~ /^SYSCTL_VERS/ || | |||
$2 !~ "MNT_BITS" && | |||
$2 ~ /^(MS|MNT|UMOUNT)_/ || | |||
$2 ~ /^NS_GET_/ || | |||
$2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ || | |||
$2 ~ /^(O|F|[ES]?FD|NAME|S|PTRACE|PT)_/ || | |||
$2 ~ /^KEXEC_/ || |
@@ -350,49 +350,12 @@ func (w WaitStatus) Signal() Signal { | |||
func (w WaitStatus) Continued() bool { return w&0x01000000 != 0 } | |||
func (w WaitStatus) CoreDump() bool { return w&0x200 != 0 } | |||
func (w WaitStatus) CoreDump() bool { return w&0x80 == 0x80 } | |||
func (w WaitStatus) TrapCause() int { return -1 } | |||
//sys ioctl(fd int, req uint, arg uintptr) (err error) | |||
// ioctl itself should not be exposed directly, but additional get/set | |||
// functions for specific types are permissible. | |||
// IoctlSetInt performs an ioctl operation which sets an integer value | |||
// on fd, using the specified request number. | |||
func IoctlSetInt(fd int, req uint, value int) error { | |||
return ioctl(fd, req, uintptr(value)) | |||
} | |||
func ioctlSetWinsize(fd int, req uint, value *Winsize) error { | |||
return ioctl(fd, req, uintptr(unsafe.Pointer(value))) | |||
} | |||
func ioctlSetTermios(fd int, req uint, value *Termios) error { | |||
return ioctl(fd, req, uintptr(unsafe.Pointer(value))) | |||
} | |||
// IoctlGetInt performs an ioctl operation which gets an integer value | |||
// from fd, using the specified request number. | |||
func IoctlGetInt(fd int, req uint) (int, error) { | |||
var value int | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) | |||
return value, err | |||
} | |||
func IoctlGetWinsize(fd int, req uint) (*Winsize, error) { | |||
var value Winsize | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) | |||
return &value, err | |||
} | |||
func IoctlGetTermios(fd int, req uint) (*Termios, error) { | |||
var value Termios | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) | |||
return &value, err | |||
} | |||
// fcntl must never be called with cmd=F_DUP2FD because it doesn't work on AIX | |||
// There is no way to create a custom fcntl and to keep //sys fcntl easily, | |||
// Therefore, the programmer must call dup2 instead of fcntl in this case. |
@@ -339,43 +339,6 @@ func Kill(pid int, signum syscall.Signal) (err error) { return kill(pid, int(sig | |||
//sys ioctl(fd int, req uint, arg uintptr) (err error) | |||
// ioctl itself should not be exposed directly, but additional get/set | |||
// functions for specific types are permissible. | |||
// IoctlSetInt performs an ioctl operation which sets an integer value | |||
// on fd, using the specified request number. | |||
func IoctlSetInt(fd int, req uint, value int) error { | |||
return ioctl(fd, req, uintptr(value)) | |||
} | |||
func ioctlSetWinsize(fd int, req uint, value *Winsize) error { | |||
return ioctl(fd, req, uintptr(unsafe.Pointer(value))) | |||
} | |||
func ioctlSetTermios(fd int, req uint, value *Termios) error { | |||
return ioctl(fd, req, uintptr(unsafe.Pointer(value))) | |||
} | |||
// IoctlGetInt performs an ioctl operation which gets an integer value | |||
// from fd, using the specified request number. | |||
func IoctlGetInt(fd int, req uint) (int, error) { | |||
var value int | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) | |||
return value, err | |||
} | |||
func IoctlGetWinsize(fd int, req uint) (*Winsize, error) { | |||
var value Winsize | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) | |||
return &value, err | |||
} | |||
func IoctlGetTermios(fd int, req uint) (*Termios, error) { | |||
var value Termios | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) | |||
return &value, err | |||
} | |||
func Uname(uname *Utsname) error { | |||
mib := []_C_int{CTL_KERN, KERN_OSTYPE} | |||
n := unsafe.Sizeof(uname.Sysname) |
@@ -150,43 +150,6 @@ func setattrlistTimes(path string, times []Timespec, flags int) error { | |||
//sys ioctl(fd int, req uint, arg uintptr) (err error) | |||
// ioctl itself should not be exposed directly, but additional get/set | |||
// functions for specific types are permissible. | |||
// IoctlSetInt performs an ioctl operation which sets an integer value | |||
// on fd, using the specified request number. | |||
func IoctlSetInt(fd int, req uint, value int) error { | |||
return ioctl(fd, req, uintptr(value)) | |||
} | |||
func ioctlSetWinsize(fd int, req uint, value *Winsize) error { | |||
return ioctl(fd, req, uintptr(unsafe.Pointer(value))) | |||
} | |||
func ioctlSetTermios(fd int, req uint, value *Termios) error { | |||
return ioctl(fd, req, uintptr(unsafe.Pointer(value))) | |||
} | |||
// IoctlGetInt performs an ioctl operation which gets an integer value | |||
// from fd, using the specified request number. | |||
func IoctlGetInt(fd int, req uint) (int, error) { | |||
var value int | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) | |||
return value, err | |||
} | |||
func IoctlGetWinsize(fd int, req uint) (*Winsize, error) { | |||
var value Winsize | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) | |||
return &value, err | |||
} | |||
func IoctlGetTermios(fd int, req uint) (*Termios, error) { | |||
var value Termios | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) | |||
return &value, err | |||
} | |||
func sysctlUname(mib []_C_int, old *byte, oldlen *uintptr) error { | |||
err := sysctl(mib, old, oldlen, nil, 0) | |||
if err != nil { |
@@ -201,43 +201,6 @@ func setattrlistTimes(path string, times []Timespec, flags int) error { | |||
//sys ioctl(fd int, req uint, arg uintptr) (err error) | |||
// ioctl itself should not be exposed directly, but additional get/set | |||
// functions for specific types are permissible. | |||
// IoctlSetInt performs an ioctl operation which sets an integer value | |||
// on fd, using the specified request number. | |||
func IoctlSetInt(fd int, req uint, value int) error { | |||
return ioctl(fd, req, uintptr(value)) | |||
} | |||
func ioctlSetWinsize(fd int, req uint, value *Winsize) error { | |||
return ioctl(fd, req, uintptr(unsafe.Pointer(value))) | |||
} | |||
func ioctlSetTermios(fd int, req uint, value *Termios) error { | |||
return ioctl(fd, req, uintptr(unsafe.Pointer(value))) | |||
} | |||
// IoctlGetInt performs an ioctl operation which gets an integer value | |||
// from fd, using the specified request number. | |||
func IoctlGetInt(fd int, req uint) (int, error) { | |||
var value int | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) | |||
return value, err | |||
} | |||
func IoctlGetWinsize(fd int, req uint) (*Winsize, error) { | |||
var value Winsize | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) | |||
return &value, err | |||
} | |||
func IoctlGetTermios(fd int, req uint) (*Termios, error) { | |||
var value Termios | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) | |||
return &value, err | |||
} | |||
func Uname(uname *Utsname) error { | |||
mib := []_C_int{CTL_KERN, KERN_OSTYPE} | |||
n := unsafe.Sizeof(uname.Sysname) |
@@ -71,6 +71,17 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { | |||
// ioctl itself should not be exposed directly, but additional get/set | |||
// functions for specific types are permissible. | |||
// IoctlRetInt performs an ioctl operation specified by req on a device | |||
// associated with opened file descriptor fd, and returns a non-negative | |||
// integer that is returned by the ioctl syscall. | |||
func IoctlRetInt(fd int, req uint) (int, error) { | |||
ret, _, err := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), 0) | |||
if err != 0 { | |||
return 0, err | |||
} | |||
return int(ret), nil | |||
} | |||
// IoctlSetPointerInt performs an ioctl operation which sets an | |||
// integer value on fd, using the specified request number. The ioctl | |||
// argument is called with a pointer to the integer value, rather than | |||
@@ -80,52 +91,18 @@ func IoctlSetPointerInt(fd int, req uint, value int) error { | |||
return ioctl(fd, req, uintptr(unsafe.Pointer(&v))) | |||
} | |||
// IoctlSetInt performs an ioctl operation which sets an integer value | |||
// on fd, using the specified request number. | |||
func IoctlSetInt(fd int, req uint, value int) error { | |||
return ioctl(fd, req, uintptr(value)) | |||
} | |||
func ioctlSetWinsize(fd int, req uint, value *Winsize) error { | |||
return ioctl(fd, req, uintptr(unsafe.Pointer(value))) | |||
} | |||
func ioctlSetTermios(fd int, req uint, value *Termios) error { | |||
return ioctl(fd, req, uintptr(unsafe.Pointer(value))) | |||
} | |||
func IoctlSetRTCTime(fd int, value *RTCTime) error { | |||
err := ioctl(fd, RTC_SET_TIME, uintptr(unsafe.Pointer(value))) | |||
runtime.KeepAlive(value) | |||
return err | |||
} | |||
// IoctlGetInt performs an ioctl operation which gets an integer value | |||
// from fd, using the specified request number. | |||
func IoctlGetInt(fd int, req uint) (int, error) { | |||
var value int | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) | |||
return value, err | |||
} | |||
func IoctlGetUint32(fd int, req uint) (uint32, error) { | |||
var value uint32 | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) | |||
return value, err | |||
} | |||
func IoctlGetWinsize(fd int, req uint) (*Winsize, error) { | |||
var value Winsize | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) | |||
return &value, err | |||
} | |||
func IoctlGetTermios(fd int, req uint) (*Termios, error) { | |||
var value Termios | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) | |||
return &value, err | |||
} | |||
func IoctlGetRTCTime(fd int) (*RTCTime, error) { | |||
var value RTCTime | |||
err := ioctl(fd, RTC_RD_TIME, uintptr(unsafe.Pointer(&value))) |
@@ -187,43 +187,6 @@ func setattrlistTimes(path string, times []Timespec, flags int) error { | |||
//sys ioctl(fd int, req uint, arg uintptr) (err error) | |||
// ioctl itself should not be exposed directly, but additional get/set | |||
// functions for specific types are permissible. | |||
// IoctlSetInt performs an ioctl operation which sets an integer value | |||
// on fd, using the specified request number. | |||
func IoctlSetInt(fd int, req uint, value int) error { | |||
return ioctl(fd, req, uintptr(value)) | |||
} | |||
func ioctlSetWinsize(fd int, req uint, value *Winsize) error { | |||
return ioctl(fd, req, uintptr(unsafe.Pointer(value))) | |||
} | |||
func ioctlSetTermios(fd int, req uint, value *Termios) error { | |||
return ioctl(fd, req, uintptr(unsafe.Pointer(value))) | |||
} | |||
// IoctlGetInt performs an ioctl operation which gets an integer value | |||
// from fd, using the specified request number. | |||
func IoctlGetInt(fd int, req uint) (int, error) { | |||
var value int | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) | |||
return value, err | |||
} | |||
func IoctlGetWinsize(fd int, req uint) (*Winsize, error) { | |||
var value Winsize | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) | |||
return &value, err | |||
} | |||
func IoctlGetTermios(fd int, req uint) (*Termios, error) { | |||
var value Termios | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) | |||
return &value, err | |||
} | |||
func IoctlGetPtmget(fd int, req uint) (*Ptmget, error) { | |||
var value Ptmget | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) |
@@ -178,43 +178,6 @@ func setattrlistTimes(path string, times []Timespec, flags int) error { | |||
//sys ioctl(fd int, req uint, arg uintptr) (err error) | |||
// ioctl itself should not be exposed directly, but additional get/set | |||
// functions for specific types are permissible. | |||
// IoctlSetInt performs an ioctl operation which sets an integer value | |||
// on fd, using the specified request number. | |||
func IoctlSetInt(fd int, req uint, value int) error { | |||
return ioctl(fd, req, uintptr(value)) | |||
} | |||
func ioctlSetWinsize(fd int, req uint, value *Winsize) error { | |||
return ioctl(fd, req, uintptr(unsafe.Pointer(value))) | |||
} | |||
func ioctlSetTermios(fd int, req uint, value *Termios) error { | |||
return ioctl(fd, req, uintptr(unsafe.Pointer(value))) | |||
} | |||
// IoctlGetInt performs an ioctl operation which gets an integer value | |||
// from fd, using the specified request number. | |||
func IoctlGetInt(fd int, req uint) (int, error) { | |||
var value int | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) | |||
return value, err | |||
} | |||
func IoctlGetWinsize(fd int, req uint) (*Winsize, error) { | |||
var value Winsize | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) | |||
return &value, err | |||
} | |||
func IoctlGetTermios(fd int, req uint) (*Termios, error) { | |||
var value Termios | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) | |||
return &value, err | |||
} | |||
//sys ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) | |||
func Ppoll(fds []PollFd, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { |
@@ -553,40 +553,10 @@ func Minor(dev uint64) uint32 { | |||
//sys ioctl(fd int, req uint, arg uintptr) (err error) | |||
func IoctlSetInt(fd int, req uint, value int) (err error) { | |||
return ioctl(fd, req, uintptr(value)) | |||
} | |||
func ioctlSetWinsize(fd int, req uint, value *Winsize) (err error) { | |||
return ioctl(fd, req, uintptr(unsafe.Pointer(value))) | |||
} | |||
func ioctlSetTermios(fd int, req uint, value *Termios) (err error) { | |||
return ioctl(fd, req, uintptr(unsafe.Pointer(value))) | |||
} | |||
func IoctlSetTermio(fd int, req uint, value *Termio) (err error) { | |||
return ioctl(fd, req, uintptr(unsafe.Pointer(value))) | |||
} | |||
func IoctlGetInt(fd int, req uint) (int, error) { | |||
var value int | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) | |||
return value, err | |||
} | |||
func IoctlGetWinsize(fd int, req uint) (*Winsize, error) { | |||
var value Winsize | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) | |||
return &value, err | |||
} | |||
func IoctlGetTermios(fd int, req uint) (*Termios, error) { | |||
var value Termios | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) | |||
return &value, err | |||
} | |||
func IoctlGetTermio(fd int, req uint) (*Termio, error) { | |||
var value Termio | |||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) |
@@ -1408,6 +1408,10 @@ const ( | |||
NLM_F_ROOT = 0x100 | |||
NOFLSH = 0x80 | |||
NSFS_MAGIC = 0x6e736673 | |||
NS_GET_NSTYPE = 0xb703 | |||
NS_GET_OWNER_UID = 0xb704 | |||
NS_GET_PARENT = 0xb702 | |||
NS_GET_USERNS = 0xb701 | |||
OCFS2_SUPER_MAGIC = 0x7461636f | |||
OCRNL = 0x8 | |||
OFDEL = 0x80 |
@@ -1408,6 +1408,10 @@ const ( | |||
NLM_F_ROOT = 0x100 | |||
NOFLSH = 0x80 | |||
NSFS_MAGIC = 0x6e736673 | |||
NS_GET_NSTYPE = 0xb703 | |||
NS_GET_OWNER_UID = 0xb704 | |||
NS_GET_PARENT = 0xb702 | |||
NS_GET_USERNS = 0xb701 | |||
OCFS2_SUPER_MAGIC = 0x7461636f | |||
OCRNL = 0x8 | |||
OFDEL = 0x80 |
@@ -1406,6 +1406,10 @@ const ( | |||
NLM_F_ROOT = 0x100 | |||
NOFLSH = 0x80 | |||
NSFS_MAGIC = 0x6e736673 | |||
NS_GET_NSTYPE = 0xb703 | |||
NS_GET_OWNER_UID = 0xb704 | |||
NS_GET_PARENT = 0xb702 | |||
NS_GET_USERNS = 0xb701 | |||
OCFS2_SUPER_MAGIC = 0x7461636f | |||
OCRNL = 0x8 | |||
OFDEL = 0x80 |
@@ -1409,6 +1409,10 @@ const ( | |||
NLM_F_ROOT = 0x100 | |||
NOFLSH = 0x80 | |||
NSFS_MAGIC = 0x6e736673 | |||
NS_GET_NSTYPE = 0xb703 | |||
NS_GET_OWNER_UID = 0xb704 | |||
NS_GET_PARENT = 0xb702 | |||
NS_GET_USERNS = 0xb701 | |||
OCFS2_SUPER_MAGIC = 0x7461636f | |||
OCRNL = 0x8 | |||
OFDEL = 0x80 |
@@ -1406,6 +1406,10 @@ const ( | |||
NLM_F_ROOT = 0x100 | |||
NOFLSH = 0x80 | |||
NSFS_MAGIC = 0x6e736673 | |||
NS_GET_NSTYPE = 0x2000b703 | |||
NS_GET_OWNER_UID = 0x2000b704 | |||
NS_GET_PARENT = 0x2000b702 | |||
NS_GET_USERNS = 0x2000b701 | |||
OCFS2_SUPER_MAGIC = 0x7461636f | |||
OCRNL = 0x8 | |||
OFDEL = 0x80 |
@@ -1406,6 +1406,10 @@ const ( | |||
NLM_F_ROOT = 0x100 | |||
NOFLSH = 0x80 | |||
NSFS_MAGIC = 0x6e736673 | |||
NS_GET_NSTYPE = 0x2000b703 | |||
NS_GET_OWNER_UID = 0x2000b704 | |||
NS_GET_PARENT = 0x2000b702 | |||
NS_GET_USERNS = 0x2000b701 | |||
OCFS2_SUPER_MAGIC = 0x7461636f | |||
OCRNL = 0x8 | |||
OFDEL = 0x80 |
@@ -1406,6 +1406,10 @@ const ( | |||
NLM_F_ROOT = 0x100 | |||
NOFLSH = 0x80 | |||
NSFS_MAGIC = 0x6e736673 | |||
NS_GET_NSTYPE = 0x2000b703 | |||
NS_GET_OWNER_UID = 0x2000b704 | |||
NS_GET_PARENT = 0x2000b702 | |||
NS_GET_USERNS = 0x2000b701 | |||
OCFS2_SUPER_MAGIC = 0x7461636f | |||
OCRNL = 0x8 | |||
OFDEL = 0x80 |
@@ -1406,6 +1406,10 @@ const ( | |||
NLM_F_ROOT = 0x100 | |||
NOFLSH = 0x80 | |||
NSFS_MAGIC = 0x6e736673 | |||
NS_GET_NSTYPE = 0x2000b703 | |||
NS_GET_OWNER_UID = 0x2000b704 | |||
NS_GET_PARENT = 0x2000b702 | |||
NS_GET_USERNS = 0x2000b701 | |||
OCFS2_SUPER_MAGIC = 0x7461636f | |||
OCRNL = 0x8 | |||
OFDEL = 0x80 |
@@ -1407,6 +1407,10 @@ const ( | |||
NLM_F_ROOT = 0x100 | |||
NOFLSH = 0x80000000 | |||
NSFS_MAGIC = 0x6e736673 | |||
NS_GET_NSTYPE = 0x2000b703 | |||
NS_GET_OWNER_UID = 0x2000b704 | |||
NS_GET_PARENT = 0x2000b702 | |||
NS_GET_USERNS = 0x2000b701 | |||
OCFS2_SUPER_MAGIC = 0x7461636f | |||
OCRNL = 0x8 | |||
OFDEL = 0x80 |
@@ -1407,6 +1407,10 @@ const ( | |||
NLM_F_ROOT = 0x100 | |||
NOFLSH = 0x80000000 | |||
NSFS_MAGIC = 0x6e736673 | |||
NS_GET_NSTYPE = 0x2000b703 | |||
NS_GET_OWNER_UID = 0x2000b704 | |||
NS_GET_PARENT = 0x2000b702 | |||
NS_GET_USERNS = 0x2000b701 | |||
OCFS2_SUPER_MAGIC = 0x7461636f | |||
OCRNL = 0x8 | |||
OFDEL = 0x80 |
@@ -1406,6 +1406,10 @@ const ( | |||
NLM_F_ROOT = 0x100 | |||
NOFLSH = 0x80 | |||
NSFS_MAGIC = 0x6e736673 | |||
NS_GET_NSTYPE = 0xb703 | |||
NS_GET_OWNER_UID = 0xb704 | |||
NS_GET_PARENT = 0xb702 | |||
NS_GET_USERNS = 0xb701 | |||
OCFS2_SUPER_MAGIC = 0x7461636f | |||
OCRNL = 0x8 | |||
OFDEL = 0x80 |
@@ -1406,6 +1406,10 @@ const ( | |||
NLM_F_ROOT = 0x100 | |||
NOFLSH = 0x80 | |||
NSFS_MAGIC = 0x6e736673 | |||
NS_GET_NSTYPE = 0xb703 | |||
NS_GET_OWNER_UID = 0xb704 | |||
NS_GET_PARENT = 0xb702 | |||
NS_GET_USERNS = 0xb701 | |||
OCFS2_SUPER_MAGIC = 0x7461636f | |||
OCRNL = 0x8 | |||
OFDEL = 0x80 |
@@ -1410,6 +1410,10 @@ const ( | |||
NLM_F_ROOT = 0x100 | |||
NOFLSH = 0x80 | |||
NSFS_MAGIC = 0x6e736673 | |||
NS_GET_NSTYPE = 0x2000b703 | |||
NS_GET_OWNER_UID = 0x2000b704 | |||
NS_GET_PARENT = 0x2000b702 | |||
NS_GET_USERNS = 0x2000b701 | |||
OCFS2_SUPER_MAGIC = 0x7461636f | |||
OCRNL = 0x8 | |||
OFDEL = 0x80 |
@@ -666,7 +666,7 @@ func OpenCurrentProcessToken() (Token, error) { | |||
return 0, e | |||
} | |||
var t Token | |||
e = OpenProcessToken(p, TOKEN_QUERY, &t) | |||
e = OpenProcessToken(p, TOKEN_QUERY|TOKEN_DUPLICATE, &t) | |||
if e != nil { | |||
return 0, e | |||
} |
@@ -257,6 +257,10 @@ func NewCallbackCDecl(fn interface{}) uintptr { | |||
//sys SetEvent(event Handle) (err error) = kernel32.SetEvent | |||
//sys ResetEvent(event Handle) (err error) = kernel32.ResetEvent | |||
//sys PulseEvent(event Handle) (err error) = kernel32.PulseEvent | |||
//sys CreateMutex(mutexAttrs *SecurityAttributes, initialOwner bool, name *uint16) (handle Handle, err error) = kernel32.CreateMutexW | |||
//sys CreateMutexEx(mutexAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) = kernel32.CreateMutexExW | |||
//sys OpenMutex(desiredAccess uint32, inheritHandle bool, name *uint16) (handle Handle, err error) = kernel32.OpenMutexW | |||
//sys ReleaseMutex(mutex Handle) (err error) = kernel32.ReleaseMutex | |||
//sys SleepEx(milliseconds uint32, alertable bool) (ret uint32) = kernel32.SleepEx | |||
//sys CreateJobObject(jobAttr *SecurityAttributes, name *uint16) (handle Handle, err error) = kernel32.CreateJobObjectW | |||
//sys AssignProcessToJobObject(job Handle, process Handle) (err error) = kernel32.AssignProcessToJobObject |
@@ -1190,6 +1190,28 @@ const ( | |||
REG_QWORD = REG_QWORD_LITTLE_ENDIAN | |||
) | |||
const ( | |||
EVENT_MODIFY_STATE = 0x0002 | |||
EVENT_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3 | |||
MUTANT_QUERY_STATE = 0x0001 | |||
MUTANT_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | MUTANT_QUERY_STATE | |||
SEMAPHORE_MODIFY_STATE = 0x0002 | |||
SEMAPHORE_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3 | |||
TIMER_QUERY_STATE = 0x0001 | |||
TIMER_MODIFY_STATE = 0x0002 | |||
TIMER_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | TIMER_QUERY_STATE | TIMER_MODIFY_STATE | |||
MUTEX_MODIFY_STATE = MUTANT_QUERY_STATE | |||
MUTEX_ALL_ACCESS = MUTANT_ALL_ACCESS | |||
CREATE_EVENT_MANUAL_RESET = 0x1 | |||
CREATE_EVENT_INITIAL_SET = 0x2 | |||
CREATE_MUTEX_INITIAL_OWNER = 0x1 | |||
) | |||
type AddrinfoW struct { | |||
Flags int32 | |||
Family int32 |
@@ -197,6 +197,10 @@ var ( | |||
procSetEvent = modkernel32.NewProc("SetEvent") | |||
procResetEvent = modkernel32.NewProc("ResetEvent") | |||
procPulseEvent = modkernel32.NewProc("PulseEvent") | |||
procCreateMutexW = modkernel32.NewProc("CreateMutexW") | |||
procCreateMutexExW = modkernel32.NewProc("CreateMutexExW") | |||
procOpenMutexW = modkernel32.NewProc("OpenMutexW") | |||
procReleaseMutex = modkernel32.NewProc("ReleaseMutex") | |||
procSleepEx = modkernel32.NewProc("SleepEx") | |||
procCreateJobObjectW = modkernel32.NewProc("CreateJobObjectW") | |||
procAssignProcessToJobObject = modkernel32.NewProc("AssignProcessToJobObject") | |||
@@ -2109,6 +2113,69 @@ func PulseEvent(event Handle) (err error) { | |||
return | |||
} | |||
func CreateMutex(mutexAttrs *SecurityAttributes, initialOwner bool, name *uint16) (handle Handle, err error) { | |||
var _p0 uint32 | |||
if initialOwner { | |||
_p0 = 1 | |||
} else { | |||
_p0 = 0 | |||
} | |||
r0, _, e1 := syscall.Syscall(procCreateMutexW.Addr(), 3, uintptr(unsafe.Pointer(mutexAttrs)), uintptr(_p0), uintptr(unsafe.Pointer(name))) | |||
handle = Handle(r0) | |||
if handle == 0 { | |||
if e1 != 0 { | |||
err = errnoErr(e1) | |||
} else { | |||
err = syscall.EINVAL | |||
} | |||
} | |||
return | |||
} | |||
func CreateMutexEx(mutexAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) { | |||
r0, _, e1 := syscall.Syscall6(procCreateMutexExW.Addr(), 4, uintptr(unsafe.Pointer(mutexAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess), 0, 0) | |||
handle = Handle(r0) | |||
if handle == 0 { | |||
if e1 != 0 { | |||
err = errnoErr(e1) | |||
} else { | |||
err = syscall.EINVAL | |||
} | |||
} | |||
return | |||
} | |||
func OpenMutex(desiredAccess uint32, inheritHandle bool, name *uint16) (handle Handle, err error) { | |||
var _p0 uint32 | |||
if inheritHandle { | |||
_p0 = 1 | |||
} else { | |||
_p0 = 0 | |||
} | |||
r0, _, e1 := syscall.Syscall(procOpenMutexW.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name))) | |||
handle = Handle(r0) | |||
if handle == 0 { | |||
if e1 != 0 { | |||
err = errnoErr(e1) | |||
} else { | |||
err = syscall.EINVAL | |||
} | |||
} | |||
return | |||
} | |||
func ReleaseMutex(mutex Handle) (err error) { | |||
r1, _, e1 := syscall.Syscall(procReleaseMutex.Addr(), 1, uintptr(mutex), 0, 0) | |||
if r1 == 0 { | |||
if e1 != 0 { | |||
err = errnoErr(e1) | |||
} else { | |||
err = syscall.EINVAL | |||
} | |||
} | |||
return | |||
} | |||
func SleepEx(milliseconds uint32, alertable bool) (ret uint32) { | |||
var _p0 uint32 | |||
if alertable { |
@@ -374,7 +374,7 @@ golang.org/x/net/internal/socks | |||
# golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 | |||
golang.org/x/oauth2 | |||
golang.org/x/oauth2/internal | |||
# golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456 | |||
# golang.org/x/sys v0.0.0-20190902133755-9109b7679e13 | |||
golang.org/x/sys/windows | |||
golang.org/x/sys/windows/svc | |||
golang.org/x/sys/cpu |