mirror of
https://github.com/openfaas/faas.git
synced 2025-06-23 07:13:23 +00:00
Update go.mod, Alpine to 3.20.0 and to Go 1.22
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alex@openfaas.com>
This commit is contained in:
29
gateway/vendor/github.com/prometheus/procfs/proc_status.go
generated
vendored
29
gateway/vendor/github.com/prometheus/procfs/proc_status.go
generated
vendored
@ -15,6 +15,7 @@ package procfs
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"math/bits"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
@ -76,9 +77,9 @@ type ProcStatus struct {
|
||||
NonVoluntaryCtxtSwitches uint64
|
||||
|
||||
// UIDs of the process (Real, effective, saved set, and filesystem UIDs)
|
||||
UIDs [4]string
|
||||
UIDs [4]uint64
|
||||
// GIDs of the process (Real, effective, saved set, and filesystem GIDs)
|
||||
GIDs [4]string
|
||||
GIDs [4]uint64
|
||||
|
||||
// CpusAllowedList: List of cpu cores processes are allowed to run on.
|
||||
CpusAllowedList []uint64
|
||||
@ -113,22 +114,37 @@ func (p Proc) NewStatus() (ProcStatus, error) {
|
||||
// convert kB to B
|
||||
vBytes := vKBytes * 1024
|
||||
|
||||
s.fillStatus(k, v, vKBytes, vBytes)
|
||||
err = s.fillStatus(k, v, vKBytes, vBytes)
|
||||
if err != nil {
|
||||
return ProcStatus{}, err
|
||||
}
|
||||
}
|
||||
|
||||
return s, nil
|
||||
}
|
||||
|
||||
func (s *ProcStatus) fillStatus(k string, vString string, vUint uint64, vUintBytes uint64) {
|
||||
func (s *ProcStatus) fillStatus(k string, vString string, vUint uint64, vUintBytes uint64) error {
|
||||
switch k {
|
||||
case "Tgid":
|
||||
s.TGID = int(vUint)
|
||||
case "Name":
|
||||
s.Name = vString
|
||||
case "Uid":
|
||||
copy(s.UIDs[:], strings.Split(vString, "\t"))
|
||||
var err error
|
||||
for i, v := range strings.Split(vString, "\t") {
|
||||
s.UIDs[i], err = strconv.ParseUint(v, 10, bits.UintSize)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
case "Gid":
|
||||
copy(s.GIDs[:], strings.Split(vString, "\t"))
|
||||
var err error
|
||||
for i, v := range strings.Split(vString, "\t") {
|
||||
s.GIDs[i], err = strconv.ParseUint(v, 10, bits.UintSize)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
case "NSpid":
|
||||
s.NSpids = calcNSPidsList(vString)
|
||||
case "VmPeak":
|
||||
@ -173,6 +189,7 @@ func (s *ProcStatus) fillStatus(k string, vString string, vUint uint64, vUintByt
|
||||
s.CpusAllowedList = calcCpusAllowedList(vString)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// TotalCtxtSwitches returns the total context switch.
|
||||
|
Reference in New Issue
Block a user