mirror of
https://github.com/shirou/gopsutil.git
synced 2025-04-28 13:48:49 +08:00
Update process_linux.go for Add process ConnectionsMax
This commit is contained in:
parent
db425313bf
commit
462e0f6c2f
@ -517,6 +517,15 @@ func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionS
|
|||||||
return net.ConnectionsPid("all", p.Pid)
|
return net.ConnectionsPid("all", p.Pid)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Connections returns a slice of net.ConnectionStat used by the process at most `max`
|
||||||
|
func (p *Process) ConnectionsMax(max int) ([]net.ConnectionStat, error) {
|
||||||
|
return p.ConnectionsMaxWithContext(context.Background(), max)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Process) ConnectionsMaxWithContext(ctx context.Context, max int) ([]net.ConnectionStat, error) {
|
||||||
|
return net.ConnectionsPidMax("all", p.Pid, max)
|
||||||
|
}
|
||||||
|
|
||||||
func (p *Process) NetIOCounters(pernic bool) ([]net.IOCountersStat, error) {
|
func (p *Process) NetIOCounters(pernic bool) ([]net.IOCountersStat, error) {
|
||||||
return p.NetIOCountersWithContext(context.Background(), pernic)
|
return p.NetIOCountersWithContext(context.Background(), pernic)
|
||||||
}
|
}
|
||||||
|
@ -254,6 +254,15 @@ func (p *Process) Connections() ([]net.ConnectionStat, error) {
|
|||||||
func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionStat, error) {
|
func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionStat, error) {
|
||||||
return []net.ConnectionStat{}, common.ErrNotImplementedError
|
return []net.ConnectionStat{}, common.ErrNotImplementedError
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *Process) ConnectionsMax(max int) ([]net.ConnectionStat, error) {
|
||||||
|
return p.ConnectionsMaxWithContext(context.Background(), max)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Process) ConnectionsMaxWithContext(ctx context.Context, max int) ([]net.ConnectionStat, error) {
|
||||||
|
return []net.ConnectionStat{}, common.ErrNotImplementedError
|
||||||
|
}
|
||||||
|
|
||||||
func (p *Process) NetIOCounters(pernic bool) ([]net.IOCountersStat, error) {
|
func (p *Process) NetIOCounters(pernic bool) ([]net.IOCountersStat, error) {
|
||||||
return p.NetIOCountersWithContext(context.Background(), pernic)
|
return p.NetIOCountersWithContext(context.Background(), pernic)
|
||||||
}
|
}
|
||||||
|
@ -407,6 +407,15 @@ func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionS
|
|||||||
return nil, common.ErrNotImplementedError
|
return nil, common.ErrNotImplementedError
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Connections returns a slice of net.ConnectionStat used by the process at most `max`
|
||||||
|
func (p *Process) ConnectionsMax(max int) ([]net.ConnectionStat, error) {
|
||||||
|
return p.ConnectionsMaxWithContext(context.Background(), max)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Process) ConnectionsMaxWithContext(ctx context.Context, max int) ([]net.ConnectionStat, error) {
|
||||||
|
return []net.ConnectionStat{}, common.ErrNotImplementedError
|
||||||
|
}
|
||||||
|
|
||||||
func (p *Process) NetIOCounters(pernic bool) ([]net.IOCountersStat, error) {
|
func (p *Process) NetIOCounters(pernic bool) ([]net.IOCountersStat, error) {
|
||||||
return p.NetIOCountersWithContext(context.Background(), pernic)
|
return p.NetIOCountersWithContext(context.Background(), pernic)
|
||||||
}
|
}
|
||||||
|
@ -531,6 +531,15 @@ func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionS
|
|||||||
return net.ConnectionsPid("all", p.Pid)
|
return net.ConnectionsPid("all", p.Pid)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Connections returns a slice of net.ConnectionStat used by the process at most `max`
|
||||||
|
func (p *Process) ConnectionsMax(max int) ([]net.ConnectionStat, error) {
|
||||||
|
return p.ConnectionsMaxWithContext(context.Background(), max)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Process) ConnectionsMaxWithContext(ctx context.Context, max int) ([]net.ConnectionStat, error) {
|
||||||
|
return net.ConnectionsPidMax("all", p.Pid, max)
|
||||||
|
}
|
||||||
|
|
||||||
// NetIOCounters returns NetIOCounters of the process.
|
// NetIOCounters returns NetIOCounters of the process.
|
||||||
func (p *Process) NetIOCounters(pernic bool) ([]net.IOCountersStat, error) {
|
func (p *Process) NetIOCounters(pernic bool) ([]net.IOCountersStat, error) {
|
||||||
return p.NetIOCountersWithContext(context.Background(), pernic)
|
return p.NetIOCountersWithContext(context.Background(), pernic)
|
||||||
|
@ -395,6 +395,14 @@ func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionS
|
|||||||
return nil, common.ErrNotImplementedError
|
return nil, common.ErrNotImplementedError
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *Process) ConnectionsMax(max int) ([]net.ConnectionStat, error) {
|
||||||
|
return p.ConnectionsMaxWithContext(context.Background(), max)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Process) ConnectionsMaxWithContext(ctx context.Context, max int) ([]net.ConnectionStat, error) {
|
||||||
|
return []net.ConnectionStat{}, common.ErrNotImplementedError
|
||||||
|
}
|
||||||
|
|
||||||
func (p *Process) NetIOCounters(pernic bool) ([]net.IOCountersStat, error) {
|
func (p *Process) NetIOCounters(pernic bool) ([]net.IOCountersStat, error) {
|
||||||
return p.NetIOCountersWithContext(context.Background(), pernic)
|
return p.NetIOCountersWithContext(context.Background(), pernic)
|
||||||
}
|
}
|
||||||
|
@ -581,6 +581,14 @@ func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionS
|
|||||||
return nil, common.ErrNotImplementedError
|
return nil, common.ErrNotImplementedError
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *Process) ConnectionsMax(max int) ([]net.ConnectionStat, error) {
|
||||||
|
return p.ConnectionsMaxWithContext(context.Background(), max)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Process) ConnectionsMaxWithContext(ctx context.Context, max int) ([]net.ConnectionStat, error) {
|
||||||
|
return []net.ConnectionStat{}, common.ErrNotImplementedError
|
||||||
|
}
|
||||||
|
|
||||||
func (p *Process) NetIOCounters(pernic bool) ([]net.IOCountersStat, error) {
|
func (p *Process) NetIOCounters(pernic bool) ([]net.IOCountersStat, error) {
|
||||||
return p.NetIOCountersWithContext(context.Background(), pernic)
|
return p.NetIOCountersWithContext(context.Background(), pernic)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user