mirror of
https://github.com/mudler/luet.git
synced 2025-09-05 01:00:44 +00:00
update vendor
This commit is contained in:
27
vendor/github.com/prometheus/procfs/proc.go
generated
vendored
27
vendor/github.com/prometheus/procfs/proc.go
generated
vendored
@@ -105,7 +105,7 @@ func (fs FS) AllProcs() (Procs, error) {
|
||||
|
||||
names, err := d.Readdirnames(-1)
|
||||
if err != nil {
|
||||
return Procs{}, fmt.Errorf("could not read %s: %s", d.Name(), err)
|
||||
return Procs{}, fmt.Errorf("could not read %q: %w", d.Name(), err)
|
||||
}
|
||||
|
||||
p := Procs{}
|
||||
@@ -134,6 +134,27 @@ func (p Proc) CmdLine() ([]string, error) {
|
||||
return strings.Split(string(bytes.TrimRight(data, string("\x00"))), string(byte(0))), nil
|
||||
}
|
||||
|
||||
// Wchan returns the wchan (wait channel) of a process.
|
||||
func (p Proc) Wchan() (string, error) {
|
||||
f, err := os.Open(p.path("wchan"))
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
data, err := ioutil.ReadAll(f)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
wchan := string(data)
|
||||
if wchan == "" || wchan == "0" {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
return wchan, nil
|
||||
}
|
||||
|
||||
// Comm returns the command name of a process.
|
||||
func (p Proc) Comm() (string, error) {
|
||||
data, err := util.ReadFileNoStat(p.path("comm"))
|
||||
@@ -185,7 +206,7 @@ func (p Proc) FileDescriptors() ([]uintptr, error) {
|
||||
for i, n := range names {
|
||||
fd, err := strconv.ParseInt(n, 10, 32)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not parse fd %s: %s", n, err)
|
||||
return nil, fmt.Errorf("could not parse fd %q: %w", n, err)
|
||||
}
|
||||
fds[i] = uintptr(fd)
|
||||
}
|
||||
@@ -257,7 +278,7 @@ func (p Proc) fileDescriptors() ([]string, error) {
|
||||
|
||||
names, err := d.Readdirnames(-1)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not read %s: %s", d.Name(), err)
|
||||
return nil, fmt.Errorf("could not read %q: %w", d.Name(), err)
|
||||
}
|
||||
|
||||
return names, nil
|
||||
|
Reference in New Issue
Block a user