Update vendoring (#1105)
* Update vendor github.com/sirupsen/logrus@v1.1.1 * Update vendor github.com/coreos/go-systemd/dbus@v17 * Update vendor github.com/golang/protobuf/proto@v1.2.0 * Update vendor github.com/konsorten/go-windows-terminal-sequences@v1.0.1 * Update vendor github.com/mdlayher/... * Update vendor github.com/prometheus/procfs/... * Update vendor golang.org/x/... Signed-off-by: Ben Kochie <superq@gmail.com>
This commit is contained in:
parent
f0d2a06b11
commit
9cf508e673
279 changed files with 54502 additions and 15108 deletions
27
vendor/github.com/mdlayher/netlink/netns_linux.go
generated
vendored
Normal file
27
vendor/github.com/mdlayher/netlink/netns_linux.go
generated
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
//+build linux
|
||||
|
||||
package netlink
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
// getThreadNetNS gets the network namespace file descriptor of the thread the current goroutine
|
||||
// is running on. Make sure to call runtime.LockOSThread() before this so the goroutine does not
|
||||
// get scheduled on another thread in the meantime.
|
||||
func getThreadNetNS() (int, error) {
|
||||
file, err := os.Open(fmt.Sprintf("/proc/%d/task/%d/ns/net", unix.Getpid(), unix.Gettid()))
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
return int(file.Fd()), nil
|
||||
}
|
||||
|
||||
// setThreadNetNS sets the network namespace of the thread of the current goroutine to
|
||||
// the namespace described by the user-provided file descriptor.
|
||||
func setThreadNetNS(fd int) error {
|
||||
return unix.Setns(fd, unix.CLONE_NEWNET)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue