mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
build(deps): bump golang.org/x/sys from 0.43.0 to 0.44.0
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.43.0 to 0.44.0. - [Commits](https://github.com/golang/sys/compare/v0.43.0...v0.44.0) --- updated-dependencies: - dependency-name: golang.org/x/sys dependency-version: 0.44.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
@@ -24,7 +24,7 @@ require (
|
|||||||
github.com/vishvananda/netlink v1.3.1
|
github.com/vishvananda/netlink v1.3.1
|
||||||
github.com/vishvananda/netns v0.0.5
|
github.com/vishvananda/netns v0.0.5
|
||||||
golang.org/x/net v0.53.0
|
golang.org/x/net v0.53.0
|
||||||
golang.org/x/sys v0.43.0
|
golang.org/x/sys v0.44.0
|
||||||
google.golang.org/protobuf v1.36.11
|
google.golang.org/protobuf v1.36.11
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -87,8 +87,8 @@ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|||||||
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI=
|
golang.org/x/sys v0.44.0 h1:ildZl3J4uzeKP07r2F++Op7E9B29JRUy+a27EibtBTQ=
|
||||||
golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
golang.org/x/sys v0.44.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
||||||
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
|
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
|
||||||
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
|
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
|||||||
+112
-16
@@ -13,11 +13,19 @@ import (
|
|||||||
|
|
||||||
const cpuSetSize = _CPU_SETSIZE / _NCPUBITS
|
const cpuSetSize = _CPU_SETSIZE / _NCPUBITS
|
||||||
|
|
||||||
// CPUSet represents a CPU affinity mask.
|
// CPUSet represents a bit mask of CPUs, to be used with [SchedGetaffinity], [SchedSetaffinity],
|
||||||
|
// and [SetMemPolicy].
|
||||||
|
//
|
||||||
|
// Note this type can only represent CPU IDs 0 through 1023.
|
||||||
|
// Use [CPUSetDynamic]/[NewCPUSet] instead to avoid this limit.
|
||||||
type CPUSet [cpuSetSize]cpuMask
|
type CPUSet [cpuSetSize]cpuMask
|
||||||
|
|
||||||
func schedAffinity(trap uintptr, pid int, set *CPUSet) error {
|
// CPUSetDynamic represents a bit mask of CPUs, to be used with [SchedGetaffinityDynamic],
|
||||||
_, _, e := RawSyscall(trap, uintptr(pid), uintptr(unsafe.Sizeof(*set)), uintptr(unsafe.Pointer(set)))
|
// [SchedSetaffinityDynamic], and [SetMemPolicyDynamic]. Use [NewCPUSet] to allocate.
|
||||||
|
type CPUSetDynamic []cpuMask
|
||||||
|
|
||||||
|
func schedAffinity(trap uintptr, pid int, size uintptr, ptr unsafe.Pointer) error {
|
||||||
|
_, _, e := RawSyscall(trap, uintptr(pid), uintptr(size), uintptr(ptr))
|
||||||
if e != 0 {
|
if e != 0 {
|
||||||
return errnoErr(e)
|
return errnoErr(e)
|
||||||
}
|
}
|
||||||
@@ -27,13 +35,13 @@ func schedAffinity(trap uintptr, pid int, set *CPUSet) error {
|
|||||||
// SchedGetaffinity gets the CPU affinity mask of the thread specified by pid.
|
// SchedGetaffinity gets the CPU affinity mask of the thread specified by pid.
|
||||||
// If pid is 0 the calling thread is used.
|
// If pid is 0 the calling thread is used.
|
||||||
func SchedGetaffinity(pid int, set *CPUSet) error {
|
func SchedGetaffinity(pid int, set *CPUSet) error {
|
||||||
return schedAffinity(SYS_SCHED_GETAFFINITY, pid, set)
|
return schedAffinity(SYS_SCHED_GETAFFINITY, pid, unsafe.Sizeof(*set), unsafe.Pointer(set))
|
||||||
}
|
}
|
||||||
|
|
||||||
// SchedSetaffinity sets the CPU affinity mask of the thread specified by pid.
|
// SchedSetaffinity sets the CPU affinity mask of the thread specified by pid.
|
||||||
// If pid is 0 the calling thread is used.
|
// If pid is 0 the calling thread is used.
|
||||||
func SchedSetaffinity(pid int, set *CPUSet) error {
|
func SchedSetaffinity(pid int, set *CPUSet) error {
|
||||||
return schedAffinity(SYS_SCHED_SETAFFINITY, pid, set)
|
return schedAffinity(SYS_SCHED_SETAFFINITY, pid, unsafe.Sizeof(*set), unsafe.Pointer(set))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Zero clears the set s, so that it contains no CPUs.
|
// Zero clears the set s, so that it contains no CPUs.
|
||||||
@@ -45,9 +53,7 @@ func (s *CPUSet) Zero() {
|
|||||||
// will silently ignore any invalid CPU bits in [CPUSet] so this is an
|
// will silently ignore any invalid CPU bits in [CPUSet] so this is an
|
||||||
// efficient way of resetting the CPU affinity of a process.
|
// efficient way of resetting the CPU affinity of a process.
|
||||||
func (s *CPUSet) Fill() {
|
func (s *CPUSet) Fill() {
|
||||||
for i := range s {
|
cpuMaskFill(s[:])
|
||||||
s[i] = ^cpuMask(0)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func cpuBitsIndex(cpu int) int {
|
func cpuBitsIndex(cpu int) int {
|
||||||
@@ -58,24 +64,27 @@ func cpuBitsMask(cpu int) cpuMask {
|
|||||||
return cpuMask(1 << (uint(cpu) % _NCPUBITS))
|
return cpuMask(1 << (uint(cpu) % _NCPUBITS))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set adds cpu to the set s.
|
func cpuMaskFill(s []cpuMask) {
|
||||||
func (s *CPUSet) Set(cpu int) {
|
for i := range s {
|
||||||
|
s[i] = ^cpuMask(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func cpuMaskSet(s []cpuMask, cpu int) {
|
||||||
i := cpuBitsIndex(cpu)
|
i := cpuBitsIndex(cpu)
|
||||||
if i < len(s) {
|
if i < len(s) {
|
||||||
s[i] |= cpuBitsMask(cpu)
|
s[i] |= cpuBitsMask(cpu)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear removes cpu from the set s.
|
func cpuMaskClear(s []cpuMask, cpu int) {
|
||||||
func (s *CPUSet) Clear(cpu int) {
|
|
||||||
i := cpuBitsIndex(cpu)
|
i := cpuBitsIndex(cpu)
|
||||||
if i < len(s) {
|
if i < len(s) {
|
||||||
s[i] &^= cpuBitsMask(cpu)
|
s[i] &^= cpuBitsMask(cpu)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsSet reports whether cpu is in the set s.
|
func cpuMaskIsSet(s []cpuMask, cpu int) bool {
|
||||||
func (s *CPUSet) IsSet(cpu int) bool {
|
|
||||||
i := cpuBitsIndex(cpu)
|
i := cpuBitsIndex(cpu)
|
||||||
if i < len(s) {
|
if i < len(s) {
|
||||||
return s[i]&cpuBitsMask(cpu) != 0
|
return s[i]&cpuBitsMask(cpu) != 0
|
||||||
@@ -83,11 +92,98 @@ func (s *CPUSet) IsSet(cpu int) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// Count returns the number of CPUs in the set s.
|
func cpuMaskCount(s []cpuMask) int {
|
||||||
func (s *CPUSet) Count() int {
|
|
||||||
c := 0
|
c := 0
|
||||||
for _, b := range s {
|
for _, b := range s {
|
||||||
c += bits.OnesCount64(uint64(b))
|
c += bits.OnesCount64(uint64(b))
|
||||||
}
|
}
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set adds cpu to the set s. If cpu is out of bounds for s, no action is taken.
|
||||||
|
func (s *CPUSet) Set(cpu int) {
|
||||||
|
cpuMaskSet(s[:], cpu)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear removes cpu from the set s. If cpu is out of bounds for s, no action is taken.
|
||||||
|
func (s *CPUSet) Clear(cpu int) {
|
||||||
|
cpuMaskClear(s[:], cpu)
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSet reports whether cpu is in the set s.
|
||||||
|
func (s *CPUSet) IsSet(cpu int) bool {
|
||||||
|
return cpuMaskIsSet(s[:], cpu)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Count returns the number of CPUs in the set s.
|
||||||
|
func (s *CPUSet) Count() int {
|
||||||
|
return cpuMaskCount(s[:])
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewCPUSet creates a CPU affinity mask capable of representing CPU IDs
|
||||||
|
// up to maxCPU (exclusive).
|
||||||
|
func NewCPUSet(maxCPU int) CPUSetDynamic {
|
||||||
|
numMasks := (maxCPU + _NCPUBITS - 1) / _NCPUBITS
|
||||||
|
if numMasks == 0 {
|
||||||
|
numMasks = 1
|
||||||
|
}
|
||||||
|
return make(CPUSetDynamic, numMasks)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Zero clears the set s, so that it contains no CPUs.
|
||||||
|
func (s CPUSetDynamic) Zero() {
|
||||||
|
clear(s)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fill adds all possible CPU bits to the set s. On Linux, [SchedSetaffinityDynamic]
|
||||||
|
// will silently ignore any invalid CPU bits in [CPUSetDynamic] so this is an
|
||||||
|
// efficient way of resetting the CPU affinity of a process.
|
||||||
|
func (s CPUSetDynamic) Fill() {
|
||||||
|
cpuMaskFill(s)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set adds cpu to the set s. If cpu is out of bounds for s, no action is taken.
|
||||||
|
func (s CPUSetDynamic) Set(cpu int) {
|
||||||
|
cpuMaskSet(s, cpu)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear removes cpu from the set s. If cpu is out of bounds for s, no action is taken.
|
||||||
|
func (s CPUSetDynamic) Clear(cpu int) {
|
||||||
|
cpuMaskClear(s, cpu)
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSet reports whether cpu is in the set s.
|
||||||
|
func (s CPUSetDynamic) IsSet(cpu int) bool {
|
||||||
|
return cpuMaskIsSet(s, cpu)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Count returns the number of CPUs in the set s.
|
||||||
|
func (s CPUSetDynamic) Count() int {
|
||||||
|
return cpuMaskCount(s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s CPUSetDynamic) size() uintptr {
|
||||||
|
return uintptr(len(s)) * unsafe.Sizeof(cpuMask(0))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s CPUSetDynamic) pointer() unsafe.Pointer {
|
||||||
|
if len(s) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return unsafe.Pointer(&s[0])
|
||||||
|
}
|
||||||
|
|
||||||
|
// SchedGetaffinityDynamic gets the CPU affinity mask of the thread specified by pid.
|
||||||
|
// If pid is 0 the calling thread is used.
|
||||||
|
//
|
||||||
|
// If the set is smaller than the size of the affinity mask used by the kernel,
|
||||||
|
// [EINVAL] is returned.
|
||||||
|
func SchedGetaffinityDynamic(pid int, set CPUSetDynamic) error {
|
||||||
|
return schedAffinity(SYS_SCHED_GETAFFINITY, pid, set.size(), set.pointer())
|
||||||
|
}
|
||||||
|
|
||||||
|
// SchedSetaffinityDynamic sets the CPU affinity mask of the thread specified by pid.
|
||||||
|
// If pid is 0 the calling thread is used.
|
||||||
|
func SchedSetaffinityDynamic(pid int, set CPUSetDynamic) error {
|
||||||
|
return schedAffinity(SYS_SCHED_SETAFFINITY, pid, set.size(), set.pointer())
|
||||||
|
}
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ if [[ "$GOOS" = "linux" ]]; then
|
|||||||
# Files generated through docker (use $cmd so you can Ctl-C the build or run)
|
# Files generated through docker (use $cmd so you can Ctl-C the build or run)
|
||||||
set -e
|
set -e
|
||||||
$cmd docker build --tag generate:$GOOS $GOOS
|
$cmd docker build --tag generate:$GOOS $GOOS
|
||||||
$cmd docker run --interactive --tty --volume $(cd -- "$(dirname -- "$0")/.." && pwd):/build generate:$GOOS
|
$cmd docker run --rm --interactive --tty --volume $(cd -- "$(dirname -- "$0")/.." && pwd):/build generate:$GOOS
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
+6
-2
@@ -2644,8 +2644,12 @@ func SchedGetAttr(pid int, flags uint) (*SchedAttr, error) {
|
|||||||
//sys Cachestat(fd uint, crange *CachestatRange, cstat *Cachestat_t, flags uint) (err error)
|
//sys Cachestat(fd uint, crange *CachestatRange, cstat *Cachestat_t, flags uint) (err error)
|
||||||
//sys Mseal(b []byte, flags uint) (err error)
|
//sys Mseal(b []byte, flags uint) (err error)
|
||||||
|
|
||||||
//sys setMemPolicy(mode int, mask *CPUSet, size int) (err error) = SYS_SET_MEMPOLICY
|
//sys setMemPolicy(mode int, mask unsafe.Pointer, size uintptr) (err error) = SYS_SET_MEMPOLICY
|
||||||
|
|
||||||
func SetMemPolicy(mode int, mask *CPUSet) error {
|
func SetMemPolicy(mode int, mask *CPUSet) error {
|
||||||
return setMemPolicy(mode, mask, _CPU_SETSIZE)
|
return setMemPolicy(mode, unsafe.Pointer(mask), _CPU_SETSIZE)
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetMemPolicyDynamic(mode int, mask CPUSetDynamic) error {
|
||||||
|
return setMemPolicy(mode, mask.pointer(), mask.size())
|
||||||
}
|
}
|
||||||
|
|||||||
+3
@@ -82,6 +82,9 @@ func Time(t *Time_t) (Time_t, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Utime(path string, buf *Utimbuf) error {
|
func Utime(path string, buf *Utimbuf) error {
|
||||||
|
if buf == nil {
|
||||||
|
return Utimes(path, nil)
|
||||||
|
}
|
||||||
tv := []Timeval{
|
tv := []Timeval{
|
||||||
{Sec: buf.Actime},
|
{Sec: buf.Actime},
|
||||||
{Sec: buf.Modtime},
|
{Sec: buf.Modtime},
|
||||||
|
|||||||
+3
@@ -113,6 +113,9 @@ func Time(t *Time_t) (Time_t, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Utime(path string, buf *Utimbuf) error {
|
func Utime(path string, buf *Utimbuf) error {
|
||||||
|
if buf == nil {
|
||||||
|
return Utimes(path, nil)
|
||||||
|
}
|
||||||
tv := []Timeval{
|
tv := []Timeval{
|
||||||
{Sec: buf.Actime},
|
{Sec: buf.Actime},
|
||||||
{Sec: buf.Modtime},
|
{Sec: buf.Modtime},
|
||||||
|
|||||||
+3
@@ -150,6 +150,9 @@ func Time(t *Time_t) (Time_t, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Utime(path string, buf *Utimbuf) error {
|
func Utime(path string, buf *Utimbuf) error {
|
||||||
|
if buf == nil {
|
||||||
|
return Utimes(path, nil)
|
||||||
|
}
|
||||||
tv := []Timeval{
|
tv := []Timeval{
|
||||||
{Sec: buf.Actime},
|
{Sec: buf.Actime},
|
||||||
{Sec: buf.Modtime},
|
{Sec: buf.Modtime},
|
||||||
|
|||||||
+3
@@ -112,6 +112,9 @@ func Time(t *Time_t) (Time_t, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Utime(path string, buf *Utimbuf) error {
|
func Utime(path string, buf *Utimbuf) error {
|
||||||
|
if buf == nil {
|
||||||
|
return Utimes(path, nil)
|
||||||
|
}
|
||||||
tv := []Timeval{
|
tv := []Timeval{
|
||||||
{Sec: buf.Actime},
|
{Sec: buf.Actime},
|
||||||
{Sec: buf.Modtime},
|
{Sec: buf.Modtime},
|
||||||
|
|||||||
+2
-2
@@ -2241,8 +2241,8 @@ func Mseal(b []byte, flags uint) (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 setMemPolicy(mode int, mask *CPUSet, size int) (err error) {
|
func setMemPolicy(mode int, mask unsafe.Pointer, size uintptr) (err error) {
|
||||||
_, _, e1 := Syscall(SYS_SET_MEMPOLICY, uintptr(mode), uintptr(unsafe.Pointer(mask)), uintptr(size))
|
_, _, e1 := Syscall(SYS_SET_MEMPOLICY, uintptr(mode), uintptr(mask), uintptr(size))
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-3
@@ -892,9 +892,13 @@ const socket_error = uintptr(^uint32(0))
|
|||||||
//sys MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) = kernel32.MultiByteToWideChar
|
//sys MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) = kernel32.MultiByteToWideChar
|
||||||
//sys getBestInterfaceEx(sockaddr unsafe.Pointer, pdwBestIfIndex *uint32) (errcode error) = iphlpapi.GetBestInterfaceEx
|
//sys getBestInterfaceEx(sockaddr unsafe.Pointer, pdwBestIfIndex *uint32) (errcode error) = iphlpapi.GetBestInterfaceEx
|
||||||
//sys GetIfEntry2Ex(level uint32, row *MibIfRow2) (errcode error) = iphlpapi.GetIfEntry2Ex
|
//sys GetIfEntry2Ex(level uint32, row *MibIfRow2) (errcode error) = iphlpapi.GetIfEntry2Ex
|
||||||
|
//sys GetIfTable2Ex(level uint32, table **MibIfTable2) (errcode error) = iphlpapi.GetIfTable2Ex
|
||||||
//sys GetIpForwardEntry2(row *MibIpForwardRow2) (errcode error) = iphlpapi.GetIpForwardEntry2
|
//sys GetIpForwardEntry2(row *MibIpForwardRow2) (errcode error) = iphlpapi.GetIpForwardEntry2
|
||||||
//sys GetIpForwardTable2(family uint16, table **MibIpForwardTable2) (errcode error) = iphlpapi.GetIpForwardTable2
|
//sys GetIpForwardTable2(family uint16, table **MibIpForwardTable2) (errcode error) = iphlpapi.GetIpForwardTable2
|
||||||
|
//sys GetIpInterfaceEntry(row *MibIpInterfaceRow) (errcode error) = iphlpapi.GetIpInterfaceEntry
|
||||||
|
//sys GetIpInterfaceTable(family uint16, table **MibIpInterfaceTable) (errcode error) = iphlpapi.GetIpInterfaceTable
|
||||||
//sys GetUnicastIpAddressEntry(row *MibUnicastIpAddressRow) (errcode error) = iphlpapi.GetUnicastIpAddressEntry
|
//sys GetUnicastIpAddressEntry(row *MibUnicastIpAddressRow) (errcode error) = iphlpapi.GetUnicastIpAddressEntry
|
||||||
|
//sys GetUnicastIpAddressTable(family uint16, table **MibUnicastIpAddressTable) (errcode error) = iphlpapi.GetUnicastIpAddressTable
|
||||||
//sys FreeMibTable(memory unsafe.Pointer) = iphlpapi.FreeMibTable
|
//sys FreeMibTable(memory unsafe.Pointer) = iphlpapi.FreeMibTable
|
||||||
//sys NotifyIpInterfaceChange(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) = iphlpapi.NotifyIpInterfaceChange
|
//sys NotifyIpInterfaceChange(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) = iphlpapi.NotifyIpInterfaceChange
|
||||||
//sys NotifyRouteChange2(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) = iphlpapi.NotifyRouteChange2
|
//sys NotifyRouteChange2(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) = iphlpapi.NotifyRouteChange2
|
||||||
@@ -1693,10 +1697,13 @@ func NewNTUnicodeString(s string) (*NTUnicodeString, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
n := uint16(len(s16) * 2)
|
n := len(s16) * 2
|
||||||
|
if n > (1<<16)-1 {
|
||||||
|
return nil, syscall.EINVAL
|
||||||
|
}
|
||||||
return &NTUnicodeString{
|
return &NTUnicodeString{
|
||||||
Length: n - 2, // subtract 2 bytes for the NULL terminator
|
Length: uint16(n) - 2, // subtract 2 bytes for the NULL terminator
|
||||||
MaximumLength: n,
|
MaximumLength: uint16(n),
|
||||||
Buffer: &s16[0],
|
Buffer: &s16[0],
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|||||||
+29
@@ -2320,6 +2320,21 @@ type MibIfRow2 struct {
|
|||||||
OutQLen uint64
|
OutQLen uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MIB_IF_TABLE_LEVEL enumeration from netioapi.h or
|
||||||
|
// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ne-netioapi-mib_if_table_level.
|
||||||
|
const (
|
||||||
|
MibIfTableNormal = 0
|
||||||
|
MibIfTableRaw = 1
|
||||||
|
MibIfTableNormalWithoutStatistics = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
// MibIfTable2 contains a table of logical and physical interface entries. See
|
||||||
|
// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_if_table2.
|
||||||
|
type MibIfTable2 struct {
|
||||||
|
NumEntries uint32
|
||||||
|
Table [1]MibIfRow2
|
||||||
|
}
|
||||||
|
|
||||||
// IP_ADDRESS_PREFIX stores an IP address prefix. See
|
// IP_ADDRESS_PREFIX stores an IP address prefix. See
|
||||||
// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-ip_address_prefix.
|
// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-ip_address_prefix.
|
||||||
type IpAddressPrefix struct {
|
type IpAddressPrefix struct {
|
||||||
@@ -2413,6 +2428,13 @@ type MibUnicastIpAddressRow struct {
|
|||||||
CreationTimeStamp Filetime
|
CreationTimeStamp Filetime
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MibUnicastIpAddressTable contains a table of unicast IP address entries. See
|
||||||
|
// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_unicastipaddress_table.
|
||||||
|
type MibUnicastIpAddressTable struct {
|
||||||
|
NumEntries uint32
|
||||||
|
Table [1]MibUnicastIpAddressRow
|
||||||
|
}
|
||||||
|
|
||||||
const ScopeLevelCount = 16
|
const ScopeLevelCount = 16
|
||||||
|
|
||||||
// MIB_IPINTERFACE_ROW stores interface management information for a particular IP address family on a network interface.
|
// MIB_IPINTERFACE_ROW stores interface management information for a particular IP address family on a network interface.
|
||||||
@@ -2455,6 +2477,13 @@ type MibIpInterfaceRow struct {
|
|||||||
DisableDefaultRoutes uint8
|
DisableDefaultRoutes uint8
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MibIpInterfaceTable contains a table of IP interface entries. See
|
||||||
|
// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_ipinterface_table.
|
||||||
|
type MibIpInterfaceTable struct {
|
||||||
|
NumEntries uint32
|
||||||
|
Table [1]MibIpInterfaceRow
|
||||||
|
}
|
||||||
|
|
||||||
// Console related constants used for the mode parameter to SetConsoleMode. See
|
// Console related constants used for the mode parameter to SetConsoleMode. See
|
||||||
// https://docs.microsoft.com/en-us/windows/console/setconsolemode for details.
|
// https://docs.microsoft.com/en-us/windows/console/setconsolemode for details.
|
||||||
|
|
||||||
|
|||||||
+36
@@ -188,9 +188,13 @@ var (
|
|||||||
procGetBestInterfaceEx = modiphlpapi.NewProc("GetBestInterfaceEx")
|
procGetBestInterfaceEx = modiphlpapi.NewProc("GetBestInterfaceEx")
|
||||||
procGetIfEntry = modiphlpapi.NewProc("GetIfEntry")
|
procGetIfEntry = modiphlpapi.NewProc("GetIfEntry")
|
||||||
procGetIfEntry2Ex = modiphlpapi.NewProc("GetIfEntry2Ex")
|
procGetIfEntry2Ex = modiphlpapi.NewProc("GetIfEntry2Ex")
|
||||||
|
procGetIfTable2Ex = modiphlpapi.NewProc("GetIfTable2Ex")
|
||||||
procGetIpForwardEntry2 = modiphlpapi.NewProc("GetIpForwardEntry2")
|
procGetIpForwardEntry2 = modiphlpapi.NewProc("GetIpForwardEntry2")
|
||||||
procGetIpForwardTable2 = modiphlpapi.NewProc("GetIpForwardTable2")
|
procGetIpForwardTable2 = modiphlpapi.NewProc("GetIpForwardTable2")
|
||||||
|
procGetIpInterfaceEntry = modiphlpapi.NewProc("GetIpInterfaceEntry")
|
||||||
|
procGetIpInterfaceTable = modiphlpapi.NewProc("GetIpInterfaceTable")
|
||||||
procGetUnicastIpAddressEntry = modiphlpapi.NewProc("GetUnicastIpAddressEntry")
|
procGetUnicastIpAddressEntry = modiphlpapi.NewProc("GetUnicastIpAddressEntry")
|
||||||
|
procGetUnicastIpAddressTable = modiphlpapi.NewProc("GetUnicastIpAddressTable")
|
||||||
procNotifyIpInterfaceChange = modiphlpapi.NewProc("NotifyIpInterfaceChange")
|
procNotifyIpInterfaceChange = modiphlpapi.NewProc("NotifyIpInterfaceChange")
|
||||||
procNotifyRouteChange2 = modiphlpapi.NewProc("NotifyRouteChange2")
|
procNotifyRouteChange2 = modiphlpapi.NewProc("NotifyRouteChange2")
|
||||||
procNotifyUnicastIpAddressChange = modiphlpapi.NewProc("NotifyUnicastIpAddressChange")
|
procNotifyUnicastIpAddressChange = modiphlpapi.NewProc("NotifyUnicastIpAddressChange")
|
||||||
@@ -1674,6 +1678,14 @@ func GetIfEntry2Ex(level uint32, row *MibIfRow2) (errcode error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetIfTable2Ex(level uint32, table **MibIfTable2) (errcode error) {
|
||||||
|
r0, _, _ := syscall.SyscallN(procGetIfTable2Ex.Addr(), uintptr(level), uintptr(unsafe.Pointer(table)))
|
||||||
|
if r0 != 0 {
|
||||||
|
errcode = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func GetIpForwardEntry2(row *MibIpForwardRow2) (errcode error) {
|
func GetIpForwardEntry2(row *MibIpForwardRow2) (errcode error) {
|
||||||
r0, _, _ := syscall.SyscallN(procGetIpForwardEntry2.Addr(), uintptr(unsafe.Pointer(row)))
|
r0, _, _ := syscall.SyscallN(procGetIpForwardEntry2.Addr(), uintptr(unsafe.Pointer(row)))
|
||||||
if r0 != 0 {
|
if r0 != 0 {
|
||||||
@@ -1690,6 +1702,22 @@ func GetIpForwardTable2(family uint16, table **MibIpForwardTable2) (errcode erro
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetIpInterfaceEntry(row *MibIpInterfaceRow) (errcode error) {
|
||||||
|
r0, _, _ := syscall.SyscallN(procGetIpInterfaceEntry.Addr(), uintptr(unsafe.Pointer(row)))
|
||||||
|
if r0 != 0 {
|
||||||
|
errcode = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetIpInterfaceTable(family uint16, table **MibIpInterfaceTable) (errcode error) {
|
||||||
|
r0, _, _ := syscall.SyscallN(procGetIpInterfaceTable.Addr(), uintptr(family), uintptr(unsafe.Pointer(table)))
|
||||||
|
if r0 != 0 {
|
||||||
|
errcode = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func GetUnicastIpAddressEntry(row *MibUnicastIpAddressRow) (errcode error) {
|
func GetUnicastIpAddressEntry(row *MibUnicastIpAddressRow) (errcode error) {
|
||||||
r0, _, _ := syscall.SyscallN(procGetUnicastIpAddressEntry.Addr(), uintptr(unsafe.Pointer(row)))
|
r0, _, _ := syscall.SyscallN(procGetUnicastIpAddressEntry.Addr(), uintptr(unsafe.Pointer(row)))
|
||||||
if r0 != 0 {
|
if r0 != 0 {
|
||||||
@@ -1698,6 +1726,14 @@ func GetUnicastIpAddressEntry(row *MibUnicastIpAddressRow) (errcode error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetUnicastIpAddressTable(family uint16, table **MibUnicastIpAddressTable) (errcode error) {
|
||||||
|
r0, _, _ := syscall.SyscallN(procGetUnicastIpAddressTable.Addr(), uintptr(family), uintptr(unsafe.Pointer(table)))
|
||||||
|
if r0 != 0 {
|
||||||
|
errcode = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func NotifyIpInterfaceChange(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) {
|
func NotifyIpInterfaceChange(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) {
|
||||||
var _p0 uint32
|
var _p0 uint32
|
||||||
if initialNotification {
|
if initialNotification {
|
||||||
|
|||||||
Vendored
+1
-1
@@ -113,7 +113,7 @@ github.com/vishvananda/netns
|
|||||||
# golang.org/x/net v0.53.0
|
# golang.org/x/net v0.53.0
|
||||||
## explicit; go 1.25.0
|
## explicit; go 1.25.0
|
||||||
golang.org/x/net/bpf
|
golang.org/x/net/bpf
|
||||||
# golang.org/x/sys v0.43.0
|
# golang.org/x/sys v0.44.0
|
||||||
## explicit; go 1.25.0
|
## explicit; go 1.25.0
|
||||||
golang.org/x/sys/unix
|
golang.org/x/sys/unix
|
||||||
golang.org/x/sys/windows
|
golang.org/x/sys/windows
|
||||||
|
|||||||
Reference in New Issue
Block a user