Skip to content
Snippets Groups Projects
Commit 6af0be59 authored by renovate's avatar renovate
Browse files

fix(deps): update module github.com/moby/sys/mountinfo to v0.7.0

parent 562c65ca
No related branches found
No related tags found
No related merge requests found
Pipeline #60600 passed
...@@ -5,7 +5,7 @@ go 1.15 ...@@ -5,7 +5,7 @@ go 1.15
require ( require (
github.com/golang/protobuf v1.3.2-0.20190409050943-e91709a02e0e // indirect github.com/golang/protobuf v1.3.2-0.20190409050943-e91709a02e0e // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/moby/sys/mountinfo v0.6.2 github.com/moby/sys/mountinfo v0.7.0
github.com/prometheus/client_golang v0.9.3-0.20190412003733-5a3ec6a883d3 github.com/prometheus/client_golang v0.9.3-0.20190412003733-5a3ec6a883d3
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 // indirect github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 // indirect
github.com/prometheus/common v0.3.0 // indirect github.com/prometheus/common v0.3.0 // indirect
......
...@@ -20,6 +20,8 @@ github.com/moby/sys/mountinfo v0.4.1 h1:1O+1cHA1aujwEwwVMa2Xm2l+gIpUHyd3+D+d7LZh ...@@ -20,6 +20,8 @@ github.com/moby/sys/mountinfo v0.4.1 h1:1O+1cHA1aujwEwwVMa2Xm2l+gIpUHyd3+D+d7LZh
github.com/moby/sys/mountinfo v0.4.1/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= github.com/moby/sys/mountinfo v0.4.1/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A=
github.com/moby/sys/mountinfo v0.6.2 h1:BzJjoreD5BMFNmD9Rus6gdd1pLuecOFPt8wC+Vygl78= github.com/moby/sys/mountinfo v0.6.2 h1:BzJjoreD5BMFNmD9Rus6gdd1pLuecOFPt8wC+Vygl78=
github.com/moby/sys/mountinfo v0.6.2/go.mod h1:IJb6JQeOklcdMU9F5xQ8ZALD+CUr5VlGpwtX+VE0rpI= github.com/moby/sys/mountinfo v0.6.2/go.mod h1:IJb6JQeOklcdMU9F5xQ8ZALD+CUr5VlGpwtX+VE0rpI=
github.com/moby/sys/mountinfo v0.7.0 h1:Az2+jtBShwcgfnlctd3z2Tjsawe7HcCyEyigNCHmXtE=
github.com/moby/sys/mountinfo v0.7.0/go.mod h1:IJb6JQeOklcdMU9F5xQ8ZALD+CUr5VlGpwtX+VE0rpI=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
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=
......
...@@ -5,15 +5,19 @@ import ( ...@@ -5,15 +5,19 @@ import (
"fmt" "fmt"
"io" "io"
"os" "os"
"runtime"
"strconv" "strconv"
"strings" "strings"
"sync"
"golang.org/x/sys/unix"
) )
// GetMountsFromReader retrieves a list of mounts from the // GetMountsFromReader retrieves a list of mounts from the
// reader provided, with an optional filter applied (use nil // reader provided, with an optional filter applied (use nil
// for no filter). This can be useful in tests or benchmarks // for no filter). This can be useful in tests or benchmarks
// that provide fake mountinfo data, or when a source other // that provide fake mountinfo data, or when a source other
// than /proc/self/mountinfo needs to be read from. // than /proc/thread-self/mountinfo needs to be read from.
// //
// This function is Linux-specific. // This function is Linux-specific.
func GetMountsFromReader(r io.Reader, filter FilterFunc) ([]*Info, error) { func GetMountsFromReader(r io.Reader, filter FilterFunc) ([]*Info, error) {
...@@ -127,8 +131,32 @@ func GetMountsFromReader(r io.Reader, filter FilterFunc) ([]*Info, error) { ...@@ -127,8 +131,32 @@ func GetMountsFromReader(r io.Reader, filter FilterFunc) ([]*Info, error) {
return out, nil return out, nil
} }
func parseMountTable(filter FilterFunc) ([]*Info, error) { var (
f, err := os.Open("/proc/self/mountinfo") haveProcThreadSelf bool
haveProcThreadSelfOnce sync.Once
)
func parseMountTable(filter FilterFunc) (_ []*Info, err error) {
haveProcThreadSelfOnce.Do(func() {
_, err := os.Stat("/proc/thread-self/mountinfo")
haveProcThreadSelf = err == nil
})
// We need to lock ourselves to the current OS thread in order to make sure
// that the thread referenced by /proc/thread-self stays alive until we
// finish parsing the file.
runtime.LockOSThread()
defer runtime.UnlockOSThread()
var f *os.File
if haveProcThreadSelf {
f, err = os.Open("/proc/thread-self/mountinfo")
} else {
// On pre-3.17 kernels (such as CentOS 7), we don't have
// /proc/thread-self/ so we need to manually construct
// /proc/self/task/<tid>/ as a fallback.
f, err = os.Open("/proc/self/task/" + strconv.Itoa(unix.Gettid()) + "/mountinfo")
}
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
...@@ -6,7 +6,7 @@ github.com/golang/protobuf/proto ...@@ -6,7 +6,7 @@ github.com/golang/protobuf/proto
# github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 # github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369
## explicit ## explicit
github.com/matttproud/golang_protobuf_extensions/pbutil github.com/matttproud/golang_protobuf_extensions/pbutil
# github.com/moby/sys/mountinfo v0.6.2 # github.com/moby/sys/mountinfo v0.7.0
## explicit ## explicit
github.com/moby/sys/mountinfo github.com/moby/sys/mountinfo
# github.com/prometheus/client_golang v0.9.3-0.20190412003733-5a3ec6a883d3 # github.com/prometheus/client_golang v0.9.3-0.20190412003733-5a3ec6a883d3
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment