forked from forgejo/forgejo
Update swagger to 0.20.1 (#8010)
* update swagger to 0.20.1 * fiw swagger version for validate
This commit is contained in:
parent
e0f95d1545
commit
256b178176
100 changed files with 6410 additions and 1259 deletions
55
vendor/github.com/prometheus/procfs/proc.go
generated
vendored
55
vendor/github.com/prometheus/procfs/proc.go
generated
vendored
|
@ -54,7 +54,7 @@ func NewProc(pid int) (Proc, error) {
|
|||
if err != nil {
|
||||
return Proc{}, err
|
||||
}
|
||||
return fs.NewProc(pid)
|
||||
return fs.Proc(pid)
|
||||
}
|
||||
|
||||
// AllProcs returns a list of all currently available processes under /proc.
|
||||
|
@ -76,11 +76,18 @@ func (fs FS) Self() (Proc, error) {
|
|||
if err != nil {
|
||||
return Proc{}, err
|
||||
}
|
||||
return fs.NewProc(pid)
|
||||
return fs.Proc(pid)
|
||||
}
|
||||
|
||||
// NewProc returns a process for the given pid.
|
||||
//
|
||||
// Deprecated: use fs.Proc() instead
|
||||
func (fs FS) NewProc(pid int) (Proc, error) {
|
||||
return fs.Proc(pid)
|
||||
}
|
||||
|
||||
// Proc returns a process for the given pid.
|
||||
func (fs FS) Proc(pid int) (Proc, error) {
|
||||
if _, err := os.Stat(fs.proc.Path(strconv.Itoa(pid))); err != nil {
|
||||
return Proc{}, err
|
||||
}
|
||||
|
@ -240,6 +247,20 @@ func (p Proc) MountStats() ([]*Mount, error) {
|
|||
return parseMountStats(f)
|
||||
}
|
||||
|
||||
// MountInfo retrieves mount information for mount points in a
|
||||
// process's namespace.
|
||||
// It supplies information missing in `/proc/self/mounts` and
|
||||
// fixes various other problems with that file too.
|
||||
func (p Proc) MountInfo() ([]*MountInfo, error) {
|
||||
f, err := os.Open(p.path("mountinfo"))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
return parseMountInfo(f)
|
||||
}
|
||||
|
||||
func (p Proc) fileDescriptors() ([]string, error) {
|
||||
d, err := os.Open(p.path("fd"))
|
||||
if err != nil {
|
||||
|
@ -258,3 +279,33 @@ func (p Proc) fileDescriptors() ([]string, error) {
|
|||
func (p Proc) path(pa ...string) string {
|
||||
return p.fs.Path(append([]string{strconv.Itoa(p.PID)}, pa...)...)
|
||||
}
|
||||
|
||||
// FileDescriptorsInfo retrieves information about all file descriptors of
|
||||
// the process.
|
||||
func (p Proc) FileDescriptorsInfo() (ProcFDInfos, error) {
|
||||
names, err := p.fileDescriptors()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var fdinfos ProcFDInfos
|
||||
|
||||
for _, n := range names {
|
||||
fdinfo, err := p.FDInfo(n)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
fdinfos = append(fdinfos, *fdinfo)
|
||||
}
|
||||
|
||||
return fdinfos, nil
|
||||
}
|
||||
|
||||
// Schedstat returns task scheduling information for the process.
|
||||
func (p Proc) Schedstat() (ProcSchedstat, error) {
|
||||
contents, err := ioutil.ReadFile(p.path("schedstat"))
|
||||
if err != nil {
|
||||
return ProcSchedstat{}, err
|
||||
}
|
||||
return parseProcSchedstat(string(contents))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue