[Process] Define the Groups() only once

pull/775/head
TakayukiB Goto 6 years ago
parent f55f202e81
commit a93796494b

@ -314,3 +314,8 @@ func (p *Process) CPUPercentWithContext(ctx context.Context) (float64, error) {
return math.Min(100, math.Max(0, 100*cput.Total()/totalTime)), nil
}
// Groups returns all group IDs(include supplementary groups) of the process as a slice of the int
func (p *Process) Groups() ([]int32, error) {
return p.GroupsWithContext(context.Background())
}

@ -250,9 +250,6 @@ func (p *Process) GidsWithContext(ctx context.Context) ([]int32, error) {
return gids, nil
}
func (p *Process) Groups() ([]int32, error) {
return p.GroupsWithContext(context.Background())
}
func (p *Process) GroupsWithContext(ctx context.Context) ([]int32, error) {
k, err := p.getKProc()

@ -139,9 +139,6 @@ func (p *Process) Gids() ([]int32, error) {
func (p *Process) GidsWithContext(ctx context.Context) ([]int32, error) {
return []int32{}, common.ErrNotImplementedError
}
func (p *Process) Groups() ([]int32, error) {
return p.GroupsWithContext(context.Background())
}
func (p *Process) GroupsWithContext(ctx context.Context) ([]int32, error) {
return []int32{}, common.ErrNotImplementedError

@ -213,9 +213,6 @@ func (p *Process) GidsWithContext(ctx context.Context) ([]int32, error) {
return gids, nil
}
func (p *Process) Groups() ([]int32, error) {
return p.GroupsWithContext(context.Background())
}
func (p *Process) GroupsWithContext(ctx context.Context) ([]int32, error) {
k, err := p.getKProc()

@ -228,11 +228,6 @@ func (p *Process) GidsWithContext(ctx context.Context) ([]int32, error) {
return p.gids, nil
}
// Groups returns groups of the process as a slice of the int
func (p *Process) Groups() ([]int32, error) {
return p.GroupsWithContext(context.Background())
}
func (p *Process) GroupsWithContext(ctx context.Context) ([]int32, error) {
err := p.fillFromStatusWithContext(ctx)
if err != nil {

@ -408,9 +408,6 @@ func (p *Process) GidsWithContext(ctx context.Context) ([]int32, error) {
var gids []int32
return gids, common.ErrNotImplementedError
}
func (p *Process) Groups() ([]int32, error) {
return p.GroupsWithContext(context.Background())
}
func (p *Process) GroupsWithContext(ctx context.Context) ([]int32, error) {
var groups []int32

Loading…
Cancel
Save