Bump logrus to fix Solaris build. (#1373)
Bump to github.com/sirupsen/logrus@v1.4.2. Signed-off-by: Ben Kochie <superq@gmail.com>pull/1378/head
parent
b556592217
commit
0759c0ac01
4
go.mod
4
go.mod
|
@ -20,13 +20,13 @@ require (
|
||||||
github.com/prometheus/common v0.3.0
|
github.com/prometheus/common v0.3.0
|
||||||
github.com/prometheus/procfs v0.0.0-20190529155944-65bdadfa96ae
|
github.com/prometheus/procfs v0.0.0-20190529155944-65bdadfa96ae
|
||||||
github.com/siebenmann/go-kstat v0.0.0-20160321171754-d34789b79745
|
github.com/siebenmann/go-kstat v0.0.0-20160321171754-d34789b79745
|
||||||
github.com/sirupsen/logrus v1.4.1 // indirect
|
github.com/sirupsen/logrus v1.4.2 // indirect
|
||||||
github.com/soundcloud/go-runit v0.0.0-20150630195641-06ad41a06c4a
|
github.com/soundcloud/go-runit v0.0.0-20150630195641-06ad41a06c4a
|
||||||
github.com/stretchr/testify v1.3.0 // indirect
|
github.com/stretchr/testify v1.3.0 // indirect
|
||||||
go.uber.org/atomic v1.3.2 // indirect
|
go.uber.org/atomic v1.3.2 // indirect
|
||||||
go.uber.org/multierr v1.1.0 // indirect
|
go.uber.org/multierr v1.1.0 // indirect
|
||||||
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c // indirect
|
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c // indirect
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58 // indirect
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58 // indirect
|
||||||
golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862
|
golang.org/x/sys v0.0.0-20190610081024-1e42afee0f76
|
||||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6
|
gopkg.in/alecthomas/kingpin.v2 v2.2.6
|
||||||
)
|
)
|
||||||
|
|
9
go.sum
9
go.sum
|
@ -70,8 +70,8 @@ github.com/prometheus/procfs v0.0.0-20190529155944-65bdadfa96ae/go.mod h1:TjEm7z
|
||||||
github.com/siebenmann/go-kstat v0.0.0-20160321171754-d34789b79745 h1:IuH7WumZNax0D+rEqmy2TyhKCzrtMGqbZO0b8rO00JA=
|
github.com/siebenmann/go-kstat v0.0.0-20160321171754-d34789b79745 h1:IuH7WumZNax0D+rEqmy2TyhKCzrtMGqbZO0b8rO00JA=
|
||||||
github.com/siebenmann/go-kstat v0.0.0-20160321171754-d34789b79745/go.mod h1:G81aIFAMS9ECrwBYR9YxhlPjWgrItd+Kje78O6+uqm8=
|
github.com/siebenmann/go-kstat v0.0.0-20160321171754-d34789b79745/go.mod h1:G81aIFAMS9ECrwBYR9YxhlPjWgrItd+Kje78O6+uqm8=
|
||||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||||
github.com/sirupsen/logrus v1.4.1 h1:GL2rEmy6nsikmW0r8opw9JIRScdMF5hA8cOYLH7In1k=
|
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
|
||||||
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
|
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||||
github.com/soundcloud/go-runit v0.0.0-20150630195641-06ad41a06c4a h1:os5OBNhwOwybXZMNLqT96XqtjdTtwRFw2w08uluvNeI=
|
github.com/soundcloud/go-runit v0.0.0-20150630195641-06ad41a06c4a h1:os5OBNhwOwybXZMNLqT96XqtjdTtwRFw2w08uluvNeI=
|
||||||
github.com/soundcloud/go-runit v0.0.0-20150630195641-06ad41a06c4a/go.mod h1:LeFCbQYJ3KJlPs/FvPz2dy1tkpxyeNESVyCNNzRXFR0=
|
github.com/soundcloud/go-runit v0.0.0-20150630195641-06ad41a06c4a/go.mod h1:LeFCbQYJ3KJlPs/FvPz2dy1tkpxyeNESVyCNNzRXFR0=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
@ -99,8 +99,9 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
|
||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862 h1:rM0ROo5vb9AdYJi1110yjWGMej9ITfKddS89P3Fkhug=
|
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190610081024-1e42afee0f76 h1:QSmW7Q3mFdAGjtAd0byXmFJ55inUydyZ4WQmiuItAIQ=
|
||||||
|
golang.org/x/sys v0.0.0-20190610081024-1e42afee0f76/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=
|
gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=
|
||||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||||
|
|
|
@ -5,16 +5,20 @@ git:
|
||||||
env:
|
env:
|
||||||
- GO111MODULE=on
|
- GO111MODULE=on
|
||||||
- GO111MODULE=off
|
- GO111MODULE=off
|
||||||
go: [ 1.10.x, 1.11.x, 1.12.x ]
|
go: [ 1.11.x, 1.12.x ]
|
||||||
os: [ linux, osx, windows ]
|
os: [ linux, osx ]
|
||||||
matrix:
|
matrix:
|
||||||
exclude:
|
exclude:
|
||||||
- env: GO111MODULE=on
|
- go: 1.12.x
|
||||||
go: 1.10.x
|
env: GO111MODULE=off
|
||||||
|
- go: 1.11.x
|
||||||
|
os: osx
|
||||||
install:
|
install:
|
||||||
|
- ./travis/install.sh
|
||||||
- if [[ "$GO111MODULE" == "on" ]]; then go mod download; fi
|
- if [[ "$GO111MODULE" == "on" ]]; then go mod download; fi
|
||||||
- if [[ "$GO111MODULE" == "off" ]]; then go get github.com/stretchr/testify/assert golang.org/x/sys/unix github.com/konsorten/go-windows-terminal-sequences; fi
|
- if [[ "$GO111MODULE" == "off" ]]; then go get github.com/stretchr/testify/assert golang.org/x/sys/unix github.com/konsorten/go-windows-terminal-sequences; fi
|
||||||
script:
|
script:
|
||||||
|
- ./travis/cross_build.sh
|
||||||
- export GOMAXPROCS=4
|
- export GOMAXPROCS=4
|
||||||
- export GORACE=halt_on_error=1
|
- export GORACE=halt_on_error=1
|
||||||
- go test -race -v ./...
|
- go test -race -v ./...
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# 1.4.2
|
||||||
|
* Fixes build break for plan9, nacl, solaris
|
||||||
# 1.4.1
|
# 1.4.1
|
||||||
This new release introduces:
|
This new release introduces:
|
||||||
* Enhance TextFormatter to not print caller information when they are empty (#944)
|
* Enhance TextFormatter to not print caller information when they are empty (#944)
|
||||||
|
|
|
@ -6,5 +6,5 @@ require (
|
||||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
github.com/stretchr/objx v0.1.1 // indirect
|
github.com/stretchr/objx v0.1.1 // indirect
|
||||||
github.com/stretchr/testify v1.2.2
|
github.com/stretchr/testify v1.2.2
|
||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33
|
golang.org/x/sys v0.0.0-20190422165155-953cdadca894
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,6 +2,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe h1:CHRGQ8V7OlCYtwaKPJi3iA7J+YdNKdo8j7nG5IgDhjs=
|
github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe h1:CHRGQ8V7OlCYtwaKPJi3iA7J+YdNKdo8j7nG5IgDhjs=
|
||||||
github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||||
|
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
@ -11,3 +12,5 @@ github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 h1:I6FyU15t786LL7oL/hn43zqTuEGr4PN7F4XJ1p4E3Y8=
|
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 h1:I6FyU15t786LL7oL/hn43zqTuEGr4PN7F4XJ1p4E3Y8=
|
||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc=
|
||||||
|
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// +build js
|
// +build js nacl plan9
|
||||||
|
|
||||||
package logrus
|
package logrus
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// +build !appengine,!js,!windows
|
// +build !appengine,!js,!windows,!nacl,!plan9
|
||||||
|
|
||||||
package logrus
|
package logrus
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package logrus
|
||||||
|
|
||||||
|
import (
|
||||||
|
"golang.org/x/sys/unix"
|
||||||
|
)
|
||||||
|
|
||||||
|
// IsTerminal returns true if the given file descriptor is a terminal.
|
||||||
|
func isTerminal(fd int) bool {
|
||||||
|
_, err := unix.IoctlGetTermio(fd, unix.TCGETA)
|
||||||
|
return err == nil
|
||||||
|
}
|
|
@ -6,15 +6,29 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
|
sequences "github.com/konsorten/go-windows-terminal-sequences"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func initTerminal(w io.Writer) {
|
||||||
|
switch v := w.(type) {
|
||||||
|
case *os.File:
|
||||||
|
sequences.EnableVirtualTerminalProcessing(syscall.Handle(v.Fd()), true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func checkIfTerminal(w io.Writer) bool {
|
func checkIfTerminal(w io.Writer) bool {
|
||||||
|
var ret bool
|
||||||
switch v := w.(type) {
|
switch v := w.(type) {
|
||||||
case *os.File:
|
case *os.File:
|
||||||
var mode uint32
|
var mode uint32
|
||||||
err := syscall.GetConsoleMode(syscall.Handle(v.Fd()), &mode)
|
err := syscall.GetConsoleMode(syscall.Handle(v.Fd()), &mode)
|
||||||
return err == nil
|
ret = (err == nil)
|
||||||
default:
|
default:
|
||||||
return false
|
ret = false
|
||||||
}
|
}
|
||||||
|
if ret {
|
||||||
|
initTerminal(w)
|
||||||
|
}
|
||||||
|
return ret
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
// +build !windows
|
|
||||||
|
|
||||||
package logrus
|
|
||||||
|
|
||||||
import "io"
|
|
||||||
|
|
||||||
func initTerminal(w io.Writer) {
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
// +build !appengine,!js,windows
|
|
||||||
|
|
||||||
package logrus
|
|
||||||
|
|
||||||
import (
|
|
||||||
"io"
|
|
||||||
"os"
|
|
||||||
"syscall"
|
|
||||||
|
|
||||||
sequences "github.com/konsorten/go-windows-terminal-sequences"
|
|
||||||
)
|
|
||||||
|
|
||||||
func initTerminal(w io.Writer) {
|
|
||||||
switch v := w.(type) {
|
|
||||||
case *os.File:
|
|
||||||
sequences.EnableVirtualTerminalProcessing(syscall.Handle(v.Fd()), true)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -84,10 +84,6 @@ type TextFormatter struct {
|
||||||
func (f *TextFormatter) init(entry *Entry) {
|
func (f *TextFormatter) init(entry *Entry) {
|
||||||
if entry.Logger != nil {
|
if entry.Logger != nil {
|
||||||
f.isTerminal = checkIfTerminal(entry.Logger.Out)
|
f.isTerminal = checkIfTerminal(entry.Logger.Out)
|
||||||
|
|
||||||
if f.isTerminal {
|
|
||||||
initTerminal(entry.Logger.Out)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build riscv64,!gccgo
|
||||||
|
|
||||||
|
#include "textflag.h"
|
||||||
|
|
||||||
|
//
|
||||||
|
// System calls for linux/riscv64.
|
||||||
|
//
|
||||||
|
// Where available, just jump to package syscall's implementation of
|
||||||
|
// these functions.
|
||||||
|
|
||||||
|
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
||||||
|
JMP syscall·Syscall(SB)
|
||||||
|
|
||||||
|
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
||||||
|
JMP syscall·Syscall6(SB)
|
||||||
|
|
||||||
|
TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
|
||||||
|
CALL runtime·entersyscall(SB)
|
||||||
|
MOV a1+8(FP), A0
|
||||||
|
MOV a2+16(FP), A1
|
||||||
|
MOV a3+24(FP), A2
|
||||||
|
MOV $0, A3
|
||||||
|
MOV $0, A4
|
||||||
|
MOV $0, A5
|
||||||
|
MOV $0, A6
|
||||||
|
MOV trap+0(FP), A7 // syscall entry
|
||||||
|
ECALL
|
||||||
|
MOV A0, r1+32(FP) // r1
|
||||||
|
MOV A1, r2+40(FP) // r2
|
||||||
|
CALL runtime·exitsyscall(SB)
|
||||||
|
RET
|
||||||
|
|
||||||
|
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
||||||
|
JMP syscall·RawSyscall(SB)
|
||||||
|
|
||||||
|
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
||||||
|
JMP syscall·RawSyscall6(SB)
|
||||||
|
|
||||||
|
TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
|
||||||
|
MOV a1+8(FP), A0
|
||||||
|
MOV a2+16(FP), A1
|
||||||
|
MOV a3+24(FP), A2
|
||||||
|
MOV ZERO, A3
|
||||||
|
MOV ZERO, A4
|
||||||
|
MOV ZERO, A5
|
||||||
|
MOV trap+0(FP), A7 // syscall entry
|
||||||
|
ECALL
|
||||||
|
MOV A0, r1+32(FP)
|
||||||
|
MOV A1, r2+40(FP)
|
||||||
|
RET
|
|
@ -434,7 +434,7 @@ ccflags="$@"
|
||||||
$2 ~ /^TC[IO](ON|OFF)$/ ||
|
$2 ~ /^TC[IO](ON|OFF)$/ ||
|
||||||
$2 ~ /^IN_/ ||
|
$2 ~ /^IN_/ ||
|
||||||
$2 ~ /^LOCK_(SH|EX|NB|UN)$/ ||
|
$2 ~ /^LOCK_(SH|EX|NB|UN)$/ ||
|
||||||
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|ICMP6|TCP|EVFILT|NOTE|EV|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR)_/ ||
|
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|ICMP6|TCP|MCAST|EVFILT|NOTE|EV|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR)_/ ||
|
||||||
$2 ~ /^TP_STATUS_/ ||
|
$2 ~ /^TP_STATUS_/ ||
|
||||||
$2 ~ /^FALLOC_/ ||
|
$2 ~ /^FALLOC_/ ||
|
||||||
$2 == "ICMPV6_FILTER" ||
|
$2 == "ICMPV6_FILTER" ||
|
||||||
|
|
|
@ -42,6 +42,13 @@ func main() {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if goos == "aix" {
|
||||||
|
// Replace type of Atim, Mtim and Ctim by Timespec in Stat_t
|
||||||
|
// to avoid having both StTimespec and Timespec.
|
||||||
|
sttimespec := regexp.MustCompile(`_Ctype_struct_st_timespec`)
|
||||||
|
b = sttimespec.ReplaceAll(b, []byte("Timespec"))
|
||||||
|
}
|
||||||
|
|
||||||
// Intentionally export __val fields in Fsid and Sigset_t
|
// Intentionally export __val fields in Fsid and Sigset_t
|
||||||
valRegex := regexp.MustCompile(`type (Fsid|Sigset_t) struct {(\s+)X__val(\s+\S+\s+)}`)
|
valRegex := regexp.MustCompile(`type (Fsid|Sigset_t) struct {(\s+)X__val(\s+\S+\s+)}`)
|
||||||
b = valRegex.ReplaceAll(b, []byte("type $1 struct {${2}Val$3}"))
|
b = valRegex.ReplaceAll(b, []byte("type $1 struct {${2}Val$3}"))
|
||||||
|
@ -96,6 +103,15 @@ func main() {
|
||||||
cgoCommandRegex := regexp.MustCompile(`(cgo -godefs .*)`)
|
cgoCommandRegex := regexp.MustCompile(`(cgo -godefs .*)`)
|
||||||
b = cgoCommandRegex.ReplaceAll(b, []byte(replacement))
|
b = cgoCommandRegex.ReplaceAll(b, []byte(replacement))
|
||||||
|
|
||||||
|
// Rename Stat_t time fields
|
||||||
|
if goos == "freebsd" && goarch == "386" {
|
||||||
|
// Hide Stat_t.[AMCB]tim_ext fields
|
||||||
|
renameStatTimeExtFieldsRegex := regexp.MustCompile(`[AMCB]tim_ext`)
|
||||||
|
b = renameStatTimeExtFieldsRegex.ReplaceAll(b, []byte("_"))
|
||||||
|
}
|
||||||
|
renameStatTimeFieldsRegex := regexp.MustCompile(`([AMCB])(?:irth)?time?(?:spec)?\s+(Timespec|StTimespec)`)
|
||||||
|
b = renameStatTimeFieldsRegex.ReplaceAll(b, []byte("${1}tim ${2}"))
|
||||||
|
|
||||||
// gofmt
|
// gofmt
|
||||||
b, err = format.Source(b)
|
b, err = format.Source(b)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -454,8 +454,8 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||||
//sys Dup2(oldfd int, newfd int) (err error)
|
//sys Dup2(oldfd int, newfd int) (err error)
|
||||||
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = posix_fadvise64
|
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = posix_fadvise64
|
||||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
//sys fstat(fd int, stat *Stat_t) (err error)
|
||||||
//sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = fstatat
|
//sys fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = fstatat
|
||||||
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
|
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
|
||||||
//sys Ftruncate(fd int, length int64) (err error)
|
//sys Ftruncate(fd int, length int64) (err error)
|
||||||
//sysnb Getegid() (egid int)
|
//sysnb Getegid() (egid int)
|
||||||
|
@ -464,7 +464,7 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||||
//sysnb Getuid() (uid int)
|
//sysnb Getuid() (uid int)
|
||||||
//sys Lchown(path string, uid int, gid int) (err error)
|
//sys Lchown(path string, uid int, gid int) (err error)
|
||||||
//sys Listen(s int, n int) (err error)
|
//sys Listen(s int, n int) (err error)
|
||||||
//sys Lstat(path string, stat *Stat_t) (err error)
|
//sys lstat(path string, stat *Stat_t) (err error)
|
||||||
//sys Pause() (err error)
|
//sys Pause() (err error)
|
||||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = pread64
|
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = pread64
|
||||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = pwrite64
|
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = pwrite64
|
||||||
|
@ -474,7 +474,7 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||||
//sysnb Setreuid(ruid int, euid int) (err error)
|
//sysnb Setreuid(ruid int, euid int) (err error)
|
||||||
//sys Shutdown(fd int, how int) (err error)
|
//sys Shutdown(fd int, how int) (err error)
|
||||||
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
|
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
|
||||||
//sys Stat(path string, stat *Stat_t) (err error)
|
//sys stat(path string, statptr *Stat_t) (err error)
|
||||||
//sys Statfs(path string, buf *Statfs_t) (err error)
|
//sys Statfs(path string, buf *Statfs_t) (err error)
|
||||||
//sys Truncate(path string, length int64) (err error)
|
//sys Truncate(path string, length int64) (err error)
|
||||||
|
|
||||||
|
|
|
@ -32,3 +32,19 @@ func (msghdr *Msghdr) SetControllen(length int) {
|
||||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||||
cmsg.Len = uint32(length)
|
cmsg.Len = uint32(length)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Fstat(fd int, stat *Stat_t) error {
|
||||||
|
return fstat(fd, stat)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Fstatat(dirfd int, path string, stat *Stat_t, flags int) error {
|
||||||
|
return fstatat(dirfd, path, stat, flags)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Lstat(path string, stat *Stat_t) error {
|
||||||
|
return lstat(path, stat)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Stat(path string, statptr *Stat_t) error {
|
||||||
|
return stat(path, statptr)
|
||||||
|
}
|
||||||
|
|
|
@ -32,3 +32,50 @@ func (msghdr *Msghdr) SetControllen(length int) {
|
||||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||||
cmsg.Len = uint32(length)
|
cmsg.Len = uint32(length)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// In order to only have Timespec structure, type of Stat_t's fields
|
||||||
|
// Atim, Mtim and Ctim is changed from StTimespec to Timespec during
|
||||||
|
// ztypes generation.
|
||||||
|
// On ppc64, Timespec.Nsec is an int64 while StTimespec.Nsec is an
|
||||||
|
// int32, so the fields' value must be modified.
|
||||||
|
func fixStatTimFields(stat *Stat_t) {
|
||||||
|
stat.Atim.Nsec >>= 32
|
||||||
|
stat.Mtim.Nsec >>= 32
|
||||||
|
stat.Ctim.Nsec >>= 32
|
||||||
|
}
|
||||||
|
|
||||||
|
func Fstat(fd int, stat *Stat_t) error {
|
||||||
|
err := fstat(fd, stat)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
fixStatTimFields(stat)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func Fstatat(dirfd int, path string, stat *Stat_t, flags int) error {
|
||||||
|
err := fstatat(dirfd, path, stat, flags)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
fixStatTimFields(stat)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func Lstat(path string, stat *Stat_t) error {
|
||||||
|
err := lstat(path, stat)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
fixStatTimFields(stat)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func Stat(path string, statptr *Stat_t) error {
|
||||||
|
err := stat(path, statptr)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
fixStatTimFields(statptr)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
|
@ -404,22 +404,22 @@ func roundup(x, y int) int {
|
||||||
|
|
||||||
func (s *Stat_t) convertFrom(old *stat_freebsd11_t) {
|
func (s *Stat_t) convertFrom(old *stat_freebsd11_t) {
|
||||||
*s = Stat_t{
|
*s = Stat_t{
|
||||||
Dev: uint64(old.Dev),
|
Dev: uint64(old.Dev),
|
||||||
Ino: uint64(old.Ino),
|
Ino: uint64(old.Ino),
|
||||||
Nlink: uint64(old.Nlink),
|
Nlink: uint64(old.Nlink),
|
||||||
Mode: old.Mode,
|
Mode: old.Mode,
|
||||||
Uid: old.Uid,
|
Uid: old.Uid,
|
||||||
Gid: old.Gid,
|
Gid: old.Gid,
|
||||||
Rdev: uint64(old.Rdev),
|
Rdev: uint64(old.Rdev),
|
||||||
Atim: old.Atim,
|
Atim: old.Atim,
|
||||||
Mtim: old.Mtim,
|
Mtim: old.Mtim,
|
||||||
Ctim: old.Ctim,
|
Ctim: old.Ctim,
|
||||||
Birthtim: old.Birthtim,
|
Btim: old.Btim,
|
||||||
Size: old.Size,
|
Size: old.Size,
|
||||||
Blocks: old.Blocks,
|
Blocks: old.Blocks,
|
||||||
Blksize: old.Blksize,
|
Blksize: old.Blksize,
|
||||||
Flags: old.Flags,
|
Flags: old.Flags,
|
||||||
Gen: uint64(old.Gen),
|
Gen: uint64(old.Gen),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1537,9 +1537,13 @@ func Setgid(uid int) (err error) {
|
||||||
return EOPNOTSUPP
|
return EOPNOTSUPP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Signalfd(fd int, sigmask *Sigset_t, flags int) (newfd int, err error) {
|
||||||
|
return signalfd(fd, sigmask, _C__NSIG/8, flags)
|
||||||
|
}
|
||||||
|
|
||||||
//sys Setpriority(which int, who int, prio int) (err error)
|
//sys Setpriority(which int, who int, prio int) (err error)
|
||||||
//sys Setxattr(path string, attr string, data []byte, flags int) (err error)
|
//sys Setxattr(path string, attr string, data []byte, flags int) (err error)
|
||||||
//sys Signalfd(fd int, mask *Sigset_t, flags int) = SYS_SIGNALFD4
|
//sys signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) = SYS_SIGNALFD4
|
||||||
//sys Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error)
|
//sys Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error)
|
||||||
//sys Sync()
|
//sys Sync()
|
||||||
//sys Syncfs(fd int) (err error)
|
//sys Syncfs(fd int) (err error)
|
||||||
|
|
|
@ -87,8 +87,6 @@ type Mode_t C.mode_t
|
||||||
|
|
||||||
type Timespec C.struct_timespec
|
type Timespec C.struct_timespec
|
||||||
|
|
||||||
type StTimespec C.struct_st_timespec
|
|
||||||
|
|
||||||
type Timeval C.struct_timeval
|
type Timeval C.struct_timeval
|
||||||
|
|
||||||
type Timeval32 C.struct_timeval32
|
type Timeval32 C.struct_timeval32
|
||||||
|
@ -133,6 +131,8 @@ type RawSockaddrInet6 C.struct_sockaddr_in6
|
||||||
|
|
||||||
type RawSockaddrUnix C.struct_sockaddr_un
|
type RawSockaddrUnix C.struct_sockaddr_un
|
||||||
|
|
||||||
|
type RawSockaddrDatalink C.struct_sockaddr_dl
|
||||||
|
|
||||||
type RawSockaddr C.struct_sockaddr
|
type RawSockaddr C.struct_sockaddr
|
||||||
|
|
||||||
type RawSockaddrAny C.struct_sockaddr_any
|
type RawSockaddrAny C.struct_sockaddr_any
|
||||||
|
@ -156,17 +156,18 @@ type Linger C.struct_linger
|
||||||
type Msghdr C.struct_msghdr
|
type Msghdr C.struct_msghdr
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in
|
SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in
|
||||||
SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6
|
SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6
|
||||||
SizeofSockaddrAny = C.sizeof_struct_sockaddr_any
|
SizeofSockaddrAny = C.sizeof_struct_sockaddr_any
|
||||||
SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un
|
SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un
|
||||||
SizeofLinger = C.sizeof_struct_linger
|
SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
|
||||||
SizeofIPMreq = C.sizeof_struct_ip_mreq
|
SizeofLinger = C.sizeof_struct_linger
|
||||||
SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq
|
SizeofIPMreq = C.sizeof_struct_ip_mreq
|
||||||
SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo
|
SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq
|
||||||
SizeofMsghdr = C.sizeof_struct_msghdr
|
SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo
|
||||||
SizeofCmsghdr = C.sizeof_struct_cmsghdr
|
SizeofMsghdr = C.sizeof_struct_msghdr
|
||||||
SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter
|
SizeofCmsghdr = C.sizeof_struct_cmsghdr
|
||||||
|
SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter
|
||||||
)
|
)
|
||||||
|
|
||||||
// Routing and interface messages
|
// Routing and interface messages
|
||||||
|
|
|
@ -229,6 +229,7 @@ const (
|
||||||
BPF_F_INDEX_MASK = 0xffffffff
|
BPF_F_INDEX_MASK = 0xffffffff
|
||||||
BPF_F_INGRESS = 0x1
|
BPF_F_INGRESS = 0x1
|
||||||
BPF_F_INVALIDATE_HASH = 0x2
|
BPF_F_INVALIDATE_HASH = 0x2
|
||||||
|
BPF_F_LOCK = 0x4
|
||||||
BPF_F_MARK_ENFORCE = 0x40
|
BPF_F_MARK_ENFORCE = 0x40
|
||||||
BPF_F_MARK_MANGLED_0 = 0x20
|
BPF_F_MARK_MANGLED_0 = 0x20
|
||||||
BPF_F_NO_COMMON_LRU = 0x2
|
BPF_F_NO_COMMON_LRU = 0x2
|
||||||
|
@ -259,6 +260,7 @@ const (
|
||||||
BPF_JLE = 0xb0
|
BPF_JLE = 0xb0
|
||||||
BPF_JLT = 0xa0
|
BPF_JLT = 0xa0
|
||||||
BPF_JMP = 0x5
|
BPF_JMP = 0x5
|
||||||
|
BPF_JMP32 = 0x6
|
||||||
BPF_JNE = 0x50
|
BPF_JNE = 0x50
|
||||||
BPF_JSET = 0x40
|
BPF_JSET = 0x40
|
||||||
BPF_JSGE = 0x70
|
BPF_JSGE = 0x70
|
||||||
|
@ -1134,6 +1136,15 @@ const (
|
||||||
MAP_STACK = 0x20000
|
MAP_STACK = 0x20000
|
||||||
MAP_SYNC = 0x80000
|
MAP_SYNC = 0x80000
|
||||||
MAP_TYPE = 0xf
|
MAP_TYPE = 0xf
|
||||||
|
MCAST_BLOCK_SOURCE = 0x2b
|
||||||
|
MCAST_EXCLUDE = 0x0
|
||||||
|
MCAST_INCLUDE = 0x1
|
||||||
|
MCAST_JOIN_GROUP = 0x2a
|
||||||
|
MCAST_JOIN_SOURCE_GROUP = 0x2e
|
||||||
|
MCAST_LEAVE_GROUP = 0x2d
|
||||||
|
MCAST_LEAVE_SOURCE_GROUP = 0x2f
|
||||||
|
MCAST_MSFILTER = 0x30
|
||||||
|
MCAST_UNBLOCK_SOURCE = 0x2c
|
||||||
MCL_CURRENT = 0x1
|
MCL_CURRENT = 0x1
|
||||||
MCL_FUTURE = 0x2
|
MCL_FUTURE = 0x2
|
||||||
MCL_ONFAULT = 0x4
|
MCL_ONFAULT = 0x4
|
||||||
|
|
|
@ -229,6 +229,7 @@ const (
|
||||||
BPF_F_INDEX_MASK = 0xffffffff
|
BPF_F_INDEX_MASK = 0xffffffff
|
||||||
BPF_F_INGRESS = 0x1
|
BPF_F_INGRESS = 0x1
|
||||||
BPF_F_INVALIDATE_HASH = 0x2
|
BPF_F_INVALIDATE_HASH = 0x2
|
||||||
|
BPF_F_LOCK = 0x4
|
||||||
BPF_F_MARK_ENFORCE = 0x40
|
BPF_F_MARK_ENFORCE = 0x40
|
||||||
BPF_F_MARK_MANGLED_0 = 0x20
|
BPF_F_MARK_MANGLED_0 = 0x20
|
||||||
BPF_F_NO_COMMON_LRU = 0x2
|
BPF_F_NO_COMMON_LRU = 0x2
|
||||||
|
@ -259,6 +260,7 @@ const (
|
||||||
BPF_JLE = 0xb0
|
BPF_JLE = 0xb0
|
||||||
BPF_JLT = 0xa0
|
BPF_JLT = 0xa0
|
||||||
BPF_JMP = 0x5
|
BPF_JMP = 0x5
|
||||||
|
BPF_JMP32 = 0x6
|
||||||
BPF_JNE = 0x50
|
BPF_JNE = 0x50
|
||||||
BPF_JSET = 0x40
|
BPF_JSET = 0x40
|
||||||
BPF_JSGE = 0x70
|
BPF_JSGE = 0x70
|
||||||
|
@ -1134,6 +1136,15 @@ const (
|
||||||
MAP_STACK = 0x20000
|
MAP_STACK = 0x20000
|
||||||
MAP_SYNC = 0x80000
|
MAP_SYNC = 0x80000
|
||||||
MAP_TYPE = 0xf
|
MAP_TYPE = 0xf
|
||||||
|
MCAST_BLOCK_SOURCE = 0x2b
|
||||||
|
MCAST_EXCLUDE = 0x0
|
||||||
|
MCAST_INCLUDE = 0x1
|
||||||
|
MCAST_JOIN_GROUP = 0x2a
|
||||||
|
MCAST_JOIN_SOURCE_GROUP = 0x2e
|
||||||
|
MCAST_LEAVE_GROUP = 0x2d
|
||||||
|
MCAST_LEAVE_SOURCE_GROUP = 0x2f
|
||||||
|
MCAST_MSFILTER = 0x30
|
||||||
|
MCAST_UNBLOCK_SOURCE = 0x2c
|
||||||
MCL_CURRENT = 0x1
|
MCL_CURRENT = 0x1
|
||||||
MCL_FUTURE = 0x2
|
MCL_FUTURE = 0x2
|
||||||
MCL_ONFAULT = 0x4
|
MCL_ONFAULT = 0x4
|
||||||
|
|
|
@ -229,6 +229,7 @@ const (
|
||||||
BPF_F_INDEX_MASK = 0xffffffff
|
BPF_F_INDEX_MASK = 0xffffffff
|
||||||
BPF_F_INGRESS = 0x1
|
BPF_F_INGRESS = 0x1
|
||||||
BPF_F_INVALIDATE_HASH = 0x2
|
BPF_F_INVALIDATE_HASH = 0x2
|
||||||
|
BPF_F_LOCK = 0x4
|
||||||
BPF_F_MARK_ENFORCE = 0x40
|
BPF_F_MARK_ENFORCE = 0x40
|
||||||
BPF_F_MARK_MANGLED_0 = 0x20
|
BPF_F_MARK_MANGLED_0 = 0x20
|
||||||
BPF_F_NO_COMMON_LRU = 0x2
|
BPF_F_NO_COMMON_LRU = 0x2
|
||||||
|
@ -259,6 +260,7 @@ const (
|
||||||
BPF_JLE = 0xb0
|
BPF_JLE = 0xb0
|
||||||
BPF_JLT = 0xa0
|
BPF_JLT = 0xa0
|
||||||
BPF_JMP = 0x5
|
BPF_JMP = 0x5
|
||||||
|
BPF_JMP32 = 0x6
|
||||||
BPF_JNE = 0x50
|
BPF_JNE = 0x50
|
||||||
BPF_JSET = 0x40
|
BPF_JSET = 0x40
|
||||||
BPF_JSGE = 0x70
|
BPF_JSGE = 0x70
|
||||||
|
@ -1132,6 +1134,15 @@ const (
|
||||||
MAP_STACK = 0x20000
|
MAP_STACK = 0x20000
|
||||||
MAP_SYNC = 0x80000
|
MAP_SYNC = 0x80000
|
||||||
MAP_TYPE = 0xf
|
MAP_TYPE = 0xf
|
||||||
|
MCAST_BLOCK_SOURCE = 0x2b
|
||||||
|
MCAST_EXCLUDE = 0x0
|
||||||
|
MCAST_INCLUDE = 0x1
|
||||||
|
MCAST_JOIN_GROUP = 0x2a
|
||||||
|
MCAST_JOIN_SOURCE_GROUP = 0x2e
|
||||||
|
MCAST_LEAVE_GROUP = 0x2d
|
||||||
|
MCAST_LEAVE_SOURCE_GROUP = 0x2f
|
||||||
|
MCAST_MSFILTER = 0x30
|
||||||
|
MCAST_UNBLOCK_SOURCE = 0x2c
|
||||||
MCL_CURRENT = 0x1
|
MCL_CURRENT = 0x1
|
||||||
MCL_FUTURE = 0x2
|
MCL_FUTURE = 0x2
|
||||||
MCL_ONFAULT = 0x4
|
MCL_ONFAULT = 0x4
|
||||||
|
|
|
@ -229,6 +229,7 @@ const (
|
||||||
BPF_F_INDEX_MASK = 0xffffffff
|
BPF_F_INDEX_MASK = 0xffffffff
|
||||||
BPF_F_INGRESS = 0x1
|
BPF_F_INGRESS = 0x1
|
||||||
BPF_F_INVALIDATE_HASH = 0x2
|
BPF_F_INVALIDATE_HASH = 0x2
|
||||||
|
BPF_F_LOCK = 0x4
|
||||||
BPF_F_MARK_ENFORCE = 0x40
|
BPF_F_MARK_ENFORCE = 0x40
|
||||||
BPF_F_MARK_MANGLED_0 = 0x20
|
BPF_F_MARK_MANGLED_0 = 0x20
|
||||||
BPF_F_NO_COMMON_LRU = 0x2
|
BPF_F_NO_COMMON_LRU = 0x2
|
||||||
|
@ -259,6 +260,7 @@ const (
|
||||||
BPF_JLE = 0xb0
|
BPF_JLE = 0xb0
|
||||||
BPF_JLT = 0xa0
|
BPF_JLT = 0xa0
|
||||||
BPF_JMP = 0x5
|
BPF_JMP = 0x5
|
||||||
|
BPF_JMP32 = 0x6
|
||||||
BPF_JNE = 0x50
|
BPF_JNE = 0x50
|
||||||
BPF_JSET = 0x40
|
BPF_JSET = 0x40
|
||||||
BPF_JSGE = 0x70
|
BPF_JSGE = 0x70
|
||||||
|
@ -1135,6 +1137,15 @@ const (
|
||||||
MAP_STACK = 0x20000
|
MAP_STACK = 0x20000
|
||||||
MAP_SYNC = 0x80000
|
MAP_SYNC = 0x80000
|
||||||
MAP_TYPE = 0xf
|
MAP_TYPE = 0xf
|
||||||
|
MCAST_BLOCK_SOURCE = 0x2b
|
||||||
|
MCAST_EXCLUDE = 0x0
|
||||||
|
MCAST_INCLUDE = 0x1
|
||||||
|
MCAST_JOIN_GROUP = 0x2a
|
||||||
|
MCAST_JOIN_SOURCE_GROUP = 0x2e
|
||||||
|
MCAST_LEAVE_GROUP = 0x2d
|
||||||
|
MCAST_LEAVE_SOURCE_GROUP = 0x2f
|
||||||
|
MCAST_MSFILTER = 0x30
|
||||||
|
MCAST_UNBLOCK_SOURCE = 0x2c
|
||||||
MCL_CURRENT = 0x1
|
MCL_CURRENT = 0x1
|
||||||
MCL_FUTURE = 0x2
|
MCL_FUTURE = 0x2
|
||||||
MCL_ONFAULT = 0x4
|
MCL_ONFAULT = 0x4
|
||||||
|
|
|
@ -229,6 +229,7 @@ const (
|
||||||
BPF_F_INDEX_MASK = 0xffffffff
|
BPF_F_INDEX_MASK = 0xffffffff
|
||||||
BPF_F_INGRESS = 0x1
|
BPF_F_INGRESS = 0x1
|
||||||
BPF_F_INVALIDATE_HASH = 0x2
|
BPF_F_INVALIDATE_HASH = 0x2
|
||||||
|
BPF_F_LOCK = 0x4
|
||||||
BPF_F_MARK_ENFORCE = 0x40
|
BPF_F_MARK_ENFORCE = 0x40
|
||||||
BPF_F_MARK_MANGLED_0 = 0x20
|
BPF_F_MARK_MANGLED_0 = 0x20
|
||||||
BPF_F_NO_COMMON_LRU = 0x2
|
BPF_F_NO_COMMON_LRU = 0x2
|
||||||
|
@ -259,6 +260,7 @@ const (
|
||||||
BPF_JLE = 0xb0
|
BPF_JLE = 0xb0
|
||||||
BPF_JLT = 0xa0
|
BPF_JLT = 0xa0
|
||||||
BPF_JMP = 0x5
|
BPF_JMP = 0x5
|
||||||
|
BPF_JMP32 = 0x6
|
||||||
BPF_JNE = 0x50
|
BPF_JNE = 0x50
|
||||||
BPF_JSET = 0x40
|
BPF_JSET = 0x40
|
||||||
BPF_JSGE = 0x70
|
BPF_JSGE = 0x70
|
||||||
|
@ -1132,6 +1134,15 @@ const (
|
||||||
MAP_SHARED_VALIDATE = 0x3
|
MAP_SHARED_VALIDATE = 0x3
|
||||||
MAP_STACK = 0x40000
|
MAP_STACK = 0x40000
|
||||||
MAP_TYPE = 0xf
|
MAP_TYPE = 0xf
|
||||||
|
MCAST_BLOCK_SOURCE = 0x2b
|
||||||
|
MCAST_EXCLUDE = 0x0
|
||||||
|
MCAST_INCLUDE = 0x1
|
||||||
|
MCAST_JOIN_GROUP = 0x2a
|
||||||
|
MCAST_JOIN_SOURCE_GROUP = 0x2e
|
||||||
|
MCAST_LEAVE_GROUP = 0x2d
|
||||||
|
MCAST_LEAVE_SOURCE_GROUP = 0x2f
|
||||||
|
MCAST_MSFILTER = 0x30
|
||||||
|
MCAST_UNBLOCK_SOURCE = 0x2c
|
||||||
MCL_CURRENT = 0x1
|
MCL_CURRENT = 0x1
|
||||||
MCL_FUTURE = 0x2
|
MCL_FUTURE = 0x2
|
||||||
MCL_ONFAULT = 0x4
|
MCL_ONFAULT = 0x4
|
||||||
|
|
|
@ -229,6 +229,7 @@ const (
|
||||||
BPF_F_INDEX_MASK = 0xffffffff
|
BPF_F_INDEX_MASK = 0xffffffff
|
||||||
BPF_F_INGRESS = 0x1
|
BPF_F_INGRESS = 0x1
|
||||||
BPF_F_INVALIDATE_HASH = 0x2
|
BPF_F_INVALIDATE_HASH = 0x2
|
||||||
|
BPF_F_LOCK = 0x4
|
||||||
BPF_F_MARK_ENFORCE = 0x40
|
BPF_F_MARK_ENFORCE = 0x40
|
||||||
BPF_F_MARK_MANGLED_0 = 0x20
|
BPF_F_MARK_MANGLED_0 = 0x20
|
||||||
BPF_F_NO_COMMON_LRU = 0x2
|
BPF_F_NO_COMMON_LRU = 0x2
|
||||||
|
@ -259,6 +260,7 @@ const (
|
||||||
BPF_JLE = 0xb0
|
BPF_JLE = 0xb0
|
||||||
BPF_JLT = 0xa0
|
BPF_JLT = 0xa0
|
||||||
BPF_JMP = 0x5
|
BPF_JMP = 0x5
|
||||||
|
BPF_JMP32 = 0x6
|
||||||
BPF_JNE = 0x50
|
BPF_JNE = 0x50
|
||||||
BPF_JSET = 0x40
|
BPF_JSET = 0x40
|
||||||
BPF_JSGE = 0x70
|
BPF_JSGE = 0x70
|
||||||
|
@ -1132,6 +1134,15 @@ const (
|
||||||
MAP_SHARED_VALIDATE = 0x3
|
MAP_SHARED_VALIDATE = 0x3
|
||||||
MAP_STACK = 0x40000
|
MAP_STACK = 0x40000
|
||||||
MAP_TYPE = 0xf
|
MAP_TYPE = 0xf
|
||||||
|
MCAST_BLOCK_SOURCE = 0x2b
|
||||||
|
MCAST_EXCLUDE = 0x0
|
||||||
|
MCAST_INCLUDE = 0x1
|
||||||
|
MCAST_JOIN_GROUP = 0x2a
|
||||||
|
MCAST_JOIN_SOURCE_GROUP = 0x2e
|
||||||
|
MCAST_LEAVE_GROUP = 0x2d
|
||||||
|
MCAST_LEAVE_SOURCE_GROUP = 0x2f
|
||||||
|
MCAST_MSFILTER = 0x30
|
||||||
|
MCAST_UNBLOCK_SOURCE = 0x2c
|
||||||
MCL_CURRENT = 0x1
|
MCL_CURRENT = 0x1
|
||||||
MCL_FUTURE = 0x2
|
MCL_FUTURE = 0x2
|
||||||
MCL_ONFAULT = 0x4
|
MCL_ONFAULT = 0x4
|
||||||
|
|
|
@ -229,6 +229,7 @@ const (
|
||||||
BPF_F_INDEX_MASK = 0xffffffff
|
BPF_F_INDEX_MASK = 0xffffffff
|
||||||
BPF_F_INGRESS = 0x1
|
BPF_F_INGRESS = 0x1
|
||||||
BPF_F_INVALIDATE_HASH = 0x2
|
BPF_F_INVALIDATE_HASH = 0x2
|
||||||
|
BPF_F_LOCK = 0x4
|
||||||
BPF_F_MARK_ENFORCE = 0x40
|
BPF_F_MARK_ENFORCE = 0x40
|
||||||
BPF_F_MARK_MANGLED_0 = 0x20
|
BPF_F_MARK_MANGLED_0 = 0x20
|
||||||
BPF_F_NO_COMMON_LRU = 0x2
|
BPF_F_NO_COMMON_LRU = 0x2
|
||||||
|
@ -259,6 +260,7 @@ const (
|
||||||
BPF_JLE = 0xb0
|
BPF_JLE = 0xb0
|
||||||
BPF_JLT = 0xa0
|
BPF_JLT = 0xa0
|
||||||
BPF_JMP = 0x5
|
BPF_JMP = 0x5
|
||||||
|
BPF_JMP32 = 0x6
|
||||||
BPF_JNE = 0x50
|
BPF_JNE = 0x50
|
||||||
BPF_JSET = 0x40
|
BPF_JSET = 0x40
|
||||||
BPF_JSGE = 0x70
|
BPF_JSGE = 0x70
|
||||||
|
@ -1132,6 +1134,15 @@ const (
|
||||||
MAP_SHARED_VALIDATE = 0x3
|
MAP_SHARED_VALIDATE = 0x3
|
||||||
MAP_STACK = 0x40000
|
MAP_STACK = 0x40000
|
||||||
MAP_TYPE = 0xf
|
MAP_TYPE = 0xf
|
||||||
|
MCAST_BLOCK_SOURCE = 0x2b
|
||||||
|
MCAST_EXCLUDE = 0x0
|
||||||
|
MCAST_INCLUDE = 0x1
|
||||||
|
MCAST_JOIN_GROUP = 0x2a
|
||||||
|
MCAST_JOIN_SOURCE_GROUP = 0x2e
|
||||||
|
MCAST_LEAVE_GROUP = 0x2d
|
||||||
|
MCAST_LEAVE_SOURCE_GROUP = 0x2f
|
||||||
|
MCAST_MSFILTER = 0x30
|
||||||
|
MCAST_UNBLOCK_SOURCE = 0x2c
|
||||||
MCL_CURRENT = 0x1
|
MCL_CURRENT = 0x1
|
||||||
MCL_FUTURE = 0x2
|
MCL_FUTURE = 0x2
|
||||||
MCL_ONFAULT = 0x4
|
MCL_ONFAULT = 0x4
|
||||||
|
|
|
@ -229,6 +229,7 @@ const (
|
||||||
BPF_F_INDEX_MASK = 0xffffffff
|
BPF_F_INDEX_MASK = 0xffffffff
|
||||||
BPF_F_INGRESS = 0x1
|
BPF_F_INGRESS = 0x1
|
||||||
BPF_F_INVALIDATE_HASH = 0x2
|
BPF_F_INVALIDATE_HASH = 0x2
|
||||||
|
BPF_F_LOCK = 0x4
|
||||||
BPF_F_MARK_ENFORCE = 0x40
|
BPF_F_MARK_ENFORCE = 0x40
|
||||||
BPF_F_MARK_MANGLED_0 = 0x20
|
BPF_F_MARK_MANGLED_0 = 0x20
|
||||||
BPF_F_NO_COMMON_LRU = 0x2
|
BPF_F_NO_COMMON_LRU = 0x2
|
||||||
|
@ -259,6 +260,7 @@ const (
|
||||||
BPF_JLE = 0xb0
|
BPF_JLE = 0xb0
|
||||||
BPF_JLT = 0xa0
|
BPF_JLT = 0xa0
|
||||||
BPF_JMP = 0x5
|
BPF_JMP = 0x5
|
||||||
|
BPF_JMP32 = 0x6
|
||||||
BPF_JNE = 0x50
|
BPF_JNE = 0x50
|
||||||
BPF_JSET = 0x40
|
BPF_JSET = 0x40
|
||||||
BPF_JSGE = 0x70
|
BPF_JSGE = 0x70
|
||||||
|
@ -1132,6 +1134,15 @@ const (
|
||||||
MAP_SHARED_VALIDATE = 0x3
|
MAP_SHARED_VALIDATE = 0x3
|
||||||
MAP_STACK = 0x40000
|
MAP_STACK = 0x40000
|
||||||
MAP_TYPE = 0xf
|
MAP_TYPE = 0xf
|
||||||
|
MCAST_BLOCK_SOURCE = 0x2b
|
||||||
|
MCAST_EXCLUDE = 0x0
|
||||||
|
MCAST_INCLUDE = 0x1
|
||||||
|
MCAST_JOIN_GROUP = 0x2a
|
||||||
|
MCAST_JOIN_SOURCE_GROUP = 0x2e
|
||||||
|
MCAST_LEAVE_GROUP = 0x2d
|
||||||
|
MCAST_LEAVE_SOURCE_GROUP = 0x2f
|
||||||
|
MCAST_MSFILTER = 0x30
|
||||||
|
MCAST_UNBLOCK_SOURCE = 0x2c
|
||||||
MCL_CURRENT = 0x1
|
MCL_CURRENT = 0x1
|
||||||
MCL_FUTURE = 0x2
|
MCL_FUTURE = 0x2
|
||||||
MCL_ONFAULT = 0x4
|
MCL_ONFAULT = 0x4
|
||||||
|
|
|
@ -229,6 +229,7 @@ const (
|
||||||
BPF_F_INDEX_MASK = 0xffffffff
|
BPF_F_INDEX_MASK = 0xffffffff
|
||||||
BPF_F_INGRESS = 0x1
|
BPF_F_INGRESS = 0x1
|
||||||
BPF_F_INVALIDATE_HASH = 0x2
|
BPF_F_INVALIDATE_HASH = 0x2
|
||||||
|
BPF_F_LOCK = 0x4
|
||||||
BPF_F_MARK_ENFORCE = 0x40
|
BPF_F_MARK_ENFORCE = 0x40
|
||||||
BPF_F_MARK_MANGLED_0 = 0x20
|
BPF_F_MARK_MANGLED_0 = 0x20
|
||||||
BPF_F_NO_COMMON_LRU = 0x2
|
BPF_F_NO_COMMON_LRU = 0x2
|
||||||
|
@ -259,6 +260,7 @@ const (
|
||||||
BPF_JLE = 0xb0
|
BPF_JLE = 0xb0
|
||||||
BPF_JLT = 0xa0
|
BPF_JLT = 0xa0
|
||||||
BPF_JMP = 0x5
|
BPF_JMP = 0x5
|
||||||
|
BPF_JMP32 = 0x6
|
||||||
BPF_JNE = 0x50
|
BPF_JNE = 0x50
|
||||||
BPF_JSET = 0x40
|
BPF_JSET = 0x40
|
||||||
BPF_JSGE = 0x70
|
BPF_JSGE = 0x70
|
||||||
|
@ -1131,6 +1133,15 @@ const (
|
||||||
MAP_SHARED_VALIDATE = 0x3
|
MAP_SHARED_VALIDATE = 0x3
|
||||||
MAP_STACK = 0x20000
|
MAP_STACK = 0x20000
|
||||||
MAP_TYPE = 0xf
|
MAP_TYPE = 0xf
|
||||||
|
MCAST_BLOCK_SOURCE = 0x2b
|
||||||
|
MCAST_EXCLUDE = 0x0
|
||||||
|
MCAST_INCLUDE = 0x1
|
||||||
|
MCAST_JOIN_GROUP = 0x2a
|
||||||
|
MCAST_JOIN_SOURCE_GROUP = 0x2e
|
||||||
|
MCAST_LEAVE_GROUP = 0x2d
|
||||||
|
MCAST_LEAVE_SOURCE_GROUP = 0x2f
|
||||||
|
MCAST_MSFILTER = 0x30
|
||||||
|
MCAST_UNBLOCK_SOURCE = 0x2c
|
||||||
MCL_CURRENT = 0x2000
|
MCL_CURRENT = 0x2000
|
||||||
MCL_FUTURE = 0x4000
|
MCL_FUTURE = 0x4000
|
||||||
MCL_ONFAULT = 0x8000
|
MCL_ONFAULT = 0x8000
|
||||||
|
|
|
@ -229,6 +229,7 @@ const (
|
||||||
BPF_F_INDEX_MASK = 0xffffffff
|
BPF_F_INDEX_MASK = 0xffffffff
|
||||||
BPF_F_INGRESS = 0x1
|
BPF_F_INGRESS = 0x1
|
||||||
BPF_F_INVALIDATE_HASH = 0x2
|
BPF_F_INVALIDATE_HASH = 0x2
|
||||||
|
BPF_F_LOCK = 0x4
|
||||||
BPF_F_MARK_ENFORCE = 0x40
|
BPF_F_MARK_ENFORCE = 0x40
|
||||||
BPF_F_MARK_MANGLED_0 = 0x20
|
BPF_F_MARK_MANGLED_0 = 0x20
|
||||||
BPF_F_NO_COMMON_LRU = 0x2
|
BPF_F_NO_COMMON_LRU = 0x2
|
||||||
|
@ -259,6 +260,7 @@ const (
|
||||||
BPF_JLE = 0xb0
|
BPF_JLE = 0xb0
|
||||||
BPF_JLT = 0xa0
|
BPF_JLT = 0xa0
|
||||||
BPF_JMP = 0x5
|
BPF_JMP = 0x5
|
||||||
|
BPF_JMP32 = 0x6
|
||||||
BPF_JNE = 0x50
|
BPF_JNE = 0x50
|
||||||
BPF_JSET = 0x40
|
BPF_JSET = 0x40
|
||||||
BPF_JSGE = 0x70
|
BPF_JSGE = 0x70
|
||||||
|
@ -1131,6 +1133,15 @@ const (
|
||||||
MAP_SHARED_VALIDATE = 0x3
|
MAP_SHARED_VALIDATE = 0x3
|
||||||
MAP_STACK = 0x20000
|
MAP_STACK = 0x20000
|
||||||
MAP_TYPE = 0xf
|
MAP_TYPE = 0xf
|
||||||
|
MCAST_BLOCK_SOURCE = 0x2b
|
||||||
|
MCAST_EXCLUDE = 0x0
|
||||||
|
MCAST_INCLUDE = 0x1
|
||||||
|
MCAST_JOIN_GROUP = 0x2a
|
||||||
|
MCAST_JOIN_SOURCE_GROUP = 0x2e
|
||||||
|
MCAST_LEAVE_GROUP = 0x2d
|
||||||
|
MCAST_LEAVE_SOURCE_GROUP = 0x2f
|
||||||
|
MCAST_MSFILTER = 0x30
|
||||||
|
MCAST_UNBLOCK_SOURCE = 0x2c
|
||||||
MCL_CURRENT = 0x2000
|
MCL_CURRENT = 0x2000
|
||||||
MCL_FUTURE = 0x4000
|
MCL_FUTURE = 0x4000
|
||||||
MCL_ONFAULT = 0x8000
|
MCL_ONFAULT = 0x8000
|
||||||
|
|
|
@ -229,6 +229,7 @@ const (
|
||||||
BPF_F_INDEX_MASK = 0xffffffff
|
BPF_F_INDEX_MASK = 0xffffffff
|
||||||
BPF_F_INGRESS = 0x1
|
BPF_F_INGRESS = 0x1
|
||||||
BPF_F_INVALIDATE_HASH = 0x2
|
BPF_F_INVALIDATE_HASH = 0x2
|
||||||
|
BPF_F_LOCK = 0x4
|
||||||
BPF_F_MARK_ENFORCE = 0x40
|
BPF_F_MARK_ENFORCE = 0x40
|
||||||
BPF_F_MARK_MANGLED_0 = 0x20
|
BPF_F_MARK_MANGLED_0 = 0x20
|
||||||
BPF_F_NO_COMMON_LRU = 0x2
|
BPF_F_NO_COMMON_LRU = 0x2
|
||||||
|
@ -259,6 +260,7 @@ const (
|
||||||
BPF_JLE = 0xb0
|
BPF_JLE = 0xb0
|
||||||
BPF_JLT = 0xa0
|
BPF_JLT = 0xa0
|
||||||
BPF_JMP = 0x5
|
BPF_JMP = 0x5
|
||||||
|
BPF_JMP32 = 0x6
|
||||||
BPF_JNE = 0x50
|
BPF_JNE = 0x50
|
||||||
BPF_JSET = 0x40
|
BPF_JSET = 0x40
|
||||||
BPF_JSGE = 0x70
|
BPF_JSGE = 0x70
|
||||||
|
@ -1132,6 +1134,15 @@ const (
|
||||||
MAP_STACK = 0x20000
|
MAP_STACK = 0x20000
|
||||||
MAP_SYNC = 0x80000
|
MAP_SYNC = 0x80000
|
||||||
MAP_TYPE = 0xf
|
MAP_TYPE = 0xf
|
||||||
|
MCAST_BLOCK_SOURCE = 0x2b
|
||||||
|
MCAST_EXCLUDE = 0x0
|
||||||
|
MCAST_INCLUDE = 0x1
|
||||||
|
MCAST_JOIN_GROUP = 0x2a
|
||||||
|
MCAST_JOIN_SOURCE_GROUP = 0x2e
|
||||||
|
MCAST_LEAVE_GROUP = 0x2d
|
||||||
|
MCAST_LEAVE_SOURCE_GROUP = 0x2f
|
||||||
|
MCAST_MSFILTER = 0x30
|
||||||
|
MCAST_UNBLOCK_SOURCE = 0x2c
|
||||||
MCL_CURRENT = 0x1
|
MCL_CURRENT = 0x1
|
||||||
MCL_FUTURE = 0x2
|
MCL_FUTURE = 0x2
|
||||||
MCL_ONFAULT = 0x4
|
MCL_ONFAULT = 0x4
|
||||||
|
|
|
@ -229,6 +229,7 @@ const (
|
||||||
BPF_F_INDEX_MASK = 0xffffffff
|
BPF_F_INDEX_MASK = 0xffffffff
|
||||||
BPF_F_INGRESS = 0x1
|
BPF_F_INGRESS = 0x1
|
||||||
BPF_F_INVALIDATE_HASH = 0x2
|
BPF_F_INVALIDATE_HASH = 0x2
|
||||||
|
BPF_F_LOCK = 0x4
|
||||||
BPF_F_MARK_ENFORCE = 0x40
|
BPF_F_MARK_ENFORCE = 0x40
|
||||||
BPF_F_MARK_MANGLED_0 = 0x20
|
BPF_F_MARK_MANGLED_0 = 0x20
|
||||||
BPF_F_NO_COMMON_LRU = 0x2
|
BPF_F_NO_COMMON_LRU = 0x2
|
||||||
|
@ -259,6 +260,7 @@ const (
|
||||||
BPF_JLE = 0xb0
|
BPF_JLE = 0xb0
|
||||||
BPF_JLT = 0xa0
|
BPF_JLT = 0xa0
|
||||||
BPF_JMP = 0x5
|
BPF_JMP = 0x5
|
||||||
|
BPF_JMP32 = 0x6
|
||||||
BPF_JNE = 0x50
|
BPF_JNE = 0x50
|
||||||
BPF_JSET = 0x40
|
BPF_JSET = 0x40
|
||||||
BPF_JSGE = 0x70
|
BPF_JSGE = 0x70
|
||||||
|
@ -1132,6 +1134,15 @@ const (
|
||||||
MAP_STACK = 0x20000
|
MAP_STACK = 0x20000
|
||||||
MAP_SYNC = 0x80000
|
MAP_SYNC = 0x80000
|
||||||
MAP_TYPE = 0xf
|
MAP_TYPE = 0xf
|
||||||
|
MCAST_BLOCK_SOURCE = 0x2b
|
||||||
|
MCAST_EXCLUDE = 0x0
|
||||||
|
MCAST_INCLUDE = 0x1
|
||||||
|
MCAST_JOIN_GROUP = 0x2a
|
||||||
|
MCAST_JOIN_SOURCE_GROUP = 0x2e
|
||||||
|
MCAST_LEAVE_GROUP = 0x2d
|
||||||
|
MCAST_LEAVE_SOURCE_GROUP = 0x2f
|
||||||
|
MCAST_MSFILTER = 0x30
|
||||||
|
MCAST_UNBLOCK_SOURCE = 0x2c
|
||||||
MCL_CURRENT = 0x1
|
MCL_CURRENT = 0x1
|
||||||
MCL_FUTURE = 0x2
|
MCL_FUTURE = 0x2
|
||||||
MCL_ONFAULT = 0x4
|
MCL_ONFAULT = 0x4
|
||||||
|
|
|
@ -232,6 +232,7 @@ const (
|
||||||
BPF_F_INDEX_MASK = 0xffffffff
|
BPF_F_INDEX_MASK = 0xffffffff
|
||||||
BPF_F_INGRESS = 0x1
|
BPF_F_INGRESS = 0x1
|
||||||
BPF_F_INVALIDATE_HASH = 0x2
|
BPF_F_INVALIDATE_HASH = 0x2
|
||||||
|
BPF_F_LOCK = 0x4
|
||||||
BPF_F_MARK_ENFORCE = 0x40
|
BPF_F_MARK_ENFORCE = 0x40
|
||||||
BPF_F_MARK_MANGLED_0 = 0x20
|
BPF_F_MARK_MANGLED_0 = 0x20
|
||||||
BPF_F_NO_COMMON_LRU = 0x2
|
BPF_F_NO_COMMON_LRU = 0x2
|
||||||
|
@ -262,6 +263,7 @@ const (
|
||||||
BPF_JLE = 0xb0
|
BPF_JLE = 0xb0
|
||||||
BPF_JLT = 0xa0
|
BPF_JLT = 0xa0
|
||||||
BPF_JMP = 0x5
|
BPF_JMP = 0x5
|
||||||
|
BPF_JMP32 = 0x6
|
||||||
BPF_JNE = 0x50
|
BPF_JNE = 0x50
|
||||||
BPF_JSET = 0x40
|
BPF_JSET = 0x40
|
||||||
BPF_JSGE = 0x70
|
BPF_JSGE = 0x70
|
||||||
|
@ -1136,6 +1138,15 @@ const (
|
||||||
MAP_SHARED_VALIDATE = 0x3
|
MAP_SHARED_VALIDATE = 0x3
|
||||||
MAP_STACK = 0x20000
|
MAP_STACK = 0x20000
|
||||||
MAP_TYPE = 0xf
|
MAP_TYPE = 0xf
|
||||||
|
MCAST_BLOCK_SOURCE = 0x2b
|
||||||
|
MCAST_EXCLUDE = 0x0
|
||||||
|
MCAST_INCLUDE = 0x1
|
||||||
|
MCAST_JOIN_GROUP = 0x2a
|
||||||
|
MCAST_JOIN_SOURCE_GROUP = 0x2e
|
||||||
|
MCAST_LEAVE_GROUP = 0x2d
|
||||||
|
MCAST_LEAVE_SOURCE_GROUP = 0x2f
|
||||||
|
MCAST_MSFILTER = 0x30
|
||||||
|
MCAST_UNBLOCK_SOURCE = 0x2c
|
||||||
MCL_CURRENT = 0x2000
|
MCL_CURRENT = 0x2000
|
||||||
MCL_FUTURE = 0x4000
|
MCL_FUTURE = 0x4000
|
||||||
MCL_ONFAULT = 0x8000
|
MCL_ONFAULT = 0x8000
|
||||||
|
|
|
@ -859,7 +859,7 @@ func Fchown(fd int, uid int, gid int) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Fstat(fd int, stat *Stat_t) (err error) {
|
func fstat(fd int, stat *Stat_t) (err error) {
|
||||||
r0, er := C.fstat(C.int(fd), C.uintptr_t(uintptr(unsafe.Pointer(stat))))
|
r0, er := C.fstat(C.int(fd), C.uintptr_t(uintptr(unsafe.Pointer(stat))))
|
||||||
if r0 == -1 && er != nil {
|
if r0 == -1 && er != nil {
|
||||||
err = er
|
err = er
|
||||||
|
@ -869,7 +869,7 @@ func Fstat(fd int, stat *Stat_t) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) {
|
func fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) {
|
||||||
_p0 := uintptr(unsafe.Pointer(C.CString(path)))
|
_p0 := uintptr(unsafe.Pointer(C.CString(path)))
|
||||||
r0, er := C.fstatat(C.int(dirfd), C.uintptr_t(_p0), C.uintptr_t(uintptr(unsafe.Pointer(stat))), C.int(flags))
|
r0, er := C.fstatat(C.int(dirfd), C.uintptr_t(_p0), C.uintptr_t(uintptr(unsafe.Pointer(stat))), C.int(flags))
|
||||||
if r0 == -1 && er != nil {
|
if r0 == -1 && er != nil {
|
||||||
|
@ -953,7 +953,7 @@ func Listen(s int, n int) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Lstat(path string, stat *Stat_t) (err error) {
|
func lstat(path string, stat *Stat_t) (err error) {
|
||||||
_p0 := uintptr(unsafe.Pointer(C.CString(path)))
|
_p0 := uintptr(unsafe.Pointer(C.CString(path)))
|
||||||
r0, er := C.lstat(C.uintptr_t(_p0), C.uintptr_t(uintptr(unsafe.Pointer(stat))))
|
r0, er := C.lstat(C.uintptr_t(_p0), C.uintptr_t(uintptr(unsafe.Pointer(stat))))
|
||||||
if r0 == -1 && er != nil {
|
if r0 == -1 && er != nil {
|
||||||
|
@ -1071,9 +1071,9 @@ func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n i
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Stat(path string, stat *Stat_t) (err error) {
|
func stat(path string, statptr *Stat_t) (err error) {
|
||||||
_p0 := uintptr(unsafe.Pointer(C.CString(path)))
|
_p0 := uintptr(unsafe.Pointer(C.CString(path)))
|
||||||
r0, er := C.stat(C.uintptr_t(_p0), C.uintptr_t(uintptr(unsafe.Pointer(stat))))
|
r0, er := C.stat(C.uintptr_t(_p0), C.uintptr_t(uintptr(unsafe.Pointer(statptr))))
|
||||||
if r0 == -1 && er != nil {
|
if r0 == -1 && er != nil {
|
||||||
err = er
|
err = er
|
||||||
}
|
}
|
||||||
|
|
|
@ -803,7 +803,7 @@ func Fchown(fd int, uid int, gid int) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Fstat(fd int, stat *Stat_t) (err error) {
|
func fstat(fd int, stat *Stat_t) (err error) {
|
||||||
_, e1 := callfstat(fd, uintptr(unsafe.Pointer(stat)))
|
_, e1 := callfstat(fd, uintptr(unsafe.Pointer(stat)))
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
|
@ -813,7 +813,7 @@ func Fstat(fd int, stat *Stat_t) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) {
|
func fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) {
|
||||||
var _p0 *byte
|
var _p0 *byte
|
||||||
_p0, err = BytePtrFromString(path)
|
_p0, err = BytePtrFromString(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -905,7 +905,7 @@ func Listen(s int, n int) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Lstat(path string, stat *Stat_t) (err error) {
|
func lstat(path string, stat *Stat_t) (err error) {
|
||||||
var _p0 *byte
|
var _p0 *byte
|
||||||
_p0, err = BytePtrFromString(path)
|
_p0, err = BytePtrFromString(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1023,13 +1023,13 @@ func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n i
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Stat(path string, stat *Stat_t) (err error) {
|
func stat(path string, statptr *Stat_t) (err error) {
|
||||||
var _p0 *byte
|
var _p0 *byte
|
||||||
_p0, err = BytePtrFromString(path)
|
_p0, err = BytePtrFromString(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
_, e1 := callstat(uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)))
|
_, e1 := callstat(uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(statptr)))
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
|
|
@ -941,8 +941,8 @@ func callsplice(rfd int, roff uintptr, wfd int, woff uintptr, len int, flags int
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func callstat(_p0 uintptr, stat uintptr) (r1 uintptr, e1 Errno) {
|
func callstat(_p0 uintptr, statptr uintptr) (r1 uintptr, e1 Errno) {
|
||||||
r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_stat)), 2, _p0, stat, 0, 0, 0, 0)
|
r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_stat)), 2, _p0, statptr, 0, 0, 0, 0)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -783,8 +783,8 @@ func callsplice(rfd int, roff uintptr, wfd int, woff uintptr, len int, flags int
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func callstat(_p0 uintptr, stat uintptr) (r1 uintptr, e1 Errno) {
|
func callstat(_p0 uintptr, statptr uintptr) (r1 uintptr, e1 Errno) {
|
||||||
r1 = uintptr(C.stat(C.uintptr_t(_p0), C.uintptr_t(stat)))
|
r1 = uintptr(C.stat(C.uintptr_t(_p0), C.uintptr_t(statptr)))
|
||||||
e1 = syscall.GetErrno()
|
e1 = syscall.GetErrno()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -1381,8 +1381,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Signalfd(fd int, mask *Sigset_t, flags int) {
|
func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) {
|
||||||
SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags))
|
r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0)
|
||||||
|
newfd = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1381,8 +1381,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Signalfd(fd int, mask *Sigset_t, flags int) {
|
func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) {
|
||||||
SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags))
|
r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0)
|
||||||
|
newfd = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1381,8 +1381,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Signalfd(fd int, mask *Sigset_t, flags int) {
|
func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) {
|
||||||
SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags))
|
r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0)
|
||||||
|
newfd = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1381,8 +1381,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Signalfd(fd int, mask *Sigset_t, flags int) {
|
func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) {
|
||||||
SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags))
|
r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0)
|
||||||
|
newfd = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1381,8 +1381,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Signalfd(fd int, mask *Sigset_t, flags int) {
|
func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) {
|
||||||
SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags))
|
r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0)
|
||||||
|
newfd = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1381,8 +1381,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Signalfd(fd int, mask *Sigset_t, flags int) {
|
func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) {
|
||||||
SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags))
|
r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0)
|
||||||
|
newfd = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1381,8 +1381,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Signalfd(fd int, mask *Sigset_t, flags int) {
|
func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) {
|
||||||
SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags))
|
r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0)
|
||||||
|
newfd = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1381,8 +1381,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Signalfd(fd int, mask *Sigset_t, flags int) {
|
func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) {
|
||||||
SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags))
|
r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0)
|
||||||
|
newfd = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1381,8 +1381,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Signalfd(fd int, mask *Sigset_t, flags int) {
|
func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) {
|
||||||
SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags))
|
r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0)
|
||||||
|
newfd = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1381,8 +1381,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Signalfd(fd int, mask *Sigset_t, flags int) {
|
func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) {
|
||||||
SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags))
|
r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0)
|
||||||
|
newfd = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1381,8 +1381,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Signalfd(fd int, mask *Sigset_t, flags int) {
|
func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) {
|
||||||
SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags))
|
r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0)
|
||||||
|
newfd = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1381,8 +1381,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Signalfd(fd int, mask *Sigset_t, flags int) {
|
func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) {
|
||||||
SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags))
|
r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0)
|
||||||
|
newfd = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1381,8 +1381,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Signalfd(fd int, mask *Sigset_t, flags int) {
|
func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) {
|
||||||
SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags))
|
r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0)
|
||||||
|
newfd = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,11 +30,6 @@ type Timespec struct {
|
||||||
Nsec int32
|
Nsec int32
|
||||||
}
|
}
|
||||||
|
|
||||||
type StTimespec struct {
|
|
||||||
Sec int32
|
|
||||||
Nsec int32
|
|
||||||
}
|
|
||||||
|
|
||||||
type Timeval struct {
|
type Timeval struct {
|
||||||
Sec int32
|
Sec int32
|
||||||
Usec int32
|
Usec int32
|
||||||
|
@ -101,9 +96,9 @@ type Stat_t struct {
|
||||||
Gid uint32
|
Gid uint32
|
||||||
Rdev uint32
|
Rdev uint32
|
||||||
Size int32
|
Size int32
|
||||||
Atim StTimespec
|
Atim Timespec
|
||||||
Mtim StTimespec
|
Mtim Timespec
|
||||||
Ctim StTimespec
|
Ctim Timespec
|
||||||
Blksize int32
|
Blksize int32
|
||||||
Blocks int32
|
Blocks int32
|
||||||
Vfstype int32
|
Vfstype int32
|
||||||
|
@ -148,6 +143,17 @@ type RawSockaddrUnix struct {
|
||||||
Path [1023]uint8
|
Path [1023]uint8
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type RawSockaddrDatalink struct {
|
||||||
|
Len uint8
|
||||||
|
Family uint8
|
||||||
|
Index uint16
|
||||||
|
Type uint8
|
||||||
|
Nlen uint8
|
||||||
|
Alen uint8
|
||||||
|
Slen uint8
|
||||||
|
Data [120]uint8
|
||||||
|
}
|
||||||
|
|
||||||
type RawSockaddr struct {
|
type RawSockaddr struct {
|
||||||
Len uint8
|
Len uint8
|
||||||
Family uint8
|
Family uint8
|
||||||
|
@ -207,17 +213,18 @@ type Msghdr struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeofSockaddrInet4 = 0x10
|
SizeofSockaddrInet4 = 0x10
|
||||||
SizeofSockaddrInet6 = 0x1c
|
SizeofSockaddrInet6 = 0x1c
|
||||||
SizeofSockaddrAny = 0x404
|
SizeofSockaddrAny = 0x404
|
||||||
SizeofSockaddrUnix = 0x401
|
SizeofSockaddrUnix = 0x401
|
||||||
SizeofLinger = 0x8
|
SizeofSockaddrDatalink = 0x80
|
||||||
SizeofIPMreq = 0x8
|
SizeofLinger = 0x8
|
||||||
SizeofIPv6Mreq = 0x14
|
SizeofIPMreq = 0x8
|
||||||
SizeofIPv6MTUInfo = 0x20
|
SizeofIPv6Mreq = 0x14
|
||||||
SizeofMsghdr = 0x1c
|
SizeofIPv6MTUInfo = 0x20
|
||||||
SizeofCmsghdr = 0xc
|
SizeofMsghdr = 0x1c
|
||||||
SizeofICMPv6Filter = 0x20
|
SizeofCmsghdr = 0xc
|
||||||
|
SizeofICMPv6Filter = 0x20
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -30,12 +30,6 @@ type Timespec struct {
|
||||||
Nsec int64
|
Nsec int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type StTimespec struct {
|
|
||||||
Sec int64
|
|
||||||
Nsec int32
|
|
||||||
_ [4]byte
|
|
||||||
}
|
|
||||||
|
|
||||||
type Timeval struct {
|
type Timeval struct {
|
||||||
Sec int64
|
Sec int64
|
||||||
Usec int32
|
Usec int32
|
||||||
|
@ -103,9 +97,9 @@ type Stat_t struct {
|
||||||
Gid uint32
|
Gid uint32
|
||||||
Rdev uint64
|
Rdev uint64
|
||||||
Ssize int32
|
Ssize int32
|
||||||
Atim StTimespec
|
Atim Timespec
|
||||||
Mtim StTimespec
|
Mtim Timespec
|
||||||
Ctim StTimespec
|
Ctim Timespec
|
||||||
Blksize int64
|
Blksize int64
|
||||||
Blocks int64
|
Blocks int64
|
||||||
Vfstype int32
|
Vfstype int32
|
||||||
|
@ -153,6 +147,17 @@ type RawSockaddrUnix struct {
|
||||||
Path [1023]uint8
|
Path [1023]uint8
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type RawSockaddrDatalink struct {
|
||||||
|
Len uint8
|
||||||
|
Family uint8
|
||||||
|
Index uint16
|
||||||
|
Type uint8
|
||||||
|
Nlen uint8
|
||||||
|
Alen uint8
|
||||||
|
Slen uint8
|
||||||
|
Data [120]uint8
|
||||||
|
}
|
||||||
|
|
||||||
type RawSockaddr struct {
|
type RawSockaddr struct {
|
||||||
Len uint8
|
Len uint8
|
||||||
Family uint8
|
Family uint8
|
||||||
|
@ -212,17 +217,18 @@ type Msghdr struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeofSockaddrInet4 = 0x10
|
SizeofSockaddrInet4 = 0x10
|
||||||
SizeofSockaddrInet6 = 0x1c
|
SizeofSockaddrInet6 = 0x1c
|
||||||
SizeofSockaddrAny = 0x404
|
SizeofSockaddrAny = 0x404
|
||||||
SizeofSockaddrUnix = 0x401
|
SizeofSockaddrUnix = 0x401
|
||||||
SizeofLinger = 0x8
|
SizeofSockaddrDatalink = 0x80
|
||||||
SizeofIPMreq = 0x8
|
SizeofLinger = 0x8
|
||||||
SizeofIPv6Mreq = 0x14
|
SizeofIPMreq = 0x8
|
||||||
SizeofIPv6MTUInfo = 0x20
|
SizeofIPv6Mreq = 0x14
|
||||||
SizeofMsghdr = 0x30
|
SizeofIPv6MTUInfo = 0x20
|
||||||
SizeofCmsghdr = 0xc
|
SizeofMsghdr = 0x30
|
||||||
SizeofICMPv6Filter = 0x20
|
SizeofCmsghdr = 0xc
|
||||||
|
SizeofICMPv6Filter = 0x20
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -59,24 +59,24 @@ type Rlimit struct {
|
||||||
type _Gid_t uint32
|
type _Gid_t uint32
|
||||||
|
|
||||||
type Stat_t struct {
|
type Stat_t struct {
|
||||||
Dev int32
|
Dev int32
|
||||||
Mode uint16
|
Mode uint16
|
||||||
Nlink uint16
|
Nlink uint16
|
||||||
Ino uint64
|
Ino uint64
|
||||||
Uid uint32
|
Uid uint32
|
||||||
Gid uint32
|
Gid uint32
|
||||||
Rdev int32
|
Rdev int32
|
||||||
Atimespec Timespec
|
Atim Timespec
|
||||||
Mtimespec Timespec
|
Mtim Timespec
|
||||||
Ctimespec Timespec
|
Ctim Timespec
|
||||||
Birthtimespec Timespec
|
Btim Timespec
|
||||||
Size int64
|
Size int64
|
||||||
Blocks int64
|
Blocks int64
|
||||||
Blksize int32
|
Blksize int32
|
||||||
Flags uint32
|
Flags uint32
|
||||||
Gen uint32
|
Gen uint32
|
||||||
Lspare int32
|
Lspare int32
|
||||||
Qspare [2]int64
|
Qspare [2]int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type Statfs_t struct {
|
type Statfs_t struct {
|
||||||
|
|
|
@ -63,25 +63,25 @@ type Rlimit struct {
|
||||||
type _Gid_t uint32
|
type _Gid_t uint32
|
||||||
|
|
||||||
type Stat_t struct {
|
type Stat_t struct {
|
||||||
Dev int32
|
Dev int32
|
||||||
Mode uint16
|
Mode uint16
|
||||||
Nlink uint16
|
Nlink uint16
|
||||||
Ino uint64
|
Ino uint64
|
||||||
Uid uint32
|
Uid uint32
|
||||||
Gid uint32
|
Gid uint32
|
||||||
Rdev int32
|
Rdev int32
|
||||||
_ [4]byte
|
_ [4]byte
|
||||||
Atimespec Timespec
|
Atim Timespec
|
||||||
Mtimespec Timespec
|
Mtim Timespec
|
||||||
Ctimespec Timespec
|
Ctim Timespec
|
||||||
Birthtimespec Timespec
|
Btim Timespec
|
||||||
Size int64
|
Size int64
|
||||||
Blocks int64
|
Blocks int64
|
||||||
Blksize int32
|
Blksize int32
|
||||||
Flags uint32
|
Flags uint32
|
||||||
Gen uint32
|
Gen uint32
|
||||||
Lspare int32
|
Lspare int32
|
||||||
Qspare [2]int64
|
Qspare [2]int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type Statfs_t struct {
|
type Statfs_t struct {
|
||||||
|
|
|
@ -60,24 +60,24 @@ type Rlimit struct {
|
||||||
type _Gid_t uint32
|
type _Gid_t uint32
|
||||||
|
|
||||||
type Stat_t struct {
|
type Stat_t struct {
|
||||||
Dev int32
|
Dev int32
|
||||||
Mode uint16
|
Mode uint16
|
||||||
Nlink uint16
|
Nlink uint16
|
||||||
Ino uint64
|
Ino uint64
|
||||||
Uid uint32
|
Uid uint32
|
||||||
Gid uint32
|
Gid uint32
|
||||||
Rdev int32
|
Rdev int32
|
||||||
Atimespec Timespec
|
Atim Timespec
|
||||||
Mtimespec Timespec
|
Mtim Timespec
|
||||||
Ctimespec Timespec
|
Ctim Timespec
|
||||||
Birthtimespec Timespec
|
Btim Timespec
|
||||||
Size int64
|
Size int64
|
||||||
Blocks int64
|
Blocks int64
|
||||||
Blksize int32
|
Blksize int32
|
||||||
Flags uint32
|
Flags uint32
|
||||||
Gen uint32
|
Gen uint32
|
||||||
Lspare int32
|
Lspare int32
|
||||||
Qspare [2]int64
|
Qspare [2]int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type Statfs_t struct {
|
type Statfs_t struct {
|
||||||
|
|
|
@ -63,25 +63,25 @@ type Rlimit struct {
|
||||||
type _Gid_t uint32
|
type _Gid_t uint32
|
||||||
|
|
||||||
type Stat_t struct {
|
type Stat_t struct {
|
||||||
Dev int32
|
Dev int32
|
||||||
Mode uint16
|
Mode uint16
|
||||||
Nlink uint16
|
Nlink uint16
|
||||||
Ino uint64
|
Ino uint64
|
||||||
Uid uint32
|
Uid uint32
|
||||||
Gid uint32
|
Gid uint32
|
||||||
Rdev int32
|
Rdev int32
|
||||||
_ [4]byte
|
_ [4]byte
|
||||||
Atimespec Timespec
|
Atim Timespec
|
||||||
Mtimespec Timespec
|
Mtim Timespec
|
||||||
Ctimespec Timespec
|
Ctim Timespec
|
||||||
Birthtimespec Timespec
|
Btim Timespec
|
||||||
Size int64
|
Size int64
|
||||||
Blocks int64
|
Blocks int64
|
||||||
Blksize int32
|
Blksize int32
|
||||||
Flags uint32
|
Flags uint32
|
||||||
Gen uint32
|
Gen uint32
|
||||||
Lspare int32
|
Lspare int32
|
||||||
Qspare [2]int64
|
Qspare [2]int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type Statfs_t struct {
|
type Statfs_t struct {
|
||||||
|
|
|
@ -57,25 +57,25 @@ type Rlimit struct {
|
||||||
type _Gid_t uint32
|
type _Gid_t uint32
|
||||||
|
|
||||||
type Stat_t struct {
|
type Stat_t struct {
|
||||||
Ino uint64
|
Ino uint64
|
||||||
Nlink uint32
|
Nlink uint32
|
||||||
Dev uint32
|
Dev uint32
|
||||||
Mode uint16
|
Mode uint16
|
||||||
Padding1 uint16
|
_1 uint16
|
||||||
Uid uint32
|
Uid uint32
|
||||||
Gid uint32
|
Gid uint32
|
||||||
Rdev uint32
|
Rdev uint32
|
||||||
Atim Timespec
|
Atim Timespec
|
||||||
Mtim Timespec
|
Mtim Timespec
|
||||||
Ctim Timespec
|
Ctim Timespec
|
||||||
Size int64
|
Size int64
|
||||||
Blocks int64
|
Blocks int64
|
||||||
Blksize uint32
|
Blksize uint32
|
||||||
Flags uint32
|
Flags uint32
|
||||||
Gen uint32
|
Gen uint32
|
||||||
Lspare int32
|
Lspare int32
|
||||||
Qspare1 int64
|
Qspare1 int64
|
||||||
Qspare2 int64
|
Qspare2 int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type Statfs_t struct {
|
type Statfs_t struct {
|
||||||
|
|
|
@ -62,50 +62,50 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Stat_t struct {
|
type Stat_t struct {
|
||||||
Dev uint64
|
Dev uint64
|
||||||
Ino uint64
|
Ino uint64
|
||||||
Nlink uint64
|
Nlink uint64
|
||||||
Mode uint16
|
Mode uint16
|
||||||
_0 int16
|
_0 int16
|
||||||
Uid uint32
|
Uid uint32
|
||||||
Gid uint32
|
Gid uint32
|
||||||
_1 int32
|
_1 int32
|
||||||
Rdev uint64
|
Rdev uint64
|
||||||
Atim_ext int32
|
_ int32
|
||||||
Atim Timespec
|
Atim Timespec
|
||||||
Mtim_ext int32
|
_ int32
|
||||||
Mtim Timespec
|
Mtim Timespec
|
||||||
Ctim_ext int32
|
_ int32
|
||||||
Ctim Timespec
|
Ctim Timespec
|
||||||
Btim_ext int32
|
_ int32
|
||||||
Birthtim Timespec
|
Btim Timespec
|
||||||
Size int64
|
Size int64
|
||||||
Blocks int64
|
Blocks int64
|
||||||
Blksize int32
|
Blksize int32
|
||||||
Flags uint32
|
Flags uint32
|
||||||
Gen uint64
|
Gen uint64
|
||||||
Spare [10]uint64
|
Spare [10]uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
type stat_freebsd11_t struct {
|
type stat_freebsd11_t struct {
|
||||||
Dev uint32
|
Dev uint32
|
||||||
Ino uint32
|
Ino uint32
|
||||||
Mode uint16
|
Mode uint16
|
||||||
Nlink uint16
|
Nlink uint16
|
||||||
Uid uint32
|
Uid uint32
|
||||||
Gid uint32
|
Gid uint32
|
||||||
Rdev uint32
|
Rdev uint32
|
||||||
Atim Timespec
|
Atim Timespec
|
||||||
Mtim Timespec
|
Mtim Timespec
|
||||||
Ctim Timespec
|
Ctim Timespec
|
||||||
Size int64
|
Size int64
|
||||||
Blocks int64
|
Blocks int64
|
||||||
Blksize int32
|
Blksize int32
|
||||||
Flags uint32
|
Flags uint32
|
||||||
Gen uint32
|
Gen uint32
|
||||||
Lspare int32
|
Lspare int32
|
||||||
Birthtim Timespec
|
Btim Timespec
|
||||||
_ [8]byte
|
_ [8]byte
|
||||||
}
|
}
|
||||||
|
|
||||||
type Statfs_t struct {
|
type Statfs_t struct {
|
||||||
|
|
|
@ -62,45 +62,45 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Stat_t struct {
|
type Stat_t struct {
|
||||||
Dev uint64
|
Dev uint64
|
||||||
Ino uint64
|
Ino uint64
|
||||||
Nlink uint64
|
Nlink uint64
|
||||||
Mode uint16
|
Mode uint16
|
||||||
_0 int16
|
_0 int16
|
||||||
Uid uint32
|
Uid uint32
|
||||||
Gid uint32
|
Gid uint32
|
||||||
_1 int32
|
_1 int32
|
||||||
Rdev uint64
|
Rdev uint64
|
||||||
Atim Timespec
|
Atim Timespec
|
||||||
Mtim Timespec
|
Mtim Timespec
|
||||||
Ctim Timespec
|
Ctim Timespec
|
||||||
Birthtim Timespec
|
Btim Timespec
|
||||||
Size int64
|
Size int64
|
||||||
Blocks int64
|
Blocks int64
|
||||||
Blksize int32
|
Blksize int32
|
||||||
Flags uint32
|
Flags uint32
|
||||||
Gen uint64
|
Gen uint64
|
||||||
Spare [10]uint64
|
Spare [10]uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
type stat_freebsd11_t struct {
|
type stat_freebsd11_t struct {
|
||||||
Dev uint32
|
Dev uint32
|
||||||
Ino uint32
|
Ino uint32
|
||||||
Mode uint16
|
Mode uint16
|
||||||
Nlink uint16
|
Nlink uint16
|
||||||
Uid uint32
|
Uid uint32
|
||||||
Gid uint32
|
Gid uint32
|
||||||
Rdev uint32
|
Rdev uint32
|
||||||
Atim Timespec
|
Atim Timespec
|
||||||
Mtim Timespec
|
Mtim Timespec
|
||||||
Ctim Timespec
|
Ctim Timespec
|
||||||
Size int64
|
Size int64
|
||||||
Blocks int64
|
Blocks int64
|
||||||
Blksize int32
|
Blksize int32
|
||||||
Flags uint32
|
Flags uint32
|
||||||
Gen uint32
|
Gen uint32
|
||||||
Lspare int32
|
Lspare int32
|
||||||
Birthtim Timespec
|
Btim Timespec
|
||||||
}
|
}
|
||||||
|
|
||||||
type Statfs_t struct {
|
type Statfs_t struct {
|
||||||
|
|
|
@ -64,45 +64,45 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Stat_t struct {
|
type Stat_t struct {
|
||||||
Dev uint64
|
Dev uint64
|
||||||
Ino uint64
|
Ino uint64
|
||||||
Nlink uint64
|
Nlink uint64
|
||||||
Mode uint16
|
Mode uint16
|
||||||
_0 int16
|
_0 int16
|
||||||
Uid uint32
|
Uid uint32
|
||||||
Gid uint32
|
Gid uint32
|
||||||
_1 int32
|
_1 int32
|
||||||
Rdev uint64
|
Rdev uint64
|
||||||
Atim Timespec
|
Atim Timespec
|
||||||
Mtim Timespec
|
Mtim Timespec
|
||||||
Ctim Timespec
|
Ctim Timespec
|
||||||
Birthtim Timespec
|
Btim Timespec
|
||||||
Size int64
|
Size int64
|
||||||
Blocks int64
|
Blocks int64
|
||||||
Blksize int32
|
Blksize int32
|
||||||
Flags uint32
|
Flags uint32
|
||||||
Gen uint64
|
Gen uint64
|
||||||
Spare [10]uint64
|
Spare [10]uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
type stat_freebsd11_t struct {
|
type stat_freebsd11_t struct {
|
||||||
Dev uint32
|
Dev uint32
|
||||||
Ino uint32
|
Ino uint32
|
||||||
Mode uint16
|
Mode uint16
|
||||||
Nlink uint16
|
Nlink uint16
|
||||||
Uid uint32
|
Uid uint32
|
||||||
Gid uint32
|
Gid uint32
|
||||||
Rdev uint32
|
Rdev uint32
|
||||||
Atim Timespec
|
Atim Timespec
|
||||||
Mtim Timespec
|
Mtim Timespec
|
||||||
Ctim Timespec
|
Ctim Timespec
|
||||||
Size int64
|
Size int64
|
||||||
Blocks int64
|
Blocks int64
|
||||||
Blksize int32
|
Blksize int32
|
||||||
Flags uint32
|
Flags uint32
|
||||||
Gen uint32
|
Gen uint32
|
||||||
Lspare int32
|
Lspare int32
|
||||||
Birthtim Timespec
|
Btim Timespec
|
||||||
}
|
}
|
||||||
|
|
||||||
type Statfs_t struct {
|
type Statfs_t struct {
|
||||||
|
|
|
@ -62,45 +62,45 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Stat_t struct {
|
type Stat_t struct {
|
||||||
Dev uint64
|
Dev uint64
|
||||||
Ino uint64
|
Ino uint64
|
||||||
Nlink uint64
|
Nlink uint64
|
||||||
Mode uint16
|
Mode uint16
|
||||||
_0 int16
|
_0 int16
|
||||||
Uid uint32
|
Uid uint32
|
||||||
Gid uint32
|
Gid uint32
|
||||||
_1 int32
|
_1 int32
|
||||||
Rdev uint64
|
Rdev uint64
|
||||||
Atim Timespec
|
Atim Timespec
|
||||||
Mtim Timespec
|
Mtim Timespec
|
||||||
Ctim Timespec
|
Ctim Timespec
|
||||||
Birthtim Timespec
|
Btim Timespec
|
||||||
Size int64
|
Size int64
|
||||||
Blocks int64
|
Blocks int64
|
||||||
Blksize int32
|
Blksize int32
|
||||||
Flags uint32
|
Flags uint32
|
||||||
Gen uint64
|
Gen uint64
|
||||||
Spare [10]uint64
|
Spare [10]uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
type stat_freebsd11_t struct {
|
type stat_freebsd11_t struct {
|
||||||
Dev uint32
|
Dev uint32
|
||||||
Ino uint32
|
Ino uint32
|
||||||
Mode uint16
|
Mode uint16
|
||||||
Nlink uint16
|
Nlink uint16
|
||||||
Uid uint32
|
Uid uint32
|
||||||
Gid uint32
|
Gid uint32
|
||||||
Rdev uint32
|
Rdev uint32
|
||||||
Atim Timespec
|
Atim Timespec
|
||||||
Mtim Timespec
|
Mtim Timespec
|
||||||
Ctim Timespec
|
Ctim Timespec
|
||||||
Size int64
|
Size int64
|
||||||
Blocks int64
|
Blocks int64
|
||||||
Blksize int32
|
Blksize int32
|
||||||
Flags uint32
|
Flags uint32
|
||||||
Gen uint32
|
Gen uint32
|
||||||
Lspare int32
|
Lspare int32
|
||||||
Birthtim Timespec
|
Btim Timespec
|
||||||
}
|
}
|
||||||
|
|
||||||
type Statfs_t struct {
|
type Statfs_t struct {
|
||||||
|
|
|
@ -829,6 +829,8 @@ type Sigset_t struct {
|
||||||
Val [32]uint32
|
Val [32]uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const _C__NSIG = 0x41
|
||||||
|
|
||||||
type SignalfdSiginfo struct {
|
type SignalfdSiginfo struct {
|
||||||
Signo uint32
|
Signo uint32
|
||||||
Errno int32
|
Errno int32
|
||||||
|
|
|
@ -842,6 +842,8 @@ type Sigset_t struct {
|
||||||
Val [16]uint64
|
Val [16]uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const _C__NSIG = 0x41
|
||||||
|
|
||||||
type SignalfdSiginfo struct {
|
type SignalfdSiginfo struct {
|
||||||
Signo uint32
|
Signo uint32
|
||||||
Errno int32
|
Errno int32
|
||||||
|
|
|
@ -818,6 +818,8 @@ type Sigset_t struct {
|
||||||
Val [32]uint32
|
Val [32]uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const _C__NSIG = 0x41
|
||||||
|
|
||||||
type SignalfdSiginfo struct {
|
type SignalfdSiginfo struct {
|
||||||
Signo uint32
|
Signo uint32
|
||||||
Errno int32
|
Errno int32
|
||||||
|
|
|
@ -821,6 +821,8 @@ type Sigset_t struct {
|
||||||
Val [16]uint64
|
Val [16]uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const _C__NSIG = 0x41
|
||||||
|
|
||||||
type SignalfdSiginfo struct {
|
type SignalfdSiginfo struct {
|
||||||
Signo uint32
|
Signo uint32
|
||||||
Errno int32
|
Errno int32
|
||||||
|
|
|
@ -823,6 +823,8 @@ type Sigset_t struct {
|
||||||
Val [32]uint32
|
Val [32]uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const _C__NSIG = 0x80
|
||||||
|
|
||||||
type SignalfdSiginfo struct {
|
type SignalfdSiginfo struct {
|
||||||
Signo uint32
|
Signo uint32
|
||||||
Errno int32
|
Errno int32
|
||||||
|
|
|
@ -823,6 +823,8 @@ type Sigset_t struct {
|
||||||
Val [16]uint64
|
Val [16]uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const _C__NSIG = 0x80
|
||||||
|
|
||||||
type SignalfdSiginfo struct {
|
type SignalfdSiginfo struct {
|
||||||
Signo uint32
|
Signo uint32
|
||||||
Errno int32
|
Errno int32
|
||||||
|
|
|
@ -823,6 +823,8 @@ type Sigset_t struct {
|
||||||
Val [16]uint64
|
Val [16]uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const _C__NSIG = 0x80
|
||||||
|
|
||||||
type SignalfdSiginfo struct {
|
type SignalfdSiginfo struct {
|
||||||
Signo uint32
|
Signo uint32
|
||||||
Errno int32
|
Errno int32
|
||||||
|
|
|
@ -823,6 +823,8 @@ type Sigset_t struct {
|
||||||
Val [32]uint32
|
Val [32]uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const _C__NSIG = 0x80
|
||||||
|
|
||||||
type SignalfdSiginfo struct {
|
type SignalfdSiginfo struct {
|
||||||
Signo uint32
|
Signo uint32
|
||||||
Errno int32
|
Errno int32
|
||||||
|
|
|
@ -831,6 +831,8 @@ type Sigset_t struct {
|
||||||
Val [16]uint64
|
Val [16]uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const _C__NSIG = 0x41
|
||||||
|
|
||||||
type SignalfdSiginfo struct {
|
type SignalfdSiginfo struct {
|
||||||
Signo uint32
|
Signo uint32
|
||||||
Errno int32
|
Errno int32
|
||||||
|
|
|
@ -831,6 +831,8 @@ type Sigset_t struct {
|
||||||
Val [16]uint64
|
Val [16]uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const _C__NSIG = 0x41
|
||||||
|
|
||||||
type SignalfdSiginfo struct {
|
type SignalfdSiginfo struct {
|
||||||
Signo uint32
|
Signo uint32
|
||||||
Errno int32
|
Errno int32
|
||||||
|
|
|
@ -848,6 +848,8 @@ type Sigset_t struct {
|
||||||
Val [16]uint64
|
Val [16]uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const _C__NSIG = 0x41
|
||||||
|
|
||||||
type SignalfdSiginfo struct {
|
type SignalfdSiginfo struct {
|
||||||
Signo uint32
|
Signo uint32
|
||||||
Errno int32
|
Errno int32
|
||||||
|
|
|
@ -844,6 +844,8 @@ type Sigset_t struct {
|
||||||
Val [16]uint64
|
Val [16]uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const _C__NSIG = 0x41
|
||||||
|
|
||||||
type SignalfdSiginfo struct {
|
type SignalfdSiginfo struct {
|
||||||
Signo uint32
|
Signo uint32
|
||||||
Errno int32
|
Errno int32
|
||||||
|
|
|
@ -826,6 +826,8 @@ type Sigset_t struct {
|
||||||
Val [16]uint64
|
Val [16]uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const _C__NSIG = 0x41
|
||||||
|
|
||||||
type SignalfdSiginfo struct {
|
type SignalfdSiginfo struct {
|
||||||
Signo uint32
|
Signo uint32
|
||||||
Errno int32
|
Errno int32
|
||||||
|
|
|
@ -57,23 +57,23 @@ type Rlimit struct {
|
||||||
type _Gid_t uint32
|
type _Gid_t uint32
|
||||||
|
|
||||||
type Stat_t struct {
|
type Stat_t struct {
|
||||||
Dev uint64
|
Dev uint64
|
||||||
Mode uint32
|
Mode uint32
|
||||||
Ino uint64
|
Ino uint64
|
||||||
Nlink uint32
|
Nlink uint32
|
||||||
Uid uint32
|
Uid uint32
|
||||||
Gid uint32
|
Gid uint32
|
||||||
Rdev uint64
|
Rdev uint64
|
||||||
Atimespec Timespec
|
Atim Timespec
|
||||||
Mtimespec Timespec
|
Mtim Timespec
|
||||||
Ctimespec Timespec
|
Ctim Timespec
|
||||||
Birthtimespec Timespec
|
Btim Timespec
|
||||||
Size int64
|
Size int64
|
||||||
Blocks int64
|
Blocks int64
|
||||||
Blksize uint32
|
Blksize uint32
|
||||||
Flags uint32
|
Flags uint32
|
||||||
Gen uint32
|
Gen uint32
|
||||||
Spare [2]uint32
|
Spare [2]uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
type Statfs_t [0]byte
|
type Statfs_t [0]byte
|
||||||
|
|
|
@ -58,26 +58,26 @@ type Rlimit struct {
|
||||||
type _Gid_t uint32
|
type _Gid_t uint32
|
||||||
|
|
||||||
type Stat_t struct {
|
type Stat_t struct {
|
||||||
Dev uint64
|
Dev uint64
|
||||||
Mode uint32
|
Mode uint32
|
||||||
Pad_cgo_0 [4]byte
|
_ [4]byte
|
||||||
Ino uint64
|
Ino uint64
|
||||||
Nlink uint32
|
Nlink uint32
|
||||||
Uid uint32
|
Uid uint32
|
||||||
Gid uint32
|
Gid uint32
|
||||||
Pad_cgo_1 [4]byte
|
_ [4]byte
|
||||||
Rdev uint64
|
Rdev uint64
|
||||||
Atimespec Timespec
|
Atim Timespec
|
||||||
Mtimespec Timespec
|
Mtim Timespec
|
||||||
Ctimespec Timespec
|
Ctim Timespec
|
||||||
Birthtimespec Timespec
|
Btim Timespec
|
||||||
Size int64
|
Size int64
|
||||||
Blocks int64
|
Blocks int64
|
||||||
Blksize uint32
|
Blksize uint32
|
||||||
Flags uint32
|
Flags uint32
|
||||||
Gen uint32
|
Gen uint32
|
||||||
Spare [2]uint32
|
Spare [2]uint32
|
||||||
Pad_cgo_2 [4]byte
|
_ [4]byte
|
||||||
}
|
}
|
||||||
|
|
||||||
type Statfs_t [0]byte
|
type Statfs_t [0]byte
|
||||||
|
|
|
@ -59,26 +59,26 @@ type Rlimit struct {
|
||||||
type _Gid_t uint32
|
type _Gid_t uint32
|
||||||
|
|
||||||
type Stat_t struct {
|
type Stat_t struct {
|
||||||
Dev uint64
|
Dev uint64
|
||||||
Mode uint32
|
Mode uint32
|
||||||
Pad_cgo_0 [4]byte
|
_ [4]byte
|
||||||
Ino uint64
|
Ino uint64
|
||||||
Nlink uint32
|
Nlink uint32
|
||||||
Uid uint32
|
Uid uint32
|
||||||
Gid uint32
|
Gid uint32
|
||||||
Pad_cgo_1 [4]byte
|
_ [4]byte
|
||||||
Rdev uint64
|
Rdev uint64
|
||||||
Atimespec Timespec
|
Atim Timespec
|
||||||
Mtimespec Timespec
|
Mtim Timespec
|
||||||
Ctimespec Timespec
|
Ctim Timespec
|
||||||
Birthtimespec Timespec
|
Btim Timespec
|
||||||
Size int64
|
Size int64
|
||||||
Blocks int64
|
Blocks int64
|
||||||
Blksize uint32
|
Blksize uint32
|
||||||
Flags uint32
|
Flags uint32
|
||||||
Gen uint32
|
Gen uint32
|
||||||
Spare [2]uint32
|
Spare [2]uint32
|
||||||
Pad_cgo_2 [4]byte
|
_ [4]byte
|
||||||
}
|
}
|
||||||
|
|
||||||
type Statfs_t [0]byte
|
type Statfs_t [0]byte
|
||||||
|
|
|
@ -58,26 +58,26 @@ type Rlimit struct {
|
||||||
type _Gid_t uint32
|
type _Gid_t uint32
|
||||||
|
|
||||||
type Stat_t struct {
|
type Stat_t struct {
|
||||||
Dev uint64
|
Dev uint64
|
||||||
Mode uint32
|
Mode uint32
|
||||||
Pad_cgo_0 [4]byte
|
_ [4]byte
|
||||||
Ino uint64
|
Ino uint64
|
||||||
Nlink uint32
|
Nlink uint32
|
||||||
Uid uint32
|
Uid uint32
|
||||||
Gid uint32
|
Gid uint32
|
||||||
Pad_cgo_1 [4]byte
|
_ [4]byte
|
||||||
Rdev uint64
|
Rdev uint64
|
||||||
Atimespec Timespec
|
Atim Timespec
|
||||||
Mtimespec Timespec
|
Mtim Timespec
|
||||||
Ctimespec Timespec
|
Ctim Timespec
|
||||||
Birthtimespec Timespec
|
Btim Timespec
|
||||||
Size int64
|
Size int64
|
||||||
Blocks int64
|
Blocks int64
|
||||||
Blksize uint32
|
Blksize uint32
|
||||||
Flags uint32
|
Flags uint32
|
||||||
Gen uint32
|
Gen uint32
|
||||||
Spare [2]uint32
|
Spare [2]uint32
|
||||||
Pad_cgo_2 [4]byte
|
_ [4]byte
|
||||||
}
|
}
|
||||||
|
|
||||||
type Statfs_t [0]byte
|
type Statfs_t [0]byte
|
||||||
|
|
|
@ -6,7 +6,11 @@
|
||||||
|
|
||||||
package windows
|
package windows
|
||||||
|
|
||||||
import "syscall"
|
import (
|
||||||
|
"syscall"
|
||||||
|
"unicode/utf16"
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
func Getenv(key string) (value string, found bool) {
|
func Getenv(key string) (value string, found bool) {
|
||||||
return syscall.Getenv(key)
|
return syscall.Getenv(key)
|
||||||
|
@ -24,6 +28,34 @@ func Environ() []string {
|
||||||
return syscall.Environ()
|
return syscall.Environ()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns a default environment associated with the token, rather than the current
|
||||||
|
// process. If inheritExisting is true, then this environment also inherits the
|
||||||
|
// environment of the current process.
|
||||||
|
func (token Token) Environ(inheritExisting bool) (env []string, err error) {
|
||||||
|
var block *uint16
|
||||||
|
err = CreateEnvironmentBlock(&block, token, inheritExisting)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer DestroyEnvironmentBlock(block)
|
||||||
|
blockp := uintptr(unsafe.Pointer(block))
|
||||||
|
for {
|
||||||
|
entry := (*[(1 << 30) - 1]uint16)(unsafe.Pointer(blockp))[:]
|
||||||
|
for i, v := range entry {
|
||||||
|
if v == 0 {
|
||||||
|
entry = entry[:i]
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(entry) == 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
env = append(env, string(utf16.Decode(entry)))
|
||||||
|
blockp += 2 * (uintptr(len(entry)) + 1)
|
||||||
|
}
|
||||||
|
return env, nil
|
||||||
|
}
|
||||||
|
|
||||||
func Unsetenv(key string) error {
|
func Unsetenv(key string) error {
|
||||||
return syscall.Unsetenv(key)
|
return syscall.Unsetenv(key)
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
set -e
|
set -e
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
[[ $# -eq 1 ]] || { echo "Usage: $0 OUTPUT_FILE.go" >&2; exit 1; }
|
|
||||||
winerror="$(printf '%s\n' "/mnt/c/Program Files (x86)/Windows Kits/"/*/Include/*/shared/winerror.h | sort -Vr | head -n 1)"
|
winerror="$(printf '%s\n' "/mnt/c/Program Files (x86)/Windows Kits/"/*/Include/*/shared/winerror.h | sort -Vr | head -n 1)"
|
||||||
[[ -n $winerror ]] || { echo "Unable to find winerror.h" >&2; exit 1; }
|
[[ -n $winerror ]] || { echo "Unable to find winerror.h" >&2; exit 1; }
|
||||||
|
|
||||||
|
@ -61,4 +60,4 @@ declare -A errors
|
||||||
done < "$winerror"
|
done < "$winerror"
|
||||||
|
|
||||||
echo ")"
|
echo ")"
|
||||||
} | gofmt > "$1"
|
} | gofmt > "zerrors_windows.go"
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
// Copyright 2019 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build generate
|
|
||||||
|
|
||||||
package windows
|
|
||||||
|
|
||||||
//go:generate ./mkerrors.bash zerrors_windows.go
|
|
|
@ -68,7 +68,7 @@ func (k Key) GetValue(name string, buf []byte) (n int, valtype uint32, err error
|
||||||
return int(l), valtype, nil
|
return int(l), valtype, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (k Key) getValue(name string, buf []byte) (date []byte, valtype uint32, err error) {
|
func (k Key) getValue(name string, buf []byte) (data []byte, valtype uint32, err error) {
|
||||||
p, err := syscall.UTF16PtrFromString(name)
|
p, err := syscall.UTF16PtrFromString(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, err
|
return nil, 0, err
|
||||||
|
@ -241,12 +241,15 @@ func (k Key) GetIntegerValue(name string) (val uint64, valtype uint32, err error
|
||||||
if len(data) != 4 {
|
if len(data) != 4 {
|
||||||
return 0, typ, errors.New("DWORD value is not 4 bytes long")
|
return 0, typ, errors.New("DWORD value is not 4 bytes long")
|
||||||
}
|
}
|
||||||
return uint64(*(*uint32)(unsafe.Pointer(&data[0]))), DWORD, nil
|
var val32 uint32
|
||||||
|
copy((*[4]byte)(unsafe.Pointer(&val32))[:], data)
|
||||||
|
return uint64(val32), DWORD, nil
|
||||||
case QWORD:
|
case QWORD:
|
||||||
if len(data) != 8 {
|
if len(data) != 8 {
|
||||||
return 0, typ, errors.New("QWORD value is not 8 bytes long")
|
return 0, typ, errors.New("QWORD value is not 8 bytes long")
|
||||||
}
|
}
|
||||||
return uint64(*(*uint64)(unsafe.Pointer(&data[0]))), QWORD, nil
|
copy((*[8]byte)(unsafe.Pointer(&val))[:], data)
|
||||||
|
return val, QWORD, nil
|
||||||
default:
|
default:
|
||||||
return 0, typ, ErrUnexpectedType
|
return 0, typ, ErrUnexpectedType
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,15 +170,20 @@ const (
|
||||||
//sys CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error) = advapi32.CopySid
|
//sys CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error) = advapi32.CopySid
|
||||||
//sys AllocateAndInitializeSid(identAuth *SidIdentifierAuthority, subAuth byte, subAuth0 uint32, subAuth1 uint32, subAuth2 uint32, subAuth3 uint32, subAuth4 uint32, subAuth5 uint32, subAuth6 uint32, subAuth7 uint32, sid **SID) (err error) = advapi32.AllocateAndInitializeSid
|
//sys AllocateAndInitializeSid(identAuth *SidIdentifierAuthority, subAuth byte, subAuth0 uint32, subAuth1 uint32, subAuth2 uint32, subAuth3 uint32, subAuth4 uint32, subAuth5 uint32, subAuth6 uint32, subAuth7 uint32, sid **SID) (err error) = advapi32.AllocateAndInitializeSid
|
||||||
//sys createWellKnownSid(sidType WELL_KNOWN_SID_TYPE, domainSid *SID, sid *SID, sizeSid *uint32) (err error) = advapi32.CreateWellKnownSid
|
//sys createWellKnownSid(sidType WELL_KNOWN_SID_TYPE, domainSid *SID, sid *SID, sizeSid *uint32) (err error) = advapi32.CreateWellKnownSid
|
||||||
|
//sys isWellKnownSid(sid *SID, sidType WELL_KNOWN_SID_TYPE) (isWellKnown bool) = advapi32.IsWellKnownSid
|
||||||
//sys FreeSid(sid *SID) (err error) [failretval!=0] = advapi32.FreeSid
|
//sys FreeSid(sid *SID) (err error) [failretval!=0] = advapi32.FreeSid
|
||||||
//sys EqualSid(sid1 *SID, sid2 *SID) (isEqual bool) = advapi32.EqualSid
|
//sys EqualSid(sid1 *SID, sid2 *SID) (isEqual bool) = advapi32.EqualSid
|
||||||
|
//sys getSidIdentifierAuthority(sid *SID) (authority *SidIdentifierAuthority) = advapi32.GetSidIdentifierAuthority
|
||||||
|
//sys getSidSubAuthorityCount(sid *SID) (count *uint8) = advapi32.GetSidSubAuthorityCount
|
||||||
|
//sys getSidSubAuthority(sid *SID, index uint32) (subAuthority *uint32) = advapi32.GetSidSubAuthority
|
||||||
|
//sys isValidSid(sid *SID) (isValid bool) = advapi32.IsValidSid
|
||||||
|
|
||||||
// The security identifier (SID) structure is a variable-length
|
// The security identifier (SID) structure is a variable-length
|
||||||
// structure used to uniquely identify users or groups.
|
// structure used to uniquely identify users or groups.
|
||||||
type SID struct{}
|
type SID struct{}
|
||||||
|
|
||||||
// StringToSid converts a string-format security identifier
|
// StringToSid converts a string-format security identifier
|
||||||
// sid into a valid, functional sid.
|
// SID into a valid, functional SID.
|
||||||
func StringToSid(s string) (*SID, error) {
|
func StringToSid(s string) (*SID, error) {
|
||||||
var sid *SID
|
var sid *SID
|
||||||
p, e := UTF16PtrFromString(s)
|
p, e := UTF16PtrFromString(s)
|
||||||
|
@ -193,7 +198,7 @@ func StringToSid(s string) (*SID, error) {
|
||||||
return sid.Copy()
|
return sid.Copy()
|
||||||
}
|
}
|
||||||
|
|
||||||
// LookupSID retrieves a security identifier sid for the account
|
// LookupSID retrieves a security identifier SID for the account
|
||||||
// and the name of the domain on which the account was found.
|
// and the name of the domain on which the account was found.
|
||||||
// System specify target computer to search.
|
// System specify target computer to search.
|
||||||
func LookupSID(system, account string) (sid *SID, domain string, accType uint32, err error) {
|
func LookupSID(system, account string) (sid *SID, domain string, accType uint32, err error) {
|
||||||
|
@ -230,7 +235,7 @@ func LookupSID(system, account string) (sid *SID, domain string, accType uint32,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// String converts sid to a string format
|
// String converts SID to a string format
|
||||||
// suitable for display, storage, or transmission.
|
// suitable for display, storage, or transmission.
|
||||||
func (sid *SID) String() (string, error) {
|
func (sid *SID) String() (string, error) {
|
||||||
var s *uint16
|
var s *uint16
|
||||||
|
@ -242,12 +247,12 @@ func (sid *SID) String() (string, error) {
|
||||||
return UTF16ToString((*[256]uint16)(unsafe.Pointer(s))[:]), nil
|
return UTF16ToString((*[256]uint16)(unsafe.Pointer(s))[:]), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Len returns the length, in bytes, of a valid security identifier sid.
|
// Len returns the length, in bytes, of a valid security identifier SID.
|
||||||
func (sid *SID) Len() int {
|
func (sid *SID) Len() int {
|
||||||
return int(GetLengthSid(sid))
|
return int(GetLengthSid(sid))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy creates a duplicate of security identifier sid.
|
// Copy creates a duplicate of security identifier SID.
|
||||||
func (sid *SID) Copy() (*SID, error) {
|
func (sid *SID) Copy() (*SID, error) {
|
||||||
b := make([]byte, sid.Len())
|
b := make([]byte, sid.Len())
|
||||||
sid2 := (*SID)(unsafe.Pointer(&b[0]))
|
sid2 := (*SID)(unsafe.Pointer(&b[0]))
|
||||||
|
@ -258,8 +263,42 @@ func (sid *SID) Copy() (*SID, error) {
|
||||||
return sid2, nil
|
return sid2, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// LookupAccount retrieves the name of the account for this sid
|
// IdentifierAuthority returns the identifier authority of the SID.
|
||||||
// and the name of the first domain on which this sid is found.
|
func (sid *SID) IdentifierAuthority() SidIdentifierAuthority {
|
||||||
|
return *getSidIdentifierAuthority(sid)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SubAuthorityCount returns the number of sub-authorities in the SID.
|
||||||
|
func (sid *SID) SubAuthorityCount() uint8 {
|
||||||
|
return *getSidSubAuthorityCount(sid)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SubAuthority returns the sub-authority of the SID as specified by
|
||||||
|
// the index, which must be less than sid.SubAuthorityCount().
|
||||||
|
func (sid *SID) SubAuthority(idx uint32) uint32 {
|
||||||
|
if idx >= uint32(sid.SubAuthorityCount()) {
|
||||||
|
panic("sub-authority index out of range")
|
||||||
|
}
|
||||||
|
return *getSidSubAuthority(sid, idx)
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsValid returns whether the SID has a valid revision and length.
|
||||||
|
func (sid *SID) IsValid() bool {
|
||||||
|
return isValidSid(sid)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Equals compares two SIDs for equality.
|
||||||
|
func (sid *SID) Equals(sid2 *SID) bool {
|
||||||
|
return EqualSid(sid, sid2)
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsWellKnown determines whether the SID matches the well-known sidType.
|
||||||
|
func (sid *SID) IsWellKnown(sidType WELL_KNOWN_SID_TYPE) bool {
|
||||||
|
return isWellKnownSid(sid, sidType)
|
||||||
|
}
|
||||||
|
|
||||||
|
// LookupAccount retrieves the name of the account for this SID
|
||||||
|
// and the name of the first domain on which this SID is found.
|
||||||
// System specify target computer to search for.
|
// System specify target computer to search for.
|
||||||
func (sid *SID) LookupAccount(system string) (account, domain string, accType uint32, err error) {
|
func (sid *SID) LookupAccount(system string) (account, domain string, accType uint32, err error) {
|
||||||
var sys *uint16
|
var sys *uint16
|
||||||
|
@ -287,7 +326,7 @@ func (sid *SID) LookupAccount(system string) (account, domain string, accType ui
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Various types of pre-specified sids that can be synthesized at runtime.
|
// Various types of pre-specified SIDs that can be synthesized and compared at runtime.
|
||||||
type WELL_KNOWN_SID_TYPE uint32
|
type WELL_KNOWN_SID_TYPE uint32
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -413,13 +452,13 @@ const (
|
||||||
WinBuiltinDeviceOwnersSid = 119
|
WinBuiltinDeviceOwnersSid = 119
|
||||||
)
|
)
|
||||||
|
|
||||||
// Creates a sid for a well-known predefined alias, generally using the constants of the form
|
// Creates a SID for a well-known predefined alias, generally using the constants of the form
|
||||||
// Win*Sid, for the local machine.
|
// Win*Sid, for the local machine.
|
||||||
func CreateWellKnownSid(sidType WELL_KNOWN_SID_TYPE) (*SID, error) {
|
func CreateWellKnownSid(sidType WELL_KNOWN_SID_TYPE) (*SID, error) {
|
||||||
return CreateWellKnownDomainSid(sidType, nil)
|
return CreateWellKnownDomainSid(sidType, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates a sid for a well-known predefined alias, generally using the constants of the form
|
// Creates a SID for a well-known predefined alias, generally using the constants of the form
|
||||||
// Win*Sid, for the domain specified by the domainSid parameter.
|
// Win*Sid, for the domain specified by the domainSid parameter.
|
||||||
func CreateWellKnownDomainSid(sidType WELL_KNOWN_SID_TYPE, domainSid *SID) (*SID, error) {
|
func CreateWellKnownDomainSid(sidType WELL_KNOWN_SID_TYPE, domainSid *SID) (*SID, error) {
|
||||||
n := uint32(50)
|
n := uint32(50)
|
||||||
|
@ -502,6 +541,53 @@ const (
|
||||||
MaxTokenInfoClass
|
MaxTokenInfoClass
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Group attributes inside of Tokengroups.Groups[i].Attributes
|
||||||
|
const (
|
||||||
|
SE_GROUP_MANDATORY = 0x00000001
|
||||||
|
SE_GROUP_ENABLED_BY_DEFAULT = 0x00000002
|
||||||
|
SE_GROUP_ENABLED = 0x00000004
|
||||||
|
SE_GROUP_OWNER = 0x00000008
|
||||||
|
SE_GROUP_USE_FOR_DENY_ONLY = 0x00000010
|
||||||
|
SE_GROUP_INTEGRITY = 0x00000020
|
||||||
|
SE_GROUP_INTEGRITY_ENABLED = 0x00000040
|
||||||
|
SE_GROUP_LOGON_ID = 0xC0000000
|
||||||
|
SE_GROUP_RESOURCE = 0x20000000
|
||||||
|
SE_GROUP_VALID_ATTRIBUTES = SE_GROUP_MANDATORY | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_ENABLED | SE_GROUP_OWNER | SE_GROUP_USE_FOR_DENY_ONLY | SE_GROUP_LOGON_ID | SE_GROUP_RESOURCE | SE_GROUP_INTEGRITY | SE_GROUP_INTEGRITY_ENABLED
|
||||||
|
)
|
||||||
|
|
||||||
|
// Privilege attributes
|
||||||
|
const (
|
||||||
|
SE_PRIVILEGE_ENABLED_BY_DEFAULT = 0x00000001
|
||||||
|
SE_PRIVILEGE_ENABLED = 0x00000002
|
||||||
|
SE_PRIVILEGE_REMOVED = 0x00000004
|
||||||
|
SE_PRIVILEGE_USED_FOR_ACCESS = 0x80000000
|
||||||
|
SE_PRIVILEGE_VALID_ATTRIBUTES = SE_PRIVILEGE_ENABLED_BY_DEFAULT | SE_PRIVILEGE_ENABLED | SE_PRIVILEGE_REMOVED | SE_PRIVILEGE_USED_FOR_ACCESS
|
||||||
|
)
|
||||||
|
|
||||||
|
// Token types
|
||||||
|
const (
|
||||||
|
TokenPrimary = 1
|
||||||
|
TokenImpersonation = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
// Impersonation levels
|
||||||
|
const (
|
||||||
|
SecurityAnonymous = 0
|
||||||
|
SecurityIdentification = 1
|
||||||
|
SecurityImpersonation = 2
|
||||||
|
SecurityDelegation = 3
|
||||||
|
)
|
||||||
|
|
||||||
|
type LUID struct {
|
||||||
|
LowPart uint32
|
||||||
|
HighPart int32
|
||||||
|
}
|
||||||
|
|
||||||
|
type LUIDAndAttributes struct {
|
||||||
|
Luid LUID
|
||||||
|
Attributes uint32
|
||||||
|
}
|
||||||
|
|
||||||
type SIDAndAttributes struct {
|
type SIDAndAttributes struct {
|
||||||
Sid *SID
|
Sid *SID
|
||||||
Attributes uint32
|
Attributes uint32
|
||||||
|
@ -517,13 +603,45 @@ type Tokenprimarygroup struct {
|
||||||
|
|
||||||
type Tokengroups struct {
|
type Tokengroups struct {
|
||||||
GroupCount uint32
|
GroupCount uint32
|
||||||
Groups [1]SIDAndAttributes
|
Groups [1]SIDAndAttributes // Use AllGroups() for iterating.
|
||||||
|
}
|
||||||
|
|
||||||
|
// AllGroups returns a slice that can be used to iterate over the groups in g.
|
||||||
|
func (g *Tokengroups) AllGroups() []SIDAndAttributes {
|
||||||
|
return (*[(1 << 28) - 1]SIDAndAttributes)(unsafe.Pointer(&g.Groups[0]))[:g.GroupCount:g.GroupCount]
|
||||||
|
}
|
||||||
|
|
||||||
|
type Tokenprivileges struct {
|
||||||
|
PrivilegeCount uint32
|
||||||
|
Privileges [1]LUIDAndAttributes // Use AllPrivileges() for iterating.
|
||||||
|
}
|
||||||
|
|
||||||
|
// AllPrivileges returns a slice that can be used to iterate over the privileges in p.
|
||||||
|
func (p *Tokenprivileges) AllPrivileges() []LUIDAndAttributes {
|
||||||
|
return (*[(1 << 27) - 1]LUIDAndAttributes)(unsafe.Pointer(&p.Privileges[0]))[:p.PrivilegeCount:p.PrivilegeCount]
|
||||||
|
}
|
||||||
|
|
||||||
|
type Tokenmandatorylabel struct {
|
||||||
|
Label SIDAndAttributes
|
||||||
|
}
|
||||||
|
|
||||||
|
func (tml *Tokenmandatorylabel) Size() uint32 {
|
||||||
|
return uint32(unsafe.Sizeof(Tokenmandatorylabel{})) + GetLengthSid(tml.Label.Sid)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Authorization Functions
|
// Authorization Functions
|
||||||
//sys checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) (err error) = advapi32.CheckTokenMembership
|
//sys checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) (err error) = advapi32.CheckTokenMembership
|
||||||
//sys OpenProcessToken(h Handle, access uint32, token *Token) (err error) = advapi32.OpenProcessToken
|
//sys OpenProcessToken(process Handle, access uint32, token *Token) (err error) = advapi32.OpenProcessToken
|
||||||
//sys GetTokenInformation(t Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) = advapi32.GetTokenInformation
|
//sys OpenThreadToken(thread Handle, access uint32, openAsSelf bool, token *Token) (err error) = advapi32.OpenThreadToken
|
||||||
|
//sys ImpersonateSelf(impersonationlevel uint32) (err error) = advapi32.ImpersonateSelf
|
||||||
|
//sys RevertToSelf() (err error) = advapi32.RevertToSelf
|
||||||
|
//sys SetThreadToken(thread *Handle, token Token) (err error) = advapi32.SetThreadToken
|
||||||
|
//sys LookupPrivilegeValue(systemname *uint16, name *uint16, luid *LUID) (err error) = advapi32.LookupPrivilegeValueW
|
||||||
|
//sys AdjustTokenPrivileges(token Token, disableAllPrivileges bool, newstate *Tokenprivileges, buflen uint32, prevstate *Tokenprivileges, returnlen *uint32) (err error) = advapi32.AdjustTokenPrivileges
|
||||||
|
//sys AdjustTokenGroups(token Token, resetToDefault bool, newstate *Tokengroups, buflen uint32, prevstate *Tokengroups, returnlen *uint32) (err error) = advapi32.AdjustTokenGroups
|
||||||
|
//sys GetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) = advapi32.GetTokenInformation
|
||||||
|
//sys SetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32) (err error) = advapi32.SetTokenInformation
|
||||||
|
//sys DuplicateTokenEx(existingToken Token, desiredAccess uint32, tokenAttributes *SecurityAttributes, impersonationLevel uint32, tokenType uint32, newToken *Token) (err error) = advapi32.DuplicateTokenEx
|
||||||
//sys GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) = userenv.GetUserProfileDirectoryW
|
//sys GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) = userenv.GetUserProfileDirectoryW
|
||||||
//sys getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) = kernel32.GetSystemDirectoryW
|
//sys getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) = kernel32.GetSystemDirectoryW
|
||||||
|
|
||||||
|
@ -537,7 +655,9 @@ type Tokengroups struct {
|
||||||
type Token Handle
|
type Token Handle
|
||||||
|
|
||||||
// OpenCurrentProcessToken opens the access token
|
// OpenCurrentProcessToken opens the access token
|
||||||
// associated with current process.
|
// associated with current process. It is a real
|
||||||
|
// token that needs to be closed, unlike
|
||||||
|
// GetCurrentProcessToken.
|
||||||
func OpenCurrentProcessToken() (Token, error) {
|
func OpenCurrentProcessToken() (Token, error) {
|
||||||
p, e := GetCurrentProcess()
|
p, e := GetCurrentProcess()
|
||||||
if e != nil {
|
if e != nil {
|
||||||
|
@ -551,6 +671,27 @@ func OpenCurrentProcessToken() (Token, error) {
|
||||||
return t, nil
|
return t, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetCurrentProcessToken returns the access token associated with
|
||||||
|
// the current process. It is a pseudo token that does not need
|
||||||
|
// to be closed.
|
||||||
|
func GetCurrentProcessToken() Token {
|
||||||
|
return Token(^uintptr(4 - 1))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCurrentThreadToken return the access token associated with
|
||||||
|
// the current thread. It is a pseudo token that does not need
|
||||||
|
// to be closed.
|
||||||
|
func GetCurrentThreadToken() Token {
|
||||||
|
return Token(^uintptr(5 - 1))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCurrentThreadEffectiveToken returns the effective access token
|
||||||
|
// associated with the current thread. It is a pseudo token that does
|
||||||
|
// not need to be closed.
|
||||||
|
func GetCurrentThreadEffectiveToken() Token {
|
||||||
|
return Token(^uintptr(6 - 1))
|
||||||
|
}
|
||||||
|
|
||||||
// Close releases access to access token.
|
// Close releases access to access token.
|
||||||
func (t Token) Close() error {
|
func (t Token) Close() error {
|
||||||
return CloseHandle(Handle(t))
|
return CloseHandle(Handle(t))
|
||||||
|
@ -622,6 +763,28 @@ func (t Token) GetUserProfileDirectory() (string, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsElevated returns whether the current token is elevated from a UAC perspective.
|
||||||
|
func (token Token) IsElevated() bool {
|
||||||
|
var isElevated uint32
|
||||||
|
var outLen uint32
|
||||||
|
err := GetTokenInformation(token, TokenElevation, (*byte)(unsafe.Pointer(&isElevated)), uint32(unsafe.Sizeof(isElevated)), &outLen)
|
||||||
|
if err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return outLen == uint32(unsafe.Sizeof(isElevated)) && isElevated != 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetLinkedToken returns the linked token, which may be an elevated UAC token.
|
||||||
|
func (token Token) GetLinkedToken() (Token, error) {
|
||||||
|
var linkedToken Token
|
||||||
|
var outLen uint32
|
||||||
|
err := GetTokenInformation(token, TokenLinkedToken, (*byte)(unsafe.Pointer(&linkedToken)), uint32(unsafe.Sizeof(linkedToken)), &outLen)
|
||||||
|
if err != nil {
|
||||||
|
return Token(0), err
|
||||||
|
}
|
||||||
|
return linkedToken, nil
|
||||||
|
}
|
||||||
|
|
||||||
// GetSystemDirectory retrieves path to current location of the system
|
// GetSystemDirectory retrieves path to current location of the system
|
||||||
// directory, which is typically, though not always, C:\Windows\System32.
|
// directory, which is typically, though not always, C:\Windows\System32.
|
||||||
func GetSystemDirectory() (string, error) {
|
func GetSystemDirectory() (string, error) {
|
||||||
|
@ -647,3 +810,45 @@ func (t Token) IsMember(sid *SID) (bool, error) {
|
||||||
}
|
}
|
||||||
return b != 0, nil
|
return b != 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
WTS_CONSOLE_CONNECT = 0x1
|
||||||
|
WTS_CONSOLE_DISCONNECT = 0x2
|
||||||
|
WTS_REMOTE_CONNECT = 0x3
|
||||||
|
WTS_REMOTE_DISCONNECT = 0x4
|
||||||
|
WTS_SESSION_LOGON = 0x5
|
||||||
|
WTS_SESSION_LOGOFF = 0x6
|
||||||
|
WTS_SESSION_LOCK = 0x7
|
||||||
|
WTS_SESSION_UNLOCK = 0x8
|
||||||
|
WTS_SESSION_REMOTE_CONTROL = 0x9
|
||||||
|
WTS_SESSION_CREATE = 0xa
|
||||||
|
WTS_SESSION_TERMINATE = 0xb
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
WTSActive = 0
|
||||||
|
WTSConnected = 1
|
||||||
|
WTSConnectQuery = 2
|
||||||
|
WTSShadow = 3
|
||||||
|
WTSDisconnected = 4
|
||||||
|
WTSIdle = 5
|
||||||
|
WTSListen = 6
|
||||||
|
WTSReset = 7
|
||||||
|
WTSDown = 8
|
||||||
|
WTSInit = 9
|
||||||
|
)
|
||||||
|
|
||||||
|
type WTSSESSION_NOTIFICATION struct {
|
||||||
|
Size uint32
|
||||||
|
SessionID uint32
|
||||||
|
}
|
||||||
|
|
||||||
|
type WTS_SESSION_INFO struct {
|
||||||
|
SessionID uint32
|
||||||
|
WindowStationName *uint16
|
||||||
|
State uint32
|
||||||
|
}
|
||||||
|
|
||||||
|
//sys WTSQueryUserToken(session uint32, token *Token) (err error) = wtsapi32.WTSQueryUserToken
|
||||||
|
//sys WTSEnumerateSessions(handle Handle, reserved uint32, version uint32, sessions **WTS_SESSION_INFO, count *uint32) (err error) = wtsapi32.WTSEnumerateSessionsW
|
||||||
|
//sys WTSFreeMemory(ptr uintptr) = wtsapi32.WTSFreeMemory
|
||||||
|
|
|
@ -85,21 +85,47 @@ const (
|
||||||
SERVICE_INACTIVE = 2
|
SERVICE_INACTIVE = 2
|
||||||
SERVICE_STATE_ALL = 3
|
SERVICE_STATE_ALL = 3
|
||||||
|
|
||||||
SERVICE_QUERY_CONFIG = 1
|
SERVICE_QUERY_CONFIG = 1
|
||||||
SERVICE_CHANGE_CONFIG = 2
|
SERVICE_CHANGE_CONFIG = 2
|
||||||
SERVICE_QUERY_STATUS = 4
|
SERVICE_QUERY_STATUS = 4
|
||||||
SERVICE_ENUMERATE_DEPENDENTS = 8
|
SERVICE_ENUMERATE_DEPENDENTS = 8
|
||||||
SERVICE_START = 16
|
SERVICE_START = 16
|
||||||
SERVICE_STOP = 32
|
SERVICE_STOP = 32
|
||||||
SERVICE_PAUSE_CONTINUE = 64
|
SERVICE_PAUSE_CONTINUE = 64
|
||||||
SERVICE_INTERROGATE = 128
|
SERVICE_INTERROGATE = 128
|
||||||
SERVICE_USER_DEFINED_CONTROL = 256
|
SERVICE_USER_DEFINED_CONTROL = 256
|
||||||
SERVICE_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SERVICE_QUERY_CONFIG | SERVICE_CHANGE_CONFIG | SERVICE_QUERY_STATUS | SERVICE_ENUMERATE_DEPENDENTS | SERVICE_START | SERVICE_STOP | SERVICE_PAUSE_CONTINUE | SERVICE_INTERROGATE | SERVICE_USER_DEFINED_CONTROL
|
SERVICE_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SERVICE_QUERY_CONFIG | SERVICE_CHANGE_CONFIG | SERVICE_QUERY_STATUS | SERVICE_ENUMERATE_DEPENDENTS | SERVICE_START | SERVICE_STOP | SERVICE_PAUSE_CONTINUE | SERVICE_INTERROGATE | SERVICE_USER_DEFINED_CONTROL
|
||||||
|
|
||||||
SERVICE_RUNS_IN_SYSTEM_PROCESS = 1
|
SERVICE_RUNS_IN_SYSTEM_PROCESS = 1
|
||||||
SERVICE_CONFIG_DESCRIPTION = 1
|
|
||||||
SERVICE_CONFIG_FAILURE_ACTIONS = 2
|
SERVICE_CONFIG_DESCRIPTION = 1
|
||||||
|
SERVICE_CONFIG_FAILURE_ACTIONS = 2
|
||||||
|
SERVICE_CONFIG_DELAYED_AUTO_START_INFO = 3
|
||||||
|
SERVICE_CONFIG_FAILURE_ACTIONS_FLAG = 4
|
||||||
|
SERVICE_CONFIG_SERVICE_SID_INFO = 5
|
||||||
|
SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO = 6
|
||||||
|
SERVICE_CONFIG_PRESHUTDOWN_INFO = 7
|
||||||
|
SERVICE_CONFIG_TRIGGER_INFO = 8
|
||||||
|
SERVICE_CONFIG_PREFERRED_NODE = 9
|
||||||
|
SERVICE_CONFIG_LAUNCH_PROTECTED = 12
|
||||||
|
|
||||||
|
SERVICE_SID_TYPE_NONE = 0
|
||||||
|
SERVICE_SID_TYPE_UNRESTRICTED = 1
|
||||||
|
SERVICE_SID_TYPE_RESTRICTED = 2 | SERVICE_SID_TYPE_UNRESTRICTED
|
||||||
|
|
||||||
SC_ENUM_PROCESS_INFO = 0
|
SC_ENUM_PROCESS_INFO = 0
|
||||||
|
|
||||||
|
SERVICE_NOTIFY_STATUS_CHANGE = 2
|
||||||
|
SERVICE_NOTIFY_STOPPED = 0x00000001
|
||||||
|
SERVICE_NOTIFY_START_PENDING = 0x00000002
|
||||||
|
SERVICE_NOTIFY_STOP_PENDING = 0x00000004
|
||||||
|
SERVICE_NOTIFY_RUNNING = 0x00000008
|
||||||
|
SERVICE_NOTIFY_CONTINUE_PENDING = 0x00000010
|
||||||
|
SERVICE_NOTIFY_PAUSE_PENDING = 0x00000020
|
||||||
|
SERVICE_NOTIFY_PAUSED = 0x00000040
|
||||||
|
SERVICE_NOTIFY_CREATED = 0x00000080
|
||||||
|
SERVICE_NOTIFY_DELETED = 0x00000100
|
||||||
|
SERVICE_NOTIFY_DELETE_PENDING = 0x00000200
|
||||||
)
|
)
|
||||||
|
|
||||||
type SERVICE_STATUS struct {
|
type SERVICE_STATUS struct {
|
||||||
|
@ -151,6 +177,16 @@ type ENUM_SERVICE_STATUS_PROCESS struct {
|
||||||
ServiceStatusProcess SERVICE_STATUS_PROCESS
|
ServiceStatusProcess SERVICE_STATUS_PROCESS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SERVICE_NOTIFY struct {
|
||||||
|
Version uint32
|
||||||
|
NotifyCallback uintptr
|
||||||
|
Context uintptr
|
||||||
|
NotificationStatus uint32
|
||||||
|
ServiceStatus SERVICE_STATUS_PROCESS
|
||||||
|
NotificationTriggered uint32
|
||||||
|
ServiceNames *uint16
|
||||||
|
}
|
||||||
|
|
||||||
type SERVICE_FAILURE_ACTIONS struct {
|
type SERVICE_FAILURE_ACTIONS struct {
|
||||||
ResetPeriod uint32
|
ResetPeriod uint32
|
||||||
RebootMsg *uint16
|
RebootMsg *uint16
|
||||||
|
@ -164,12 +200,19 @@ type SC_ACTION struct {
|
||||||
Delay uint32
|
Delay uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type QUERY_SERVICE_LOCK_STATUS struct {
|
||||||
|
IsLocked uint32
|
||||||
|
LockOwner *uint16
|
||||||
|
LockDuration uint32
|
||||||
|
}
|
||||||
|
|
||||||
//sys CloseServiceHandle(handle Handle) (err error) = advapi32.CloseServiceHandle
|
//sys CloseServiceHandle(handle Handle) (err error) = advapi32.CloseServiceHandle
|
||||||
//sys CreateService(mgr Handle, serviceName *uint16, displayName *uint16, access uint32, srvType uint32, startType uint32, errCtl uint32, pathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16) (handle Handle, err error) [failretval==0] = advapi32.CreateServiceW
|
//sys CreateService(mgr Handle, serviceName *uint16, displayName *uint16, access uint32, srvType uint32, startType uint32, errCtl uint32, pathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16) (handle Handle, err error) [failretval==0] = advapi32.CreateServiceW
|
||||||
//sys OpenService(mgr Handle, serviceName *uint16, access uint32) (handle Handle, err error) [failretval==0] = advapi32.OpenServiceW
|
//sys OpenService(mgr Handle, serviceName *uint16, access uint32) (handle Handle, err error) [failretval==0] = advapi32.OpenServiceW
|
||||||
//sys DeleteService(service Handle) (err error) = advapi32.DeleteService
|
//sys DeleteService(service Handle) (err error) = advapi32.DeleteService
|
||||||
//sys StartService(service Handle, numArgs uint32, argVectors **uint16) (err error) = advapi32.StartServiceW
|
//sys StartService(service Handle, numArgs uint32, argVectors **uint16) (err error) = advapi32.StartServiceW
|
||||||
//sys QueryServiceStatus(service Handle, status *SERVICE_STATUS) (err error) = advapi32.QueryServiceStatus
|
//sys QueryServiceStatus(service Handle, status *SERVICE_STATUS) (err error) = advapi32.QueryServiceStatus
|
||||||
|
//sys QueryServiceLockStatus(mgr Handle, lockStatus *QUERY_SERVICE_LOCK_STATUS, bufSize uint32, bytesNeeded *uint32) (err error) = advapi32.QueryServiceLockStatusW
|
||||||
//sys ControlService(service Handle, control uint32, status *SERVICE_STATUS) (err error) = advapi32.ControlService
|
//sys ControlService(service Handle, control uint32, status *SERVICE_STATUS) (err error) = advapi32.ControlService
|
||||||
//sys StartServiceCtrlDispatcher(serviceTable *SERVICE_TABLE_ENTRY) (err error) = advapi32.StartServiceCtrlDispatcherW
|
//sys StartServiceCtrlDispatcher(serviceTable *SERVICE_TABLE_ENTRY) (err error) = advapi32.StartServiceCtrlDispatcherW
|
||||||
//sys SetServiceStatus(service Handle, serviceStatus *SERVICE_STATUS) (err error) = advapi32.SetServiceStatus
|
//sys SetServiceStatus(service Handle, serviceStatus *SERVICE_STATUS) (err error) = advapi32.SetServiceStatus
|
||||||
|
@ -178,4 +221,5 @@ type SC_ACTION struct {
|
||||||
//sys ChangeServiceConfig2(service Handle, infoLevel uint32, info *byte) (err error) = advapi32.ChangeServiceConfig2W
|
//sys ChangeServiceConfig2(service Handle, infoLevel uint32, info *byte) (err error) = advapi32.ChangeServiceConfig2W
|
||||||
//sys QueryServiceConfig2(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) = advapi32.QueryServiceConfig2W
|
//sys QueryServiceConfig2(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) = advapi32.QueryServiceConfig2W
|
||||||
//sys EnumServicesStatusEx(mgr Handle, infoLevel uint32, serviceType uint32, serviceState uint32, services *byte, bufSize uint32, bytesNeeded *uint32, servicesReturned *uint32, resumeHandle *uint32, groupName *uint16) (err error) = advapi32.EnumServicesStatusExW
|
//sys EnumServicesStatusEx(mgr Handle, infoLevel uint32, serviceType uint32, serviceState uint32, services *byte, bufSize uint32, bytesNeeded *uint32, servicesReturned *uint32, resumeHandle *uint32, groupName *uint16) (err error) = advapi32.EnumServicesStatusExW
|
||||||
//sys QueryServiceStatusEx(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) = advapi32.QueryServiceStatusEx
|
//sys QueryServiceStatusEx(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) = advapi32.QueryServiceStatusEx
|
||||||
|
//sys NotifyServiceStatusChange(service Handle, notifyMask uint32, notifier *SERVICE_NOTIFY) (ret error) = advapi32.NotifyServiceStatusChangeW
|
||||||
|
|
|
@ -10,6 +10,7 @@ import (
|
||||||
errorspkg "errors"
|
errorspkg "errors"
|
||||||
"sync"
|
"sync"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
"time"
|
||||||
"unicode/utf16"
|
"unicode/utf16"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
@ -55,6 +56,10 @@ const (
|
||||||
FILE_UNICODE_ON_DISK = 0x00000004
|
FILE_UNICODE_ON_DISK = 0x00000004
|
||||||
FILE_VOLUME_IS_COMPRESSED = 0x00008000
|
FILE_VOLUME_IS_COMPRESSED = 0x00008000
|
||||||
FILE_VOLUME_QUOTAS = 0x00000020
|
FILE_VOLUME_QUOTAS = 0x00000020
|
||||||
|
|
||||||
|
// Return values of SleepEx and other APC functions
|
||||||
|
STATUS_USER_APC = 0x000000C0
|
||||||
|
WAIT_IO_COMPLETION = STATUS_USER_APC
|
||||||
)
|
)
|
||||||
|
|
||||||
// StringToUTF16 is deprecated. Use UTF16FromString instead.
|
// StringToUTF16 is deprecated. Use UTF16FromString instead.
|
||||||
|
@ -134,6 +139,7 @@ func NewCallbackCDecl(fn interface{}) uintptr {
|
||||||
//sys GetVersion() (ver uint32, err error)
|
//sys GetVersion() (ver uint32, err error)
|
||||||
//sys FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, err error) = FormatMessageW
|
//sys FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, err error) = FormatMessageW
|
||||||
//sys ExitProcess(exitcode uint32)
|
//sys ExitProcess(exitcode uint32)
|
||||||
|
//sys IsWow64Process(handle Handle, isWow64 *bool) (err error) = IsWow64Process
|
||||||
//sys CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) [failretval==InvalidHandle] = CreateFileW
|
//sys CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) [failretval==InvalidHandle] = CreateFileW
|
||||||
//sys ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error)
|
//sys ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error)
|
||||||
//sys WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error)
|
//sys WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error)
|
||||||
|
@ -167,10 +173,12 @@ func NewCallbackCDecl(fn interface{}) uintptr {
|
||||||
//sys CancelIoEx(s Handle, o *Overlapped) (err error)
|
//sys CancelIoEx(s Handle, o *Overlapped) (err error)
|
||||||
//sys CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) = CreateProcessW
|
//sys CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) = CreateProcessW
|
||||||
//sys OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle Handle, err error)
|
//sys OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle Handle, err error)
|
||||||
|
//sys ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int32) (err error) = shell32.ShellExecuteW
|
||||||
//sys TerminateProcess(handle Handle, exitcode uint32) (err error)
|
//sys TerminateProcess(handle Handle, exitcode uint32) (err error)
|
||||||
//sys GetExitCodeProcess(handle Handle, exitcode *uint32) (err error)
|
//sys GetExitCodeProcess(handle Handle, exitcode *uint32) (err error)
|
||||||
//sys GetStartupInfo(startupInfo *StartupInfo) (err error) = GetStartupInfoW
|
//sys GetStartupInfo(startupInfo *StartupInfo) (err error) = GetStartupInfoW
|
||||||
//sys GetCurrentProcess() (pseudoHandle Handle, err error)
|
//sys GetCurrentProcess() (pseudoHandle Handle, err error)
|
||||||
|
//sys GetCurrentThread() (pseudoHandle Handle, err error)
|
||||||
//sys GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error)
|
//sys GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error)
|
||||||
//sys DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (err error)
|
//sys DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (err error)
|
||||||
//sys WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, err error) [failretval==0xffffffff]
|
//sys WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, err error) [failretval==0xffffffff]
|
||||||
|
@ -185,6 +193,9 @@ func NewCallbackCDecl(fn interface{}) uintptr {
|
||||||
//sys FreeEnvironmentStrings(envs *uint16) (err error) = kernel32.FreeEnvironmentStringsW
|
//sys FreeEnvironmentStrings(envs *uint16) (err error) = kernel32.FreeEnvironmentStringsW
|
||||||
//sys GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32, err error) = kernel32.GetEnvironmentVariableW
|
//sys GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32, err error) = kernel32.GetEnvironmentVariableW
|
||||||
//sys SetEnvironmentVariable(name *uint16, value *uint16) (err error) = kernel32.SetEnvironmentVariableW
|
//sys SetEnvironmentVariable(name *uint16, value *uint16) (err error) = kernel32.SetEnvironmentVariableW
|
||||||
|
//sys CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) (err error) = userenv.CreateEnvironmentBlock
|
||||||
|
//sys DestroyEnvironmentBlock(block *uint16) (err error) = userenv.DestroyEnvironmentBlock
|
||||||
|
//sys getTickCount64() (ms uint64) = kernel32.GetTickCount64
|
||||||
//sys SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error)
|
//sys SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error)
|
||||||
//sys GetFileAttributes(name *uint16) (attrs uint32, err error) [failretval==INVALID_FILE_ATTRIBUTES] = kernel32.GetFileAttributesW
|
//sys GetFileAttributes(name *uint16) (attrs uint32, err error) [failretval==INVALID_FILE_ATTRIBUTES] = kernel32.GetFileAttributesW
|
||||||
//sys SetFileAttributes(name *uint16, attrs uint32) (err error) = kernel32.SetFileAttributesW
|
//sys SetFileAttributes(name *uint16, attrs uint32) (err error) = kernel32.SetFileAttributesW
|
||||||
|
@ -223,7 +234,7 @@ func NewCallbackCDecl(fn interface{}) uintptr {
|
||||||
//sys RegQueryInfoKey(key Handle, class *uint16, classLen *uint32, reserved *uint32, subkeysLen *uint32, maxSubkeyLen *uint32, maxClassLen *uint32, valuesLen *uint32, maxValueNameLen *uint32, maxValueLen *uint32, saLen *uint32, lastWriteTime *Filetime) (regerrno error) = advapi32.RegQueryInfoKeyW
|
//sys RegQueryInfoKey(key Handle, class *uint16, classLen *uint32, reserved *uint32, subkeysLen *uint32, maxSubkeyLen *uint32, maxClassLen *uint32, valuesLen *uint32, maxValueNameLen *uint32, maxValueLen *uint32, saLen *uint32, lastWriteTime *Filetime) (regerrno error) = advapi32.RegQueryInfoKeyW
|
||||||
//sys RegEnumKeyEx(key Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, class *uint16, classLen *uint32, lastWriteTime *Filetime) (regerrno error) = advapi32.RegEnumKeyExW
|
//sys RegEnumKeyEx(key Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, class *uint16, classLen *uint32, lastWriteTime *Filetime) (regerrno error) = advapi32.RegEnumKeyExW
|
||||||
//sys RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) = advapi32.RegQueryValueExW
|
//sys RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) = advapi32.RegQueryValueExW
|
||||||
//sys getCurrentProcessId() (pid uint32) = kernel32.GetCurrentProcessId
|
//sys GetCurrentProcessId() (pid uint32) = kernel32.GetCurrentProcessId
|
||||||
//sys GetConsoleMode(console Handle, mode *uint32) (err error) = kernel32.GetConsoleMode
|
//sys GetConsoleMode(console Handle, mode *uint32) (err error) = kernel32.GetConsoleMode
|
||||||
//sys SetConsoleMode(console Handle, mode uint32) (err error) = kernel32.SetConsoleMode
|
//sys SetConsoleMode(console Handle, mode uint32) (err error) = kernel32.SetConsoleMode
|
||||||
//sys GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) = kernel32.GetConsoleScreenBufferInfo
|
//sys GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) = kernel32.GetConsoleScreenBufferInfo
|
||||||
|
@ -232,6 +243,8 @@ func NewCallbackCDecl(fn interface{}) uintptr {
|
||||||
//sys CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error) [failretval==InvalidHandle] = kernel32.CreateToolhelp32Snapshot
|
//sys CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error) [failretval==InvalidHandle] = kernel32.CreateToolhelp32Snapshot
|
||||||
//sys Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error) = kernel32.Process32FirstW
|
//sys Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error) = kernel32.Process32FirstW
|
||||||
//sys Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) = kernel32.Process32NextW
|
//sys Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) = kernel32.Process32NextW
|
||||||
|
//sys Thread32First(snapshot Handle, threadEntry *ThreadEntry32) (err error)
|
||||||
|
//sys Thread32Next(snapshot Handle, threadEntry *ThreadEntry32) (err error)
|
||||||
//sys DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBufferSize uint32, outBuffer *byte, outBufferSize uint32, bytesReturned *uint32, overlapped *Overlapped) (err error)
|
//sys DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBufferSize uint32, outBuffer *byte, outBufferSize uint32, bytesReturned *uint32, overlapped *Overlapped) (err error)
|
||||||
// This function returns 1 byte BOOLEAN rather than the 4 byte BOOL.
|
// This function returns 1 byte BOOLEAN rather than the 4 byte BOOL.
|
||||||
//sys CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags uint32) (err error) [failretval&0xff==0] = CreateSymbolicLinkW
|
//sys CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags uint32) (err error) [failretval&0xff==0] = CreateSymbolicLinkW
|
||||||
|
@ -243,6 +256,16 @@ func NewCallbackCDecl(fn interface{}) uintptr {
|
||||||
//sys SetEvent(event Handle) (err error) = kernel32.SetEvent
|
//sys SetEvent(event Handle) (err error) = kernel32.SetEvent
|
||||||
//sys ResetEvent(event Handle) (err error) = kernel32.ResetEvent
|
//sys ResetEvent(event Handle) (err error) = kernel32.ResetEvent
|
||||||
//sys PulseEvent(event Handle) (err error) = kernel32.PulseEvent
|
//sys PulseEvent(event Handle) (err error) = kernel32.PulseEvent
|
||||||
|
//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
|
||||||
|
//sys TerminateJobObject(job Handle, exitCode uint32) (err error) = kernel32.TerminateJobObject
|
||||||
|
//sys SetErrorMode(mode uint32) (ret uint32) = kernel32.SetErrorMode
|
||||||
|
//sys ResumeThread(thread Handle) (ret uint32, err error) [failretval==0xffffffff] = kernel32.ResumeThread
|
||||||
|
//sys SetPriorityClass(process Handle, priorityClass uint32) (err error) = kernel32.SetPriorityClass
|
||||||
|
//sys GetPriorityClass(process Handle) (ret uint32, err error) = kernel32.GetPriorityClass
|
||||||
|
//sys SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobObjectInformation uintptr, JobObjectInformationLength uint32) (ret int, err error)
|
||||||
|
//sys GenerateConsoleCtrlEvent(ctrlEvent uint32, processGroupID uint32) (err error)
|
||||||
|
|
||||||
// Volume Management Functions
|
// Volume Management Functions
|
||||||
//sys DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) = DefineDosDeviceW
|
//sys DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) = DefineDosDeviceW
|
||||||
|
@ -264,6 +287,10 @@ func NewCallbackCDecl(fn interface{}) uintptr {
|
||||||
//sys QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint32, err error) [failretval==0] = QueryDosDeviceW
|
//sys QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint32, err error) [failretval==0] = QueryDosDeviceW
|
||||||
//sys SetVolumeLabel(rootPathName *uint16, volumeName *uint16) (err error) = SetVolumeLabelW
|
//sys SetVolumeLabel(rootPathName *uint16, volumeName *uint16) (err error) = SetVolumeLabelW
|
||||||
//sys SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err error) = SetVolumeMountPointW
|
//sys SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err error) = SetVolumeMountPointW
|
||||||
|
//sys MessageBox(hwnd Handle, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) [failretval==0] = user32.MessageBoxW
|
||||||
|
//sys clsidFromString(lpsz *uint16, pclsid *GUID) (ret error) = ole32.CLSIDFromString
|
||||||
|
//sys stringFromGUID2(rguid *GUID, lpsz *uint16, cchMax int32) (chars int32) = ole32.StringFromGUID2
|
||||||
|
//sys coCreateGuid(pguid *GUID) (ret error) = ole32.CoCreateGuid
|
||||||
|
|
||||||
// syscall interface implementation for other packages
|
// syscall interface implementation for other packages
|
||||||
|
|
||||||
|
@ -478,6 +505,10 @@ func ComputerName() (name string, err error) {
|
||||||
return string(utf16.Decode(b[0:n])), nil
|
return string(utf16.Decode(b[0:n])), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func DurationSinceBoot() time.Duration {
|
||||||
|
return time.Duration(getTickCount64()) * time.Millisecond
|
||||||
|
}
|
||||||
|
|
||||||
func Ftruncate(fd Handle, length int64) (err error) {
|
func Ftruncate(fd Handle, length int64) (err error) {
|
||||||
curoffset, e := Seek(fd, 0, 1)
|
curoffset, e := Seek(fd, 0, 1)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
|
@ -1087,7 +1118,7 @@ func SetsockoptIPv6Mreq(fd Handle, level, opt int, mreq *IPv6Mreq) (err error) {
|
||||||
return syscall.EWINDOWS
|
return syscall.EWINDOWS
|
||||||
}
|
}
|
||||||
|
|
||||||
func Getpid() (pid int) { return int(getCurrentProcessId()) }
|
func Getpid() (pid int) { return int(GetCurrentProcessId()) }
|
||||||
|
|
||||||
func FindFirstFile(name *uint16, data *Win32finddata) (handle Handle, err error) {
|
func FindFirstFile(name *uint16, data *Win32finddata) (handle Handle, err error) {
|
||||||
// NOTE(rsc): The Win32finddata struct is wrong for the system call:
|
// NOTE(rsc): The Win32finddata struct is wrong for the system call:
|
||||||
|
@ -1215,3 +1246,39 @@ func Readlink(path string, buf []byte) (n int, err error) {
|
||||||
|
|
||||||
return n, nil
|
return n, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GUIDFromString parses a string in the form of
|
||||||
|
// "{XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" into a GUID.
|
||||||
|
func GUIDFromString(str string) (GUID, error) {
|
||||||
|
guid := GUID{}
|
||||||
|
str16, err := syscall.UTF16PtrFromString(str)
|
||||||
|
if err != nil {
|
||||||
|
return guid, err
|
||||||
|
}
|
||||||
|
err = clsidFromString(str16, &guid)
|
||||||
|
if err != nil {
|
||||||
|
return guid, err
|
||||||
|
}
|
||||||
|
return guid, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GenerateGUID creates a new random GUID.
|
||||||
|
func GenerateGUID() (GUID, error) {
|
||||||
|
guid := GUID{}
|
||||||
|
err := coCreateGuid(&guid)
|
||||||
|
if err != nil {
|
||||||
|
return guid, err
|
||||||
|
}
|
||||||
|
return guid, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// String returns the canonical string form of the GUID,
|
||||||
|
// in the form of "{XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}".
|
||||||
|
func (guid GUID) String() string {
|
||||||
|
var str [100]uint16
|
||||||
|
chars := stringFromGUID2(&guid, &str[0], int32(len(str)))
|
||||||
|
if chars <= 1 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return string(utf16.Decode(str[:chars-1]))
|
||||||
|
}
|
||||||
|
|
|
@ -4,7 +4,11 @@
|
||||||
|
|
||||||
package windows
|
package windows
|
||||||
|
|
||||||
import "syscall"
|
import (
|
||||||
|
"net"
|
||||||
|
"syscall"
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Invented values to support what package os expects.
|
// Invented values to support what package os expects.
|
||||||
|
@ -154,9 +158,39 @@ const (
|
||||||
WAIT_OBJECT_0 = 0x00000000
|
WAIT_OBJECT_0 = 0x00000000
|
||||||
WAIT_FAILED = 0xFFFFFFFF
|
WAIT_FAILED = 0xFFFFFFFF
|
||||||
|
|
||||||
PROCESS_TERMINATE = 1
|
// Standard access rights.
|
||||||
PROCESS_QUERY_INFORMATION = 0x00000400
|
DELETE = 0x00010000
|
||||||
SYNCHRONIZE = 0x00100000
|
READ_CONTROL = 0x00020000
|
||||||
|
SYNCHRONIZE = 0x00100000
|
||||||
|
WRITE_DAC = 0x00040000
|
||||||
|
WRITE_OWNER = 0x00080000
|
||||||
|
|
||||||
|
// Access rights for process.
|
||||||
|
PROCESS_CREATE_PROCESS = 0x0080
|
||||||
|
PROCESS_CREATE_THREAD = 0x0002
|
||||||
|
PROCESS_DUP_HANDLE = 0x0040
|
||||||
|
PROCESS_QUERY_INFORMATION = 0x0400
|
||||||
|
PROCESS_QUERY_LIMITED_INFORMATION = 0x1000
|
||||||
|
PROCESS_SET_INFORMATION = 0x0200
|
||||||
|
PROCESS_SET_QUOTA = 0x0100
|
||||||
|
PROCESS_SUSPEND_RESUME = 0x0800
|
||||||
|
PROCESS_TERMINATE = 0x0001
|
||||||
|
PROCESS_VM_OPERATION = 0x0008
|
||||||
|
PROCESS_VM_READ = 0x0010
|
||||||
|
PROCESS_VM_WRITE = 0x0020
|
||||||
|
|
||||||
|
// Access rights for thread.
|
||||||
|
THREAD_DIRECT_IMPERSONATION = 0x0200
|
||||||
|
THREAD_GET_CONTEXT = 0x0008
|
||||||
|
THREAD_IMPERSONATE = 0x0100
|
||||||
|
THREAD_QUERY_INFORMATION = 0x0040
|
||||||
|
THREAD_QUERY_LIMITED_INFORMATION = 0x0800
|
||||||
|
THREAD_SET_CONTEXT = 0x0010
|
||||||
|
THREAD_SET_INFORMATION = 0x0020
|
||||||
|
THREAD_SET_LIMITED_INFORMATION = 0x0400
|
||||||
|
THREAD_SET_THREAD_TOKEN = 0x0080
|
||||||
|
THREAD_SUSPEND_RESUME = 0x0002
|
||||||
|
THREAD_TERMINATE = 0x0001
|
||||||
|
|
||||||
FILE_MAP_COPY = 0x01
|
FILE_MAP_COPY = 0x01
|
||||||
FILE_MAP_WRITE = 0x02
|
FILE_MAP_WRITE = 0x02
|
||||||
|
@ -396,6 +430,26 @@ const (
|
||||||
SECURITY_FLAG_IGNORE_CERT_DATE_INVALID = 0x00002000
|
SECURITY_FLAG_IGNORE_CERT_DATE_INVALID = 0x00002000
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// flags for SetErrorMode
|
||||||
|
SEM_FAILCRITICALERRORS = 0x0001
|
||||||
|
SEM_NOALIGNMENTFAULTEXCEPT = 0x0004
|
||||||
|
SEM_NOGPFAULTERRORBOX = 0x0002
|
||||||
|
SEM_NOOPENFILEERRORBOX = 0x8000
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Priority class.
|
||||||
|
ABOVE_NORMAL_PRIORITY_CLASS = 0x00008000
|
||||||
|
BELOW_NORMAL_PRIORITY_CLASS = 0x00004000
|
||||||
|
HIGH_PRIORITY_CLASS = 0x00000080
|
||||||
|
IDLE_PRIORITY_CLASS = 0x00000040
|
||||||
|
NORMAL_PRIORITY_CLASS = 0x00000020
|
||||||
|
PROCESS_MODE_BACKGROUND_BEGIN = 0x00100000
|
||||||
|
PROCESS_MODE_BACKGROUND_END = 0x00200000
|
||||||
|
REALTIME_PRIORITY_CLASS = 0x00000100
|
||||||
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
OID_PKIX_KP_SERVER_AUTH = []byte("1.3.6.1.5.5.7.3.1\x00")
|
OID_PKIX_KP_SERVER_AUTH = []byte("1.3.6.1.5.5.7.3.1\x00")
|
||||||
OID_SERVER_GATED_CRYPTO = []byte("1.3.6.1.4.1.311.10.3.3\x00")
|
OID_SERVER_GATED_CRYPTO = []byte("1.3.6.1.4.1.311.10.3.3\x00")
|
||||||
|
@ -605,6 +659,16 @@ type ProcessEntry32 struct {
|
||||||
ExeFile [MAX_PATH]uint16
|
ExeFile [MAX_PATH]uint16
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ThreadEntry32 struct {
|
||||||
|
Size uint32
|
||||||
|
Usage uint32
|
||||||
|
ThreadID uint32
|
||||||
|
OwnerProcessID uint32
|
||||||
|
BasePri int32
|
||||||
|
DeltaPri int32
|
||||||
|
Flags uint32
|
||||||
|
}
|
||||||
|
|
||||||
type Systemtime struct {
|
type Systemtime struct {
|
||||||
Year uint16
|
Year uint16
|
||||||
Month uint16
|
Month uint16
|
||||||
|
@ -1286,6 +1350,41 @@ const (
|
||||||
ComputerNameMax = 8
|
ComputerNameMax = 8
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// For MessageBox()
|
||||||
|
const (
|
||||||
|
MB_OK = 0x00000000
|
||||||
|
MB_OKCANCEL = 0x00000001
|
||||||
|
MB_ABORTRETRYIGNORE = 0x00000002
|
||||||
|
MB_YESNOCANCEL = 0x00000003
|
||||||
|
MB_YESNO = 0x00000004
|
||||||
|
MB_RETRYCANCEL = 0x00000005
|
||||||
|
MB_CANCELTRYCONTINUE = 0x00000006
|
||||||
|
MB_ICONHAND = 0x00000010
|
||||||
|
MB_ICONQUESTION = 0x00000020
|
||||||
|
MB_ICONEXCLAMATION = 0x00000030
|
||||||
|
MB_ICONASTERISK = 0x00000040
|
||||||
|
MB_USERICON = 0x00000080
|
||||||
|
MB_ICONWARNING = MB_ICONEXCLAMATION
|
||||||
|
MB_ICONERROR = MB_ICONHAND
|
||||||
|
MB_ICONINFORMATION = MB_ICONASTERISK
|
||||||
|
MB_ICONSTOP = MB_ICONHAND
|
||||||
|
MB_DEFBUTTON1 = 0x00000000
|
||||||
|
MB_DEFBUTTON2 = 0x00000100
|
||||||
|
MB_DEFBUTTON3 = 0x00000200
|
||||||
|
MB_DEFBUTTON4 = 0x00000300
|
||||||
|
MB_APPLMODAL = 0x00000000
|
||||||
|
MB_SYSTEMMODAL = 0x00001000
|
||||||
|
MB_TASKMODAL = 0x00002000
|
||||||
|
MB_HELP = 0x00004000
|
||||||
|
MB_NOFOCUS = 0x00008000
|
||||||
|
MB_SETFOREGROUND = 0x00010000
|
||||||
|
MB_DEFAULT_DESKTOP_ONLY = 0x00020000
|
||||||
|
MB_TOPMOST = 0x00040000
|
||||||
|
MB_RIGHT = 0x00080000
|
||||||
|
MB_RTLREADING = 0x00100000
|
||||||
|
MB_SERVICE_NOTIFICATION = 0x00200000
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
MOVEFILE_REPLACE_EXISTING = 0x1
|
MOVEFILE_REPLACE_EXISTING = 0x1
|
||||||
MOVEFILE_COPY_ALLOWED = 0x2
|
MOVEFILE_COPY_ALLOWED = 0x2
|
||||||
|
@ -1314,6 +1413,16 @@ type SocketAddress struct {
|
||||||
SockaddrLength int32
|
SockaddrLength int32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IP returns an IPv4 or IPv6 address, or nil if the underlying SocketAddress is neither.
|
||||||
|
func (addr *SocketAddress) IP() net.IP {
|
||||||
|
if uintptr(addr.SockaddrLength) >= unsafe.Sizeof(RawSockaddrInet4{}) && addr.Sockaddr.Addr.Family == AF_INET {
|
||||||
|
return (*RawSockaddrInet4)(unsafe.Pointer(addr.Sockaddr)).Addr[:]
|
||||||
|
} else if uintptr(addr.SockaddrLength) >= unsafe.Sizeof(RawSockaddrInet6{}) && addr.Sockaddr.Addr.Family == AF_INET6 {
|
||||||
|
return (*RawSockaddrInet6)(unsafe.Pointer(addr.Sockaddr)).Addr[:]
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
type IpAdapterUnicastAddress struct {
|
type IpAdapterUnicastAddress struct {
|
||||||
Length uint32
|
Length uint32
|
||||||
Flags uint32
|
Flags uint32
|
||||||
|
@ -1439,3 +1548,85 @@ type ConsoleScreenBufferInfo struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
const UNIX_PATH_MAX = 108 // defined in afunix.h
|
const UNIX_PATH_MAX = 108 // defined in afunix.h
|
||||||
|
|
||||||
|
const (
|
||||||
|
// flags for JOBOBJECT_BASIC_LIMIT_INFORMATION.LimitFlags
|
||||||
|
JOB_OBJECT_LIMIT_ACTIVE_PROCESS = 0x00000008
|
||||||
|
JOB_OBJECT_LIMIT_AFFINITY = 0x00000010
|
||||||
|
JOB_OBJECT_LIMIT_BREAKAWAY_OK = 0x00000800
|
||||||
|
JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION = 0x00000400
|
||||||
|
JOB_OBJECT_LIMIT_JOB_MEMORY = 0x00000200
|
||||||
|
JOB_OBJECT_LIMIT_JOB_TIME = 0x00000004
|
||||||
|
JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE = 0x00002000
|
||||||
|
JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME = 0x00000040
|
||||||
|
JOB_OBJECT_LIMIT_PRIORITY_CLASS = 0x00000020
|
||||||
|
JOB_OBJECT_LIMIT_PROCESS_MEMORY = 0x00000100
|
||||||
|
JOB_OBJECT_LIMIT_PROCESS_TIME = 0x00000002
|
||||||
|
JOB_OBJECT_LIMIT_SCHEDULING_CLASS = 0x00000080
|
||||||
|
JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK = 0x00001000
|
||||||
|
JOB_OBJECT_LIMIT_SUBSET_AFFINITY = 0x00004000
|
||||||
|
JOB_OBJECT_LIMIT_WORKINGSET = 0x00000001
|
||||||
|
)
|
||||||
|
|
||||||
|
type JOBOBJECT_BASIC_LIMIT_INFORMATION struct {
|
||||||
|
PerProcessUserTimeLimit int64
|
||||||
|
PerJobUserTimeLimit int64
|
||||||
|
LimitFlags uint32
|
||||||
|
MinimumWorkingSetSize uintptr
|
||||||
|
MaximumWorkingSetSize uintptr
|
||||||
|
ActiveProcessLimit uint32
|
||||||
|
Affinity uintptr
|
||||||
|
PriorityClass uint32
|
||||||
|
SchedulingClass uint32
|
||||||
|
}
|
||||||
|
|
||||||
|
type IO_COUNTERS struct {
|
||||||
|
ReadOperationCount uint64
|
||||||
|
WriteOperationCount uint64
|
||||||
|
OtherOperationCount uint64
|
||||||
|
ReadTransferCount uint64
|
||||||
|
WriteTransferCount uint64
|
||||||
|
OtherTransferCount uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
type JOBOBJECT_EXTENDED_LIMIT_INFORMATION struct {
|
||||||
|
BasicLimitInformation JOBOBJECT_BASIC_LIMIT_INFORMATION
|
||||||
|
IoInfo IO_COUNTERS
|
||||||
|
ProcessMemoryLimit uintptr
|
||||||
|
JobMemoryLimit uintptr
|
||||||
|
PeakProcessMemoryUsed uintptr
|
||||||
|
PeakJobMemoryUsed uintptr
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
// UIRestrictionsClass
|
||||||
|
JOB_OBJECT_UILIMIT_DESKTOP = 0x00000040
|
||||||
|
JOB_OBJECT_UILIMIT_DISPLAYSETTINGS = 0x00000010
|
||||||
|
JOB_OBJECT_UILIMIT_EXITWINDOWS = 0x00000080
|
||||||
|
JOB_OBJECT_UILIMIT_GLOBALATOMS = 0x00000020
|
||||||
|
JOB_OBJECT_UILIMIT_HANDLES = 0x00000001
|
||||||
|
JOB_OBJECT_UILIMIT_READCLIPBOARD = 0x00000002
|
||||||
|
JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS = 0x00000008
|
||||||
|
JOB_OBJECT_UILIMIT_WRITECLIPBOARD = 0x00000004
|
||||||
|
)
|
||||||
|
|
||||||
|
type JOBOBJECT_BASIC_UI_RESTRICTIONS struct {
|
||||||
|
UIRestrictionsClass uint32
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
// JobObjectInformationClass
|
||||||
|
JobObjectAssociateCompletionPortInformation = 7
|
||||||
|
JobObjectBasicLimitInformation = 2
|
||||||
|
JobObjectBasicUIRestrictions = 4
|
||||||
|
JobObjectCpuRateControlInformation = 15
|
||||||
|
JobObjectEndOfJobTimeInformation = 6
|
||||||
|
JobObjectExtendedLimitInformation = 9
|
||||||
|
JobObjectGroupInformation = 11
|
||||||
|
JobObjectGroupInformationEx = 14
|
||||||
|
JobObjectLimitViolationInformation2 = 35
|
||||||
|
JobObjectNetRateControlInformation = 32
|
||||||
|
JobObjectNotificationLimitInformation = 12
|
||||||
|
JobObjectNotificationLimitInformation2 = 34
|
||||||
|
JobObjectSecurityLimitInformation = 5
|
||||||
|
)
|
||||||
|
|
|
@ -38,14 +38,17 @@ var (
|
||||||
modadvapi32 = NewLazySystemDLL("advapi32.dll")
|
modadvapi32 = NewLazySystemDLL("advapi32.dll")
|
||||||
modkernel32 = NewLazySystemDLL("kernel32.dll")
|
modkernel32 = NewLazySystemDLL("kernel32.dll")
|
||||||
modshell32 = NewLazySystemDLL("shell32.dll")
|
modshell32 = NewLazySystemDLL("shell32.dll")
|
||||||
|
moduserenv = NewLazySystemDLL("userenv.dll")
|
||||||
modmswsock = NewLazySystemDLL("mswsock.dll")
|
modmswsock = NewLazySystemDLL("mswsock.dll")
|
||||||
modcrypt32 = NewLazySystemDLL("crypt32.dll")
|
modcrypt32 = NewLazySystemDLL("crypt32.dll")
|
||||||
|
moduser32 = NewLazySystemDLL("user32.dll")
|
||||||
|
modole32 = NewLazySystemDLL("ole32.dll")
|
||||||
modws2_32 = NewLazySystemDLL("ws2_32.dll")
|
modws2_32 = NewLazySystemDLL("ws2_32.dll")
|
||||||
moddnsapi = NewLazySystemDLL("dnsapi.dll")
|
moddnsapi = NewLazySystemDLL("dnsapi.dll")
|
||||||
modiphlpapi = NewLazySystemDLL("iphlpapi.dll")
|
modiphlpapi = NewLazySystemDLL("iphlpapi.dll")
|
||||||
modsecur32 = NewLazySystemDLL("secur32.dll")
|
modsecur32 = NewLazySystemDLL("secur32.dll")
|
||||||
modnetapi32 = NewLazySystemDLL("netapi32.dll")
|
modnetapi32 = NewLazySystemDLL("netapi32.dll")
|
||||||
moduserenv = NewLazySystemDLL("userenv.dll")
|
modwtsapi32 = NewLazySystemDLL("wtsapi32.dll")
|
||||||
|
|
||||||
procRegisterEventSourceW = modadvapi32.NewProc("RegisterEventSourceW")
|
procRegisterEventSourceW = modadvapi32.NewProc("RegisterEventSourceW")
|
||||||
procDeregisterEventSource = modadvapi32.NewProc("DeregisterEventSource")
|
procDeregisterEventSource = modadvapi32.NewProc("DeregisterEventSource")
|
||||||
|
@ -57,6 +60,7 @@ var (
|
||||||
procDeleteService = modadvapi32.NewProc("DeleteService")
|
procDeleteService = modadvapi32.NewProc("DeleteService")
|
||||||
procStartServiceW = modadvapi32.NewProc("StartServiceW")
|
procStartServiceW = modadvapi32.NewProc("StartServiceW")
|
||||||
procQueryServiceStatus = modadvapi32.NewProc("QueryServiceStatus")
|
procQueryServiceStatus = modadvapi32.NewProc("QueryServiceStatus")
|
||||||
|
procQueryServiceLockStatusW = modadvapi32.NewProc("QueryServiceLockStatusW")
|
||||||
procControlService = modadvapi32.NewProc("ControlService")
|
procControlService = modadvapi32.NewProc("ControlService")
|
||||||
procStartServiceCtrlDispatcherW = modadvapi32.NewProc("StartServiceCtrlDispatcherW")
|
procStartServiceCtrlDispatcherW = modadvapi32.NewProc("StartServiceCtrlDispatcherW")
|
||||||
procSetServiceStatus = modadvapi32.NewProc("SetServiceStatus")
|
procSetServiceStatus = modadvapi32.NewProc("SetServiceStatus")
|
||||||
|
@ -66,6 +70,7 @@ var (
|
||||||
procQueryServiceConfig2W = modadvapi32.NewProc("QueryServiceConfig2W")
|
procQueryServiceConfig2W = modadvapi32.NewProc("QueryServiceConfig2W")
|
||||||
procEnumServicesStatusExW = modadvapi32.NewProc("EnumServicesStatusExW")
|
procEnumServicesStatusExW = modadvapi32.NewProc("EnumServicesStatusExW")
|
||||||
procQueryServiceStatusEx = modadvapi32.NewProc("QueryServiceStatusEx")
|
procQueryServiceStatusEx = modadvapi32.NewProc("QueryServiceStatusEx")
|
||||||
|
procNotifyServiceStatusChangeW = modadvapi32.NewProc("NotifyServiceStatusChangeW")
|
||||||
procGetLastError = modkernel32.NewProc("GetLastError")
|
procGetLastError = modkernel32.NewProc("GetLastError")
|
||||||
procLoadLibraryW = modkernel32.NewProc("LoadLibraryW")
|
procLoadLibraryW = modkernel32.NewProc("LoadLibraryW")
|
||||||
procLoadLibraryExW = modkernel32.NewProc("LoadLibraryExW")
|
procLoadLibraryExW = modkernel32.NewProc("LoadLibraryExW")
|
||||||
|
@ -74,6 +79,7 @@ var (
|
||||||
procGetVersion = modkernel32.NewProc("GetVersion")
|
procGetVersion = modkernel32.NewProc("GetVersion")
|
||||||
procFormatMessageW = modkernel32.NewProc("FormatMessageW")
|
procFormatMessageW = modkernel32.NewProc("FormatMessageW")
|
||||||
procExitProcess = modkernel32.NewProc("ExitProcess")
|
procExitProcess = modkernel32.NewProc("ExitProcess")
|
||||||
|
procIsWow64Process = modkernel32.NewProc("IsWow64Process")
|
||||||
procCreateFileW = modkernel32.NewProc("CreateFileW")
|
procCreateFileW = modkernel32.NewProc("CreateFileW")
|
||||||
procReadFile = modkernel32.NewProc("ReadFile")
|
procReadFile = modkernel32.NewProc("ReadFile")
|
||||||
procWriteFile = modkernel32.NewProc("WriteFile")
|
procWriteFile = modkernel32.NewProc("WriteFile")
|
||||||
|
@ -107,10 +113,12 @@ var (
|
||||||
procCancelIoEx = modkernel32.NewProc("CancelIoEx")
|
procCancelIoEx = modkernel32.NewProc("CancelIoEx")
|
||||||
procCreateProcessW = modkernel32.NewProc("CreateProcessW")
|
procCreateProcessW = modkernel32.NewProc("CreateProcessW")
|
||||||
procOpenProcess = modkernel32.NewProc("OpenProcess")
|
procOpenProcess = modkernel32.NewProc("OpenProcess")
|
||||||
|
procShellExecuteW = modshell32.NewProc("ShellExecuteW")
|
||||||
procTerminateProcess = modkernel32.NewProc("TerminateProcess")
|
procTerminateProcess = modkernel32.NewProc("TerminateProcess")
|
||||||
procGetExitCodeProcess = modkernel32.NewProc("GetExitCodeProcess")
|
procGetExitCodeProcess = modkernel32.NewProc("GetExitCodeProcess")
|
||||||
procGetStartupInfoW = modkernel32.NewProc("GetStartupInfoW")
|
procGetStartupInfoW = modkernel32.NewProc("GetStartupInfoW")
|
||||||
procGetCurrentProcess = modkernel32.NewProc("GetCurrentProcess")
|
procGetCurrentProcess = modkernel32.NewProc("GetCurrentProcess")
|
||||||
|
procGetCurrentThread = modkernel32.NewProc("GetCurrentThread")
|
||||||
procGetProcessTimes = modkernel32.NewProc("GetProcessTimes")
|
procGetProcessTimes = modkernel32.NewProc("GetProcessTimes")
|
||||||
procDuplicateHandle = modkernel32.NewProc("DuplicateHandle")
|
procDuplicateHandle = modkernel32.NewProc("DuplicateHandle")
|
||||||
procWaitForSingleObject = modkernel32.NewProc("WaitForSingleObject")
|
procWaitForSingleObject = modkernel32.NewProc("WaitForSingleObject")
|
||||||
|
@ -125,6 +133,9 @@ var (
|
||||||
procFreeEnvironmentStringsW = modkernel32.NewProc("FreeEnvironmentStringsW")
|
procFreeEnvironmentStringsW = modkernel32.NewProc("FreeEnvironmentStringsW")
|
||||||
procGetEnvironmentVariableW = modkernel32.NewProc("GetEnvironmentVariableW")
|
procGetEnvironmentVariableW = modkernel32.NewProc("GetEnvironmentVariableW")
|
||||||
procSetEnvironmentVariableW = modkernel32.NewProc("SetEnvironmentVariableW")
|
procSetEnvironmentVariableW = modkernel32.NewProc("SetEnvironmentVariableW")
|
||||||
|
procCreateEnvironmentBlock = moduserenv.NewProc("CreateEnvironmentBlock")
|
||||||
|
procDestroyEnvironmentBlock = moduserenv.NewProc("DestroyEnvironmentBlock")
|
||||||
|
procGetTickCount64 = modkernel32.NewProc("GetTickCount64")
|
||||||
procSetFileTime = modkernel32.NewProc("SetFileTime")
|
procSetFileTime = modkernel32.NewProc("SetFileTime")
|
||||||
procGetFileAttributesW = modkernel32.NewProc("GetFileAttributesW")
|
procGetFileAttributesW = modkernel32.NewProc("GetFileAttributesW")
|
||||||
procSetFileAttributesW = modkernel32.NewProc("SetFileAttributesW")
|
procSetFileAttributesW = modkernel32.NewProc("SetFileAttributesW")
|
||||||
|
@ -172,6 +183,8 @@ var (
|
||||||
procCreateToolhelp32Snapshot = modkernel32.NewProc("CreateToolhelp32Snapshot")
|
procCreateToolhelp32Snapshot = modkernel32.NewProc("CreateToolhelp32Snapshot")
|
||||||
procProcess32FirstW = modkernel32.NewProc("Process32FirstW")
|
procProcess32FirstW = modkernel32.NewProc("Process32FirstW")
|
||||||
procProcess32NextW = modkernel32.NewProc("Process32NextW")
|
procProcess32NextW = modkernel32.NewProc("Process32NextW")
|
||||||
|
procThread32First = modkernel32.NewProc("Thread32First")
|
||||||
|
procThread32Next = modkernel32.NewProc("Thread32Next")
|
||||||
procDeviceIoControl = modkernel32.NewProc("DeviceIoControl")
|
procDeviceIoControl = modkernel32.NewProc("DeviceIoControl")
|
||||||
procCreateSymbolicLinkW = modkernel32.NewProc("CreateSymbolicLinkW")
|
procCreateSymbolicLinkW = modkernel32.NewProc("CreateSymbolicLinkW")
|
||||||
procCreateHardLinkW = modkernel32.NewProc("CreateHardLinkW")
|
procCreateHardLinkW = modkernel32.NewProc("CreateHardLinkW")
|
||||||
|
@ -182,6 +195,16 @@ var (
|
||||||
procSetEvent = modkernel32.NewProc("SetEvent")
|
procSetEvent = modkernel32.NewProc("SetEvent")
|
||||||
procResetEvent = modkernel32.NewProc("ResetEvent")
|
procResetEvent = modkernel32.NewProc("ResetEvent")
|
||||||
procPulseEvent = modkernel32.NewProc("PulseEvent")
|
procPulseEvent = modkernel32.NewProc("PulseEvent")
|
||||||
|
procSleepEx = modkernel32.NewProc("SleepEx")
|
||||||
|
procCreateJobObjectW = modkernel32.NewProc("CreateJobObjectW")
|
||||||
|
procAssignProcessToJobObject = modkernel32.NewProc("AssignProcessToJobObject")
|
||||||
|
procTerminateJobObject = modkernel32.NewProc("TerminateJobObject")
|
||||||
|
procSetErrorMode = modkernel32.NewProc("SetErrorMode")
|
||||||
|
procResumeThread = modkernel32.NewProc("ResumeThread")
|
||||||
|
procSetPriorityClass = modkernel32.NewProc("SetPriorityClass")
|
||||||
|
procGetPriorityClass = modkernel32.NewProc("GetPriorityClass")
|
||||||
|
procSetInformationJobObject = modkernel32.NewProc("SetInformationJobObject")
|
||||||
|
procGenerateConsoleCtrlEvent = modkernel32.NewProc("GenerateConsoleCtrlEvent")
|
||||||
procDefineDosDeviceW = modkernel32.NewProc("DefineDosDeviceW")
|
procDefineDosDeviceW = modkernel32.NewProc("DefineDosDeviceW")
|
||||||
procDeleteVolumeMountPointW = modkernel32.NewProc("DeleteVolumeMountPointW")
|
procDeleteVolumeMountPointW = modkernel32.NewProc("DeleteVolumeMountPointW")
|
||||||
procFindFirstVolumeW = modkernel32.NewProc("FindFirstVolumeW")
|
procFindFirstVolumeW = modkernel32.NewProc("FindFirstVolumeW")
|
||||||
|
@ -201,6 +224,10 @@ var (
|
||||||
procQueryDosDeviceW = modkernel32.NewProc("QueryDosDeviceW")
|
procQueryDosDeviceW = modkernel32.NewProc("QueryDosDeviceW")
|
||||||
procSetVolumeLabelW = modkernel32.NewProc("SetVolumeLabelW")
|
procSetVolumeLabelW = modkernel32.NewProc("SetVolumeLabelW")
|
||||||
procSetVolumeMountPointW = modkernel32.NewProc("SetVolumeMountPointW")
|
procSetVolumeMountPointW = modkernel32.NewProc("SetVolumeMountPointW")
|
||||||
|
procMessageBoxW = moduser32.NewProc("MessageBoxW")
|
||||||
|
procCLSIDFromString = modole32.NewProc("CLSIDFromString")
|
||||||
|
procStringFromGUID2 = modole32.NewProc("StringFromGUID2")
|
||||||
|
procCoCreateGuid = modole32.NewProc("CoCreateGuid")
|
||||||
procWSAStartup = modws2_32.NewProc("WSAStartup")
|
procWSAStartup = modws2_32.NewProc("WSAStartup")
|
||||||
procWSACleanup = modws2_32.NewProc("WSACleanup")
|
procWSACleanup = modws2_32.NewProc("WSACleanup")
|
||||||
procWSAIoctl = modws2_32.NewProc("WSAIoctl")
|
procWSAIoctl = modws2_32.NewProc("WSAIoctl")
|
||||||
|
@ -249,13 +276,30 @@ var (
|
||||||
procCopySid = modadvapi32.NewProc("CopySid")
|
procCopySid = modadvapi32.NewProc("CopySid")
|
||||||
procAllocateAndInitializeSid = modadvapi32.NewProc("AllocateAndInitializeSid")
|
procAllocateAndInitializeSid = modadvapi32.NewProc("AllocateAndInitializeSid")
|
||||||
procCreateWellKnownSid = modadvapi32.NewProc("CreateWellKnownSid")
|
procCreateWellKnownSid = modadvapi32.NewProc("CreateWellKnownSid")
|
||||||
|
procIsWellKnownSid = modadvapi32.NewProc("IsWellKnownSid")
|
||||||
procFreeSid = modadvapi32.NewProc("FreeSid")
|
procFreeSid = modadvapi32.NewProc("FreeSid")
|
||||||
procEqualSid = modadvapi32.NewProc("EqualSid")
|
procEqualSid = modadvapi32.NewProc("EqualSid")
|
||||||
|
procGetSidIdentifierAuthority = modadvapi32.NewProc("GetSidIdentifierAuthority")
|
||||||
|
procGetSidSubAuthorityCount = modadvapi32.NewProc("GetSidSubAuthorityCount")
|
||||||
|
procGetSidSubAuthority = modadvapi32.NewProc("GetSidSubAuthority")
|
||||||
|
procIsValidSid = modadvapi32.NewProc("IsValidSid")
|
||||||
procCheckTokenMembership = modadvapi32.NewProc("CheckTokenMembership")
|
procCheckTokenMembership = modadvapi32.NewProc("CheckTokenMembership")
|
||||||
procOpenProcessToken = modadvapi32.NewProc("OpenProcessToken")
|
procOpenProcessToken = modadvapi32.NewProc("OpenProcessToken")
|
||||||
|
procOpenThreadToken = modadvapi32.NewProc("OpenThreadToken")
|
||||||
|
procImpersonateSelf = modadvapi32.NewProc("ImpersonateSelf")
|
||||||
|
procRevertToSelf = modadvapi32.NewProc("RevertToSelf")
|
||||||
|
procSetThreadToken = modadvapi32.NewProc("SetThreadToken")
|
||||||
|
procLookupPrivilegeValueW = modadvapi32.NewProc("LookupPrivilegeValueW")
|
||||||
|
procAdjustTokenPrivileges = modadvapi32.NewProc("AdjustTokenPrivileges")
|
||||||
|
procAdjustTokenGroups = modadvapi32.NewProc("AdjustTokenGroups")
|
||||||
procGetTokenInformation = modadvapi32.NewProc("GetTokenInformation")
|
procGetTokenInformation = modadvapi32.NewProc("GetTokenInformation")
|
||||||
|
procSetTokenInformation = modadvapi32.NewProc("SetTokenInformation")
|
||||||
|
procDuplicateTokenEx = modadvapi32.NewProc("DuplicateTokenEx")
|
||||||
procGetUserProfileDirectoryW = moduserenv.NewProc("GetUserProfileDirectoryW")
|
procGetUserProfileDirectoryW = moduserenv.NewProc("GetUserProfileDirectoryW")
|
||||||
procGetSystemDirectoryW = modkernel32.NewProc("GetSystemDirectoryW")
|
procGetSystemDirectoryW = modkernel32.NewProc("GetSystemDirectoryW")
|
||||||
|
procWTSQueryUserToken = modwtsapi32.NewProc("WTSQueryUserToken")
|
||||||
|
procWTSEnumerateSessionsW = modwtsapi32.NewProc("WTSEnumerateSessionsW")
|
||||||
|
procWTSFreeMemory = modwtsapi32.NewProc("WTSFreeMemory")
|
||||||
)
|
)
|
||||||
|
|
||||||
func RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Handle, err error) {
|
func RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Handle, err error) {
|
||||||
|
@ -382,6 +426,18 @@ func QueryServiceStatus(service Handle, status *SERVICE_STATUS) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func QueryServiceLockStatus(mgr Handle, lockStatus *QUERY_SERVICE_LOCK_STATUS, bufSize uint32, bytesNeeded *uint32) (err error) {
|
||||||
|
r1, _, e1 := syscall.Syscall6(procQueryServiceLockStatusW.Addr(), 4, uintptr(mgr), uintptr(unsafe.Pointer(lockStatus)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), 0, 0)
|
||||||
|
if r1 == 0 {
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
} else {
|
||||||
|
err = syscall.EINVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func ControlService(service Handle, control uint32, status *SERVICE_STATUS) (err error) {
|
func ControlService(service Handle, control uint32, status *SERVICE_STATUS) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall(procControlService.Addr(), 3, uintptr(service), uintptr(control), uintptr(unsafe.Pointer(status)))
|
r1, _, e1 := syscall.Syscall(procControlService.Addr(), 3, uintptr(service), uintptr(control), uintptr(unsafe.Pointer(status)))
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
|
@ -490,6 +546,14 @@ func QueryServiceStatusEx(service Handle, infoLevel uint32, buff *byte, buffSize
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func NotifyServiceStatusChange(service Handle, notifyMask uint32, notifier *SERVICE_NOTIFY) (ret error) {
|
||||||
|
r0, _, _ := syscall.Syscall(procNotifyServiceStatusChangeW.Addr(), 3, uintptr(service), uintptr(notifyMask), uintptr(unsafe.Pointer(notifier)))
|
||||||
|
if r0 != 0 {
|
||||||
|
ret = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func GetLastError() (lasterr error) {
|
func GetLastError() (lasterr error) {
|
||||||
r0, _, _ := syscall.Syscall(procGetLastError.Addr(), 0, 0, 0, 0)
|
r0, _, _ := syscall.Syscall(procGetLastError.Addr(), 0, 0, 0, 0)
|
||||||
if r0 != 0 {
|
if r0 != 0 {
|
||||||
|
@ -611,6 +675,18 @@ func ExitProcess(exitcode uint32) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IsWow64Process(handle Handle, isWow64 *bool) (err error) {
|
||||||
|
r1, _, e1 := syscall.Syscall(procIsWow64Process.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(isWow64)), 0)
|
||||||
|
if r1 == 0 {
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
} else {
|
||||||
|
err = syscall.EINVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) {
|
func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) {
|
||||||
r0, _, e1 := syscall.Syscall9(procCreateFileW.Addr(), 7, uintptr(unsafe.Pointer(name)), uintptr(access), uintptr(mode), uintptr(unsafe.Pointer(sa)), uintptr(createmode), uintptr(attrs), uintptr(templatefile), 0, 0)
|
r0, _, e1 := syscall.Syscall9(procCreateFileW.Addr(), 7, uintptr(unsafe.Pointer(name)), uintptr(access), uintptr(mode), uintptr(unsafe.Pointer(sa)), uintptr(createmode), uintptr(attrs), uintptr(templatefile), 0, 0)
|
||||||
handle = Handle(r0)
|
handle = Handle(r0)
|
||||||
|
@ -1027,6 +1103,18 @@ func OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle Handle, err
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int32) (err error) {
|
||||||
|
r1, _, e1 := syscall.Syscall6(procShellExecuteW.Addr(), 6, uintptr(hwnd), uintptr(unsafe.Pointer(verb)), uintptr(unsafe.Pointer(file)), uintptr(unsafe.Pointer(args)), uintptr(unsafe.Pointer(cwd)), uintptr(showCmd))
|
||||||
|
if r1 == 0 {
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
} else {
|
||||||
|
err = syscall.EINVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func TerminateProcess(handle Handle, exitcode uint32) (err error) {
|
func TerminateProcess(handle Handle, exitcode uint32) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall(procTerminateProcess.Addr(), 2, uintptr(handle), uintptr(exitcode), 0)
|
r1, _, e1 := syscall.Syscall(procTerminateProcess.Addr(), 2, uintptr(handle), uintptr(exitcode), 0)
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
|
@ -1076,6 +1164,19 @@ func GetCurrentProcess() (pseudoHandle Handle, err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetCurrentThread() (pseudoHandle Handle, err error) {
|
||||||
|
r0, _, e1 := syscall.Syscall(procGetCurrentThread.Addr(), 0, 0, 0, 0)
|
||||||
|
pseudoHandle = Handle(r0)
|
||||||
|
if pseudoHandle == 0 {
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
} else {
|
||||||
|
err = syscall.EINVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error) {
|
func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall6(procGetProcessTimes.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(creationTime)), uintptr(unsafe.Pointer(exitTime)), uintptr(unsafe.Pointer(kernelTime)), uintptr(unsafe.Pointer(userTime)), 0)
|
r1, _, e1 := syscall.Syscall6(procGetProcessTimes.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(creationTime)), uintptr(unsafe.Pointer(exitTime)), uintptr(unsafe.Pointer(kernelTime)), uintptr(unsafe.Pointer(userTime)), 0)
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
|
@ -1262,6 +1363,42 @@ func SetEnvironmentVariable(name *uint16, value *uint16) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) (err error) {
|
||||||
|
var _p0 uint32
|
||||||
|
if inheritExisting {
|
||||||
|
_p0 = 1
|
||||||
|
} else {
|
||||||
|
_p0 = 0
|
||||||
|
}
|
||||||
|
r1, _, e1 := syscall.Syscall(procCreateEnvironmentBlock.Addr(), 3, uintptr(unsafe.Pointer(block)), uintptr(token), uintptr(_p0))
|
||||||
|
if r1 == 0 {
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
} else {
|
||||||
|
err = syscall.EINVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func DestroyEnvironmentBlock(block *uint16) (err error) {
|
||||||
|
r1, _, e1 := syscall.Syscall(procDestroyEnvironmentBlock.Addr(), 1, uintptr(unsafe.Pointer(block)), 0, 0)
|
||||||
|
if r1 == 0 {
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
} else {
|
||||||
|
err = syscall.EINVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func getTickCount64() (ms uint64) {
|
||||||
|
r0, _, _ := syscall.Syscall(procGetTickCount64.Addr(), 0, 0, 0, 0)
|
||||||
|
ms = uint64(r0)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) {
|
func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall6(procSetFileTime.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0)
|
r1, _, e1 := syscall.Syscall6(procSetFileTime.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0)
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
|
@ -1704,7 +1841,7 @@ func RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func getCurrentProcessId() (pid uint32) {
|
func GetCurrentProcessId() (pid uint32) {
|
||||||
r0, _, _ := syscall.Syscall(procGetCurrentProcessId.Addr(), 0, 0, 0, 0)
|
r0, _, _ := syscall.Syscall(procGetCurrentProcessId.Addr(), 0, 0, 0, 0)
|
||||||
pid = uint32(r0)
|
pid = uint32(r0)
|
||||||
return
|
return
|
||||||
|
@ -1807,6 +1944,30 @@ func Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Thread32First(snapshot Handle, threadEntry *ThreadEntry32) (err error) {
|
||||||
|
r1, _, e1 := syscall.Syscall(procThread32First.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry)), 0)
|
||||||
|
if r1 == 0 {
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
} else {
|
||||||
|
err = syscall.EINVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func Thread32Next(snapshot Handle, threadEntry *ThreadEntry32) (err error) {
|
||||||
|
r1, _, e1 := syscall.Syscall(procThread32Next.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry)), 0)
|
||||||
|
if r1 == 0 {
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
} else {
|
||||||
|
err = syscall.EINVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBufferSize uint32, outBuffer *byte, outBufferSize uint32, bytesReturned *uint32, overlapped *Overlapped) (err error) {
|
func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBufferSize uint32, outBuffer *byte, outBufferSize uint32, bytesReturned *uint32, overlapped *Overlapped) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall9(procDeviceIoControl.Addr(), 8, uintptr(handle), uintptr(ioControlCode), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferSize), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferSize), uintptr(unsafe.Pointer(bytesReturned)), uintptr(unsafe.Pointer(overlapped)), 0)
|
r1, _, e1 := syscall.Syscall9(procDeviceIoControl.Addr(), 8, uintptr(handle), uintptr(ioControlCode), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferSize), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferSize), uintptr(unsafe.Pointer(bytesReturned)), uintptr(unsafe.Pointer(overlapped)), 0)
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
|
@ -1930,6 +2091,124 @@ func PulseEvent(event Handle) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SleepEx(milliseconds uint32, alertable bool) (ret uint32) {
|
||||||
|
var _p0 uint32
|
||||||
|
if alertable {
|
||||||
|
_p0 = 1
|
||||||
|
} else {
|
||||||
|
_p0 = 0
|
||||||
|
}
|
||||||
|
r0, _, _ := syscall.Syscall(procSleepEx.Addr(), 2, uintptr(milliseconds), uintptr(_p0), 0)
|
||||||
|
ret = uint32(r0)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateJobObject(jobAttr *SecurityAttributes, name *uint16) (handle Handle, err error) {
|
||||||
|
r0, _, e1 := syscall.Syscall(procCreateJobObjectW.Addr(), 2, uintptr(unsafe.Pointer(jobAttr)), uintptr(unsafe.Pointer(name)), 0)
|
||||||
|
handle = Handle(r0)
|
||||||
|
if handle == 0 {
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
} else {
|
||||||
|
err = syscall.EINVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func AssignProcessToJobObject(job Handle, process Handle) (err error) {
|
||||||
|
r1, _, e1 := syscall.Syscall(procAssignProcessToJobObject.Addr(), 2, uintptr(job), uintptr(process), 0)
|
||||||
|
if r1 == 0 {
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
} else {
|
||||||
|
err = syscall.EINVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func TerminateJobObject(job Handle, exitCode uint32) (err error) {
|
||||||
|
r1, _, e1 := syscall.Syscall(procTerminateJobObject.Addr(), 2, uintptr(job), uintptr(exitCode), 0)
|
||||||
|
if r1 == 0 {
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
} else {
|
||||||
|
err = syscall.EINVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetErrorMode(mode uint32) (ret uint32) {
|
||||||
|
r0, _, _ := syscall.Syscall(procSetErrorMode.Addr(), 1, uintptr(mode), 0, 0)
|
||||||
|
ret = uint32(r0)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func ResumeThread(thread Handle) (ret uint32, err error) {
|
||||||
|
r0, _, e1 := syscall.Syscall(procResumeThread.Addr(), 1, uintptr(thread), 0, 0)
|
||||||
|
ret = uint32(r0)
|
||||||
|
if ret == 0xffffffff {
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
} else {
|
||||||
|
err = syscall.EINVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetPriorityClass(process Handle, priorityClass uint32) (err error) {
|
||||||
|
r1, _, e1 := syscall.Syscall(procSetPriorityClass.Addr(), 2, uintptr(process), uintptr(priorityClass), 0)
|
||||||
|
if r1 == 0 {
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
} else {
|
||||||
|
err = syscall.EINVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetPriorityClass(process Handle) (ret uint32, err error) {
|
||||||
|
r0, _, e1 := syscall.Syscall(procGetPriorityClass.Addr(), 1, uintptr(process), 0, 0)
|
||||||
|
ret = uint32(r0)
|
||||||
|
if ret == 0 {
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
} else {
|
||||||
|
err = syscall.EINVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobObjectInformation uintptr, JobObjectInformationLength uint32) (ret int, err error) {
|
||||||
|
r0, _, e1 := syscall.Syscall6(procSetInformationJobObject.Addr(), 4, uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), 0, 0)
|
||||||
|
ret = int(r0)
|
||||||
|
if ret == 0 {
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
} else {
|
||||||
|
err = syscall.EINVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func GenerateConsoleCtrlEvent(ctrlEvent uint32, processGroupID uint32) (err error) {
|
||||||
|
r1, _, e1 := syscall.Syscall(procGenerateConsoleCtrlEvent.Addr(), 2, uintptr(ctrlEvent), uintptr(processGroupID), 0)
|
||||||
|
if r1 == 0 {
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
} else {
|
||||||
|
err = syscall.EINVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) {
|
func DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall(procDefineDosDeviceW.Addr(), 3, uintptr(flags), uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)))
|
r1, _, e1 := syscall.Syscall(procDefineDosDeviceW.Addr(), 3, uintptr(flags), uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)))
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
|
@ -2157,6 +2436,41 @@ func SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err erro
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func MessageBox(hwnd Handle, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) {
|
||||||
|
r0, _, e1 := syscall.Syscall6(procMessageBoxW.Addr(), 4, uintptr(hwnd), uintptr(unsafe.Pointer(text)), uintptr(unsafe.Pointer(caption)), uintptr(boxtype), 0, 0)
|
||||||
|
ret = int32(r0)
|
||||||
|
if ret == 0 {
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
} else {
|
||||||
|
err = syscall.EINVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func clsidFromString(lpsz *uint16, pclsid *GUID) (ret error) {
|
||||||
|
r0, _, _ := syscall.Syscall(procCLSIDFromString.Addr(), 2, uintptr(unsafe.Pointer(lpsz)), uintptr(unsafe.Pointer(pclsid)), 0)
|
||||||
|
if r0 != 0 {
|
||||||
|
ret = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func stringFromGUID2(rguid *GUID, lpsz *uint16, cchMax int32) (chars int32) {
|
||||||
|
r0, _, _ := syscall.Syscall(procStringFromGUID2.Addr(), 3, uintptr(unsafe.Pointer(rguid)), uintptr(unsafe.Pointer(lpsz)), uintptr(cchMax))
|
||||||
|
chars = int32(r0)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func coCreateGuid(pguid *GUID) (ret error) {
|
||||||
|
r0, _, _ := syscall.Syscall(procCoCreateGuid.Addr(), 1, uintptr(unsafe.Pointer(pguid)), 0, 0)
|
||||||
|
if r0 != 0 {
|
||||||
|
ret = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func WSAStartup(verreq uint32, data *WSAData) (sockerr error) {
|
func WSAStartup(verreq uint32, data *WSAData) (sockerr error) {
|
||||||
r0, _, _ := syscall.Syscall(procWSAStartup.Addr(), 2, uintptr(verreq), uintptr(unsafe.Pointer(data)), 0)
|
r0, _, _ := syscall.Syscall(procWSAStartup.Addr(), 2, uintptr(verreq), uintptr(unsafe.Pointer(data)), 0)
|
||||||
if r0 != 0 {
|
if r0 != 0 {
|
||||||
|
@ -2699,6 +3013,12 @@ func createWellKnownSid(sidType WELL_KNOWN_SID_TYPE, domainSid *SID, sid *SID, s
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isWellKnownSid(sid *SID, sidType WELL_KNOWN_SID_TYPE) (isWellKnown bool) {
|
||||||
|
r0, _, _ := syscall.Syscall(procIsWellKnownSid.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(sidType), 0)
|
||||||
|
isWellKnown = r0 != 0
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func FreeSid(sid *SID) (err error) {
|
func FreeSid(sid *SID) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall(procFreeSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
|
r1, _, e1 := syscall.Syscall(procFreeSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
|
||||||
if r1 != 0 {
|
if r1 != 0 {
|
||||||
|
@ -2717,6 +3037,30 @@ func EqualSid(sid1 *SID, sid2 *SID) (isEqual bool) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getSidIdentifierAuthority(sid *SID) (authority *SidIdentifierAuthority) {
|
||||||
|
r0, _, _ := syscall.Syscall(procGetSidIdentifierAuthority.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
|
||||||
|
authority = (*SidIdentifierAuthority)(unsafe.Pointer(r0))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func getSidSubAuthorityCount(sid *SID) (count *uint8) {
|
||||||
|
r0, _, _ := syscall.Syscall(procGetSidSubAuthorityCount.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
|
||||||
|
count = (*uint8)(unsafe.Pointer(r0))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func getSidSubAuthority(sid *SID, index uint32) (subAuthority *uint32) {
|
||||||
|
r0, _, _ := syscall.Syscall(procGetSidSubAuthority.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(index), 0)
|
||||||
|
subAuthority = (*uint32)(unsafe.Pointer(r0))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func isValidSid(sid *SID) (isValid bool) {
|
||||||
|
r0, _, _ := syscall.Syscall(procIsValidSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
|
||||||
|
isValid = r0 != 0
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) (err error) {
|
func checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall(procCheckTokenMembership.Addr(), 3, uintptr(tokenHandle), uintptr(unsafe.Pointer(sidToCheck)), uintptr(unsafe.Pointer(isMember)))
|
r1, _, e1 := syscall.Syscall(procCheckTokenMembership.Addr(), 3, uintptr(tokenHandle), uintptr(unsafe.Pointer(sidToCheck)), uintptr(unsafe.Pointer(isMember)))
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
|
@ -2729,8 +3073,8 @@ func checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) (
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func OpenProcessToken(h Handle, access uint32, token *Token) (err error) {
|
func OpenProcessToken(process Handle, access uint32, token *Token) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall(procOpenProcessToken.Addr(), 3, uintptr(h), uintptr(access), uintptr(unsafe.Pointer(token)))
|
r1, _, e1 := syscall.Syscall(procOpenProcessToken.Addr(), 3, uintptr(process), uintptr(access), uintptr(unsafe.Pointer(token)))
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
|
@ -2741,8 +3085,134 @@ func OpenProcessToken(h Handle, access uint32, token *Token) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetTokenInformation(t Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) {
|
func OpenThreadToken(thread Handle, access uint32, openAsSelf bool, token *Token) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall6(procGetTokenInformation.Addr(), 5, uintptr(t), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), uintptr(unsafe.Pointer(returnedLen)), 0)
|
var _p0 uint32
|
||||||
|
if openAsSelf {
|
||||||
|
_p0 = 1
|
||||||
|
} else {
|
||||||
|
_p0 = 0
|
||||||
|
}
|
||||||
|
r1, _, e1 := syscall.Syscall6(procOpenThreadToken.Addr(), 4, uintptr(thread), uintptr(access), uintptr(_p0), uintptr(unsafe.Pointer(token)), 0, 0)
|
||||||
|
if r1 == 0 {
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
} else {
|
||||||
|
err = syscall.EINVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func ImpersonateSelf(impersonationlevel uint32) (err error) {
|
||||||
|
r1, _, e1 := syscall.Syscall(procImpersonateSelf.Addr(), 1, uintptr(impersonationlevel), 0, 0)
|
||||||
|
if r1 == 0 {
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
} else {
|
||||||
|
err = syscall.EINVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func RevertToSelf() (err error) {
|
||||||
|
r1, _, e1 := syscall.Syscall(procRevertToSelf.Addr(), 0, 0, 0, 0)
|
||||||
|
if r1 == 0 {
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
} else {
|
||||||
|
err = syscall.EINVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetThreadToken(thread *Handle, token Token) (err error) {
|
||||||
|
r1, _, e1 := syscall.Syscall(procSetThreadToken.Addr(), 2, uintptr(unsafe.Pointer(thread)), uintptr(token), 0)
|
||||||
|
if r1 == 0 {
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
} else {
|
||||||
|
err = syscall.EINVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func LookupPrivilegeValue(systemname *uint16, name *uint16, luid *LUID) (err error) {
|
||||||
|
r1, _, e1 := syscall.Syscall(procLookupPrivilegeValueW.Addr(), 3, uintptr(unsafe.Pointer(systemname)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(luid)))
|
||||||
|
if r1 == 0 {
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
} else {
|
||||||
|
err = syscall.EINVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func AdjustTokenPrivileges(token Token, disableAllPrivileges bool, newstate *Tokenprivileges, buflen uint32, prevstate *Tokenprivileges, returnlen *uint32) (err error) {
|
||||||
|
var _p0 uint32
|
||||||
|
if disableAllPrivileges {
|
||||||
|
_p0 = 1
|
||||||
|
} else {
|
||||||
|
_p0 = 0
|
||||||
|
}
|
||||||
|
r1, _, e1 := syscall.Syscall6(procAdjustTokenPrivileges.Addr(), 6, uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen)))
|
||||||
|
if r1 == 0 {
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
} else {
|
||||||
|
err = syscall.EINVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func AdjustTokenGroups(token Token, resetToDefault bool, newstate *Tokengroups, buflen uint32, prevstate *Tokengroups, returnlen *uint32) (err error) {
|
||||||
|
var _p0 uint32
|
||||||
|
if resetToDefault {
|
||||||
|
_p0 = 1
|
||||||
|
} else {
|
||||||
|
_p0 = 0
|
||||||
|
}
|
||||||
|
r1, _, e1 := syscall.Syscall6(procAdjustTokenGroups.Addr(), 6, uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen)))
|
||||||
|
if r1 == 0 {
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
} else {
|
||||||
|
err = syscall.EINVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) {
|
||||||
|
r1, _, e1 := syscall.Syscall6(procGetTokenInformation.Addr(), 5, uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), uintptr(unsafe.Pointer(returnedLen)), 0)
|
||||||
|
if r1 == 0 {
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
} else {
|
||||||
|
err = syscall.EINVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32) (err error) {
|
||||||
|
r1, _, e1 := syscall.Syscall6(procSetTokenInformation.Addr(), 4, uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), 0, 0)
|
||||||
|
if r1 == 0 {
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
} else {
|
||||||
|
err = syscall.EINVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func DuplicateTokenEx(existingToken Token, desiredAccess uint32, tokenAttributes *SecurityAttributes, impersonationLevel uint32, tokenType uint32, newToken *Token) (err error) {
|
||||||
|
r1, _, e1 := syscall.Syscall6(procDuplicateTokenEx.Addr(), 6, uintptr(existingToken), uintptr(desiredAccess), uintptr(unsafe.Pointer(tokenAttributes)), uintptr(impersonationLevel), uintptr(tokenType), uintptr(unsafe.Pointer(newToken)))
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
|
@ -2777,3 +3247,32 @@ func getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) {
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func WTSQueryUserToken(session uint32, token *Token) (err error) {
|
||||||
|
r1, _, e1 := syscall.Syscall(procWTSQueryUserToken.Addr(), 2, uintptr(session), uintptr(unsafe.Pointer(token)), 0)
|
||||||
|
if r1 == 0 {
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
} else {
|
||||||
|
err = syscall.EINVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func WTSEnumerateSessions(handle Handle, reserved uint32, version uint32, sessions **WTS_SESSION_INFO, count *uint32) (err error) {
|
||||||
|
r1, _, e1 := syscall.Syscall6(procWTSEnumerateSessionsW.Addr(), 5, uintptr(handle), uintptr(reserved), uintptr(version), uintptr(unsafe.Pointer(sessions)), uintptr(unsafe.Pointer(count)), 0)
|
||||||
|
if r1 == 0 {
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
} else {
|
||||||
|
err = syscall.EINVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func WTSFreeMemory(ptr uintptr) {
|
||||||
|
syscall.Syscall(procWTSFreeMemory.Addr(), 1, uintptr(ptr), 0, 0)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ github.com/prometheus/procfs/internal/fs
|
||||||
github.com/prometheus/procfs/internal/util
|
github.com/prometheus/procfs/internal/util
|
||||||
# github.com/siebenmann/go-kstat v0.0.0-20160321171754-d34789b79745
|
# github.com/siebenmann/go-kstat v0.0.0-20160321171754-d34789b79745
|
||||||
github.com/siebenmann/go-kstat
|
github.com/siebenmann/go-kstat
|
||||||
# github.com/sirupsen/logrus v1.4.1
|
# github.com/sirupsen/logrus v1.4.2
|
||||||
github.com/sirupsen/logrus
|
github.com/sirupsen/logrus
|
||||||
# github.com/soundcloud/go-runit v0.0.0-20150630195641-06ad41a06c4a
|
# github.com/soundcloud/go-runit v0.0.0-20150630195641-06ad41a06c4a
|
||||||
github.com/soundcloud/go-runit/runit
|
github.com/soundcloud/go-runit/runit
|
||||||
|
@ -70,7 +70,7 @@ golang.org/x/net/internal/iana
|
||||||
golang.org/x/net/internal/socket
|
golang.org/x/net/internal/socket
|
||||||
# golang.org/x/sync v0.0.0-20190423024810-112230192c58
|
# golang.org/x/sync v0.0.0-20190423024810-112230192c58
|
||||||
golang.org/x/sync/errgroup
|
golang.org/x/sync/errgroup
|
||||||
# golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862
|
# golang.org/x/sys v0.0.0-20190610081024-1e42afee0f76
|
||||||
golang.org/x/sys/unix
|
golang.org/x/sys/unix
|
||||||
golang.org/x/sys/windows/svc/eventlog
|
golang.org/x/sys/windows/svc/eventlog
|
||||||
golang.org/x/sys/windows
|
golang.org/x/sys/windows
|
||||||
|
|
Loading…
Reference in New Issue