mirror of
https://github.com/prometheus/alertmanager
synced 2025-03-02 17:57:31 +00:00
Update x/sys and x/net modules to support Risc-V (#1984)
* Update x/sys and x/net modules to support Risc-V Signed-off-by: CarlosEDP <me@carlosedp.com> * Remove go directive from go.mod Signed-off-by: Simon Pasquier <spasquie@redhat.com>
This commit is contained in:
parent
d517f786ef
commit
f21c04b6b1
1
go.mod
1
go.mod
@ -30,6 +30,7 @@ require (
|
||||
github.com/stretchr/testify v1.3.0
|
||||
github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6
|
||||
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80
|
||||
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456 // indirect
|
||||
golang.org/x/tools v0.0.0-20190813034749-528a2984e271
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6
|
||||
gopkg.in/yaml.v2 v2.2.2
|
||||
|
2
go.sum
2
go.sum
@ -508,6 +508,8 @@ golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3 h1:4y9KwBHBgBNwDbtu44R5o1fdO
|
||||
golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ=
|
||||
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456 h1:ng0gs1AKnRRuEMZoTLLlbOd+C17zUDepwGQBb/n+JVg=
|
||||
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180805044716-cb6730876b98 h1:Cf5h/jCzhiiL0W8VrlJhOm+8+YYZPMHXcHsruWXnD40=
|
||||
|
42
vendor/golang.org/x/sys/windows/security_windows.go
generated
vendored
42
vendor/golang.org/x/sys/windows/security_windows.go
generated
vendored
@ -644,6 +644,8 @@ func (tml *Tokenmandatorylabel) Size() uint32 {
|
||||
//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 getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) = kernel32.GetSystemDirectoryW
|
||||
//sys getWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) = kernel32.GetWindowsDirectoryW
|
||||
//sys getSystemWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) = kernel32.GetSystemWindowsDirectoryW
|
||||
|
||||
// An access token contains the security information for a logon session.
|
||||
// The system creates an access token when a user logs on, and every
|
||||
@ -785,8 +787,8 @@ func (token Token) GetLinkedToken() (Token, error) {
|
||||
return linkedToken, nil
|
||||
}
|
||||
|
||||
// GetSystemDirectory retrieves path to current location of the system
|
||||
// directory, which is typically, though not always, C:\Windows\System32.
|
||||
// GetSystemDirectory retrieves the path to current location of the system
|
||||
// directory, which is typically, though not always, `C:\Windows\System32`.
|
||||
func GetSystemDirectory() (string, error) {
|
||||
n := uint32(MAX_PATH)
|
||||
for {
|
||||
@ -802,6 +804,42 @@ func GetSystemDirectory() (string, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// GetWindowsDirectory retrieves the path to current location of the Windows
|
||||
// directory, which is typically, though not always, `C:\Windows`. This may
|
||||
// be a private user directory in the case that the application is running
|
||||
// under a terminal server.
|
||||
func GetWindowsDirectory() (string, error) {
|
||||
n := uint32(MAX_PATH)
|
||||
for {
|
||||
b := make([]uint16, n)
|
||||
l, e := getWindowsDirectory(&b[0], n)
|
||||
if e != nil {
|
||||
return "", e
|
||||
}
|
||||
if l <= n {
|
||||
return UTF16ToString(b[:l]), nil
|
||||
}
|
||||
n = l
|
||||
}
|
||||
}
|
||||
|
||||
// GetSystemWindowsDirectory retrieves the path to current location of the
|
||||
// Windows directory, which is typically, though not always, `C:\Windows`.
|
||||
func GetSystemWindowsDirectory() (string, error) {
|
||||
n := uint32(MAX_PATH)
|
||||
for {
|
||||
b := make([]uint16, n)
|
||||
l, e := getSystemWindowsDirectory(&b[0], n)
|
||||
if e != nil {
|
||||
return "", e
|
||||
}
|
||||
if l <= n {
|
||||
return UTF16ToString(b[:l]), nil
|
||||
}
|
||||
n = l
|
||||
}
|
||||
}
|
||||
|
||||
// IsMember reports whether the access token t is a member of the provided SID.
|
||||
func (t Token) IsMember(sid *SID) (bool, error) {
|
||||
var b int32
|
||||
|
14
vendor/golang.org/x/sys/windows/syscall_windows.go
generated
vendored
14
vendor/golang.org/x/sys/windows/syscall_windows.go
generated
vendored
@ -269,6 +269,7 @@ func NewCallbackCDecl(fn interface{}) uintptr {
|
||||
//sys GenerateConsoleCtrlEvent(ctrlEvent uint32, processGroupID uint32) (err error)
|
||||
//sys GetProcessId(process Handle) (id uint32, err error)
|
||||
//sys OpenThread(desiredAccess uint32, inheritHandle bool, threadId uint32) (handle Handle, err error)
|
||||
//sys SetProcessPriorityBoost(process Handle, disable bool) (err error) = kernel32.SetProcessPriorityBoost
|
||||
|
||||
// Volume Management Functions
|
||||
//sys DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) = DefineDosDeviceW
|
||||
@ -296,6 +297,7 @@ func NewCallbackCDecl(fn interface{}) uintptr {
|
||||
//sys coCreateGuid(pguid *GUID) (ret error) = ole32.CoCreateGuid
|
||||
//sys CoTaskMemFree(address unsafe.Pointer) = ole32.CoTaskMemFree
|
||||
//sys rtlGetVersion(info *OsVersionInfoEx) (ret error) = ntdll.RtlGetVersion
|
||||
//sys rtlGetNtVersionNumbers(majorVersion *uint32, minorVersion *uint32, buildNumber *uint32) = ntdll.RtlGetNtVersionNumbers
|
||||
|
||||
// syscall interface implementation for other packages
|
||||
|
||||
@ -1306,8 +1308,8 @@ func (t Token) KnownFolderPath(folderID *KNOWNFOLDERID, flags uint32) (string, e
|
||||
return UTF16ToString((*[(1 << 30) - 1]uint16)(unsafe.Pointer(p))[:]), nil
|
||||
}
|
||||
|
||||
// RtlGetVersion returns the true version of the underlying operating system, ignoring
|
||||
// any manifesting or compatibility layers on top of the win32 layer.
|
||||
// RtlGetVersion returns the version of the underlying operating system, ignoring
|
||||
// manifest semantics but is affected by the application compatibility layer.
|
||||
func RtlGetVersion() *OsVersionInfoEx {
|
||||
info := &OsVersionInfoEx{}
|
||||
info.osVersionInfoSize = uint32(unsafe.Sizeof(*info))
|
||||
@ -1318,3 +1320,11 @@ func RtlGetVersion() *OsVersionInfoEx {
|
||||
_ = rtlGetVersion(info)
|
||||
return info
|
||||
}
|
||||
|
||||
// RtlGetNtVersionNumbers returns the version of the underlying operating system,
|
||||
// ignoring manifest semantics and the application compatibility layer.
|
||||
func RtlGetNtVersionNumbers() (majorVersion, minorVersion, buildNumber uint32) {
|
||||
rtlGetNtVersionNumbers(&majorVersion, &minorVersion, &buildNumber)
|
||||
buildNumber &= 0xffff
|
||||
return
|
||||
}
|
||||
|
53
vendor/golang.org/x/sys/windows/zsyscall_windows.go
generated
vendored
53
vendor/golang.org/x/sys/windows/zsyscall_windows.go
generated
vendored
@ -209,6 +209,7 @@ var (
|
||||
procGenerateConsoleCtrlEvent = modkernel32.NewProc("GenerateConsoleCtrlEvent")
|
||||
procGetProcessId = modkernel32.NewProc("GetProcessId")
|
||||
procOpenThread = modkernel32.NewProc("OpenThread")
|
||||
procSetProcessPriorityBoost = modkernel32.NewProc("SetProcessPriorityBoost")
|
||||
procDefineDosDeviceW = modkernel32.NewProc("DefineDosDeviceW")
|
||||
procDeleteVolumeMountPointW = modkernel32.NewProc("DeleteVolumeMountPointW")
|
||||
procFindFirstVolumeW = modkernel32.NewProc("FindFirstVolumeW")
|
||||
@ -234,6 +235,7 @@ var (
|
||||
procCoCreateGuid = modole32.NewProc("CoCreateGuid")
|
||||
procCoTaskMemFree = modole32.NewProc("CoTaskMemFree")
|
||||
procRtlGetVersion = modntdll.NewProc("RtlGetVersion")
|
||||
procRtlGetNtVersionNumbers = modntdll.NewProc("RtlGetNtVersionNumbers")
|
||||
procWSAStartup = modws2_32.NewProc("WSAStartup")
|
||||
procWSACleanup = modws2_32.NewProc("WSACleanup")
|
||||
procWSAIoctl = modws2_32.NewProc("WSAIoctl")
|
||||
@ -303,6 +305,8 @@ var (
|
||||
procDuplicateTokenEx = modadvapi32.NewProc("DuplicateTokenEx")
|
||||
procGetUserProfileDirectoryW = moduserenv.NewProc("GetUserProfileDirectoryW")
|
||||
procGetSystemDirectoryW = modkernel32.NewProc("GetSystemDirectoryW")
|
||||
procGetWindowsDirectoryW = modkernel32.NewProc("GetWindowsDirectoryW")
|
||||
procGetSystemWindowsDirectoryW = modkernel32.NewProc("GetSystemWindowsDirectoryW")
|
||||
procWTSQueryUserToken = modwtsapi32.NewProc("WTSQueryUserToken")
|
||||
procWTSEnumerateSessionsW = modwtsapi32.NewProc("WTSEnumerateSessionsW")
|
||||
procWTSFreeMemory = modwtsapi32.NewProc("WTSFreeMemory")
|
||||
@ -2255,6 +2259,24 @@ func OpenThread(desiredAccess uint32, inheritHandle bool, threadId uint32) (hand
|
||||
return
|
||||
}
|
||||
|
||||
func SetProcessPriorityBoost(process Handle, disable bool) (err error) {
|
||||
var _p0 uint32
|
||||
if disable {
|
||||
_p0 = 1
|
||||
} else {
|
||||
_p0 = 0
|
||||
}
|
||||
r1, _, e1 := syscall.Syscall(procSetProcessPriorityBoost.Addr(), 2, uintptr(process), uintptr(_p0), 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) {
|
||||
r1, _, e1 := syscall.Syscall(procDefineDosDeviceW.Addr(), 3, uintptr(flags), uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)))
|
||||
if r1 == 0 {
|
||||
@ -2530,6 +2552,11 @@ func rtlGetVersion(info *OsVersionInfoEx) (ret error) {
|
||||
return
|
||||
}
|
||||
|
||||
func rtlGetNtVersionNumbers(majorVersion *uint32, minorVersion *uint32, buildNumber *uint32) {
|
||||
syscall.Syscall(procRtlGetNtVersionNumbers.Addr(), 3, uintptr(unsafe.Pointer(majorVersion)), uintptr(unsafe.Pointer(minorVersion)), uintptr(unsafe.Pointer(buildNumber)))
|
||||
return
|
||||
}
|
||||
|
||||
func WSAStartup(verreq uint32, data *WSAData) (sockerr error) {
|
||||
r0, _, _ := syscall.Syscall(procWSAStartup.Addr(), 2, uintptr(verreq), uintptr(unsafe.Pointer(data)), 0)
|
||||
if r0 != 0 {
|
||||
@ -3307,6 +3334,32 @@ func getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func getWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) {
|
||||
r0, _, e1 := syscall.Syscall(procGetWindowsDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0)
|
||||
len = uint32(r0)
|
||||
if len == 0 {
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
} else {
|
||||
err = syscall.EINVAL
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func getSystemWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) {
|
||||
r0, _, e1 := syscall.Syscall(procGetSystemWindowsDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0)
|
||||
len = uint32(r0)
|
||||
if len == 0 {
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
} else {
|
||||
err = syscall.EINVAL
|
||||
}
|
||||
}
|
||||
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 {
|
||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -193,7 +193,7 @@ golang.org/x/net/bpf
|
||||
golang.org/x/net/internal/iana
|
||||
golang.org/x/net/internal/socket
|
||||
golang.org/x/net/internal/timeseries
|
||||
# golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a
|
||||
# golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456
|
||||
golang.org/x/sys/windows
|
||||
golang.org/x/sys/unix
|
||||
# golang.org/x/text v0.3.2
|
||||
|
Loading…
Reference in New Issue
Block a user