@ -241,7 +241,7 @@ func init() {
0 )
0 )
}
}
func pidsWithContext ( ctx context . Context ) ( [ ] int32 , error ) {
func pidsWithContext ( _ context . Context ) ( [ ] int32 , error ) {
// inspired by https://gist.github.com/henkman/3083408
// inspired by https://gist.github.com/henkman/3083408
// and https://github.com/giampaolo/psutil/blob/1c3a15f637521ba5c0031283da39c733fda53e4c/psutil/arch/windows/process_info.c#L315-L329
// and https://github.com/giampaolo/psutil/blob/1c3a15f637521ba5c0031283da39c733fda53e4c/psutil/arch/windows/process_info.c#L315-L329
var ret [ ] int32
var ret [ ] int32
@ -302,7 +302,7 @@ func PidExistsWithContext(ctx context.Context, pid int32) (bool, error) {
return event == uint32 ( windows . WAIT_TIMEOUT ) , err
return event == uint32 ( windows . WAIT_TIMEOUT ) , err
}
}
func ( p * Process ) PpidWithContext ( ctx context . Context ) ( int32 , error ) {
func ( p * Process ) PpidWithContext ( _ context . Context ) ( int32 , error ) {
// if cached already, return from cache
// if cached already, return from cache
cachedPpid := p . getPpid ( )
cachedPpid := p . getPpid ( )
if cachedPpid != 0 {
if cachedPpid != 0 {
@ -336,11 +336,11 @@ func (p *Process) NameWithContext(ctx context.Context) (string, error) {
return filepath . Base ( exe ) , nil
return filepath . Base ( exe ) , nil
}
}
func ( p * Process ) TgidWithContext ( ctx context . Context ) ( int32 , error ) {
func ( p * Process ) TgidWithContext ( _ context . Context ) ( int32 , error ) {
return 0 , common . ErrNotImplementedError
return 0 , common . ErrNotImplementedError
}
}
func ( p * Process ) ExeWithContext ( ctx context . Context ) ( string , error ) {
func ( p * Process ) ExeWithContext ( _ context . Context ) ( string , error ) {
c , err := windows . OpenProcess ( processQueryInformation , false , uint32 ( p . Pid ) )
c , err := windows . OpenProcess ( processQueryInformation , false , uint32 ( p . Pid ) )
if err != nil {
if err != nil {
return "" , err
return "" , err
@ -403,7 +403,7 @@ func parseCmdline(cmdline string) ([]string, error) {
return argv , nil
return argv , nil
}
}
func ( p * Process ) createTimeWithContext ( ctx context . Context ) ( int64 , error ) {
func ( p * Process ) createTimeWithContext ( _ context . Context ) ( int64 , error ) {
ru , err := getRusage ( p . Pid )
ru , err := getRusage ( p . Pid )
if err != nil {
if err != nil {
return 0 , fmt . Errorf ( "could not get CreationDate: %w" , err )
return 0 , fmt . Errorf ( "could not get CreationDate: %w" , err )
@ -456,15 +456,15 @@ func (p *Process) CwdWithContext(_ context.Context) (string, error) {
return "" , nil
return "" , nil
}
}
func ( p * Process ) StatusWithContext ( ctx context . Context ) ( [ ] string , error ) {
func ( p * Process ) StatusWithContext ( _ context . Context ) ( [ ] string , error ) {
return [ ] string { "" } , common . ErrNotImplementedError
return [ ] string { "" } , common . ErrNotImplementedError
}
}
func ( p * Process ) ForegroundWithContext ( ctx context . Context ) ( bool , error ) {
func ( p * Process ) ForegroundWithContext ( _ context . Context ) ( bool , error ) {
return false , common . ErrNotImplementedError
return false , common . ErrNotImplementedError
}
}
func ( p * Process ) UsernameWithContext ( ctx context . Context ) ( string , error ) {
func ( p * Process ) UsernameWithContext ( _ context . Context ) ( string , error ) {
pid := p . Pid
pid := p . Pid
c , err := windows . OpenProcess ( processQueryInformation , false , uint32 ( pid ) )
c , err := windows . OpenProcess ( processQueryInformation , false , uint32 ( pid ) )
if err != nil {
if err != nil {
@ -487,19 +487,19 @@ func (p *Process) UsernameWithContext(ctx context.Context) (string, error) {
return domain + "\\" + user , err
return domain + "\\" + user , err
}
}
func ( p * Process ) UidsWithContext ( ctx context . Context ) ( [ ] uint32 , error ) {
func ( p * Process ) UidsWithContext ( _ context . Context ) ( [ ] uint32 , error ) {
return nil , common . ErrNotImplementedError
return nil , common . ErrNotImplementedError
}
}
func ( p * Process ) GidsWithContext ( ctx context . Context ) ( [ ] uint32 , error ) {
func ( p * Process ) GidsWithContext ( _ context . Context ) ( [ ] uint32 , error ) {
return nil , common . ErrNotImplementedError
return nil , common . ErrNotImplementedError
}
}
func ( p * Process ) GroupsWithContext ( ctx context . Context ) ( [ ] uint32 , error ) {
func ( p * Process ) GroupsWithContext ( _ context . Context ) ( [ ] uint32 , error ) {
return nil , common . ErrNotImplementedError
return nil , common . ErrNotImplementedError
}
}
func ( p * Process ) TerminalWithContext ( ctx context . Context ) ( string , error ) {
func ( p * Process ) TerminalWithContext ( _ context . Context ) ( string , error ) {
return "" , common . ErrNotImplementedError
return "" , common . ErrNotImplementedError
}
}
@ -515,7 +515,7 @@ var priorityClasses = map[int]int32{
0x00000100 : 24 , // REALTIME_PRIORITY_CLASS
0x00000100 : 24 , // REALTIME_PRIORITY_CLASS
}
}
func ( p * Process ) NiceWithContext ( ctx context . Context ) ( int32 , error ) {
func ( p * Process ) NiceWithContext ( _ context . Context ) ( int32 , error ) {
c , err := windows . OpenProcess ( processQueryInformation , false , uint32 ( p . Pid ) )
c , err := windows . OpenProcess ( processQueryInformation , false , uint32 ( p . Pid ) )
if err != nil {
if err != nil {
return 0 , err
return 0 , err
@ -532,19 +532,19 @@ func (p *Process) NiceWithContext(ctx context.Context) (int32, error) {
return priority , nil
return priority , nil
}
}
func ( p * Process ) IOniceWithContext ( ctx context . Context ) ( int32 , error ) {
func ( p * Process ) IOniceWithContext ( _ context . Context ) ( int32 , error ) {
return 0 , common . ErrNotImplementedError
return 0 , common . ErrNotImplementedError
}
}
func ( p * Process ) RlimitWithContext ( ctx context . Context ) ( [ ] RlimitStat , error ) {
func ( p * Process ) RlimitWithContext ( _ context . Context ) ( [ ] RlimitStat , error ) {
return nil , common . ErrNotImplementedError
return nil , common . ErrNotImplementedError
}
}
func ( p * Process ) RlimitUsageWithContext ( ctx context . Context , gatherUsed bool ) ( [ ] RlimitStat , error ) {
func ( p * Process ) RlimitUsageWithContext ( _ context . Context , _ bool ) ( [ ] RlimitStat , error ) {
return nil , common . ErrNotImplementedError
return nil , common . ErrNotImplementedError
}
}
func ( p * Process ) IOCountersWithContext ( ctx context . Context ) ( * IOCountersStat , error ) {
func ( p * Process ) IOCountersWithContext ( _ context . Context ) ( * IOCountersStat , error ) {
c , err := windows . OpenProcess ( processQueryInformation , false , uint32 ( p . Pid ) )
c , err := windows . OpenProcess ( processQueryInformation , false , uint32 ( p . Pid ) )
if err != nil {
if err != nil {
return nil , err
return nil , err
@ -565,13 +565,13 @@ func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, e
return stats , nil
return stats , nil
}
}
func ( p * Process ) NumCtxSwitchesWithContext ( ctx context . Context ) ( * NumCtxSwitchesStat , error ) {
func ( p * Process ) NumCtxSwitchesWithContext ( _ context . Context ) ( * NumCtxSwitchesStat , error ) {
return nil , common . ErrNotImplementedError
return nil , common . ErrNotImplementedError
}
}
// NumFDsWithContext returns the number of handles for a process on Windows,
// NumFDsWithContext returns the number of handles for a process on Windows,
// not the number of file descriptors (FDs).
// not the number of file descriptors (FDs).
func ( p * Process ) NumFDsWithContext ( ctx context . Context ) ( int32 , error ) {
func ( p * Process ) NumFDsWithContext ( _ context . Context ) ( int32 , error ) {
handle , err := windows . OpenProcess ( processQueryInformation , false , uint32 ( p . Pid ) )
handle , err := windows . OpenProcess ( processQueryInformation , false , uint32 ( p . Pid ) )
if err != nil {
if err != nil {
return 0 , err
return 0 , err
@ -586,7 +586,7 @@ func (p *Process) NumFDsWithContext(ctx context.Context) (int32, error) {
return int32 ( handleCount ) , nil
return int32 ( handleCount ) , nil
}
}
func ( p * Process ) NumThreadsWithContext ( ctx context . Context ) ( int32 , error ) {
func ( p * Process ) NumThreadsWithContext ( _ context . Context ) ( int32 , error ) {
ppid , ret , _ , err := getFromSnapProcess ( p . Pid )
ppid , ret , _ , err := getFromSnapProcess ( p . Pid )
if err != nil {
if err != nil {
return 0 , err
return 0 , err
@ -601,11 +601,11 @@ func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) {
return ret , nil
return ret , nil
}
}
func ( p * Process ) ThreadsWithContext ( ctx context . Context ) ( map [ int32 ] * cpu . TimesStat , error ) {
func ( p * Process ) ThreadsWithContext ( _ context . Context ) ( map [ int32 ] * cpu . TimesStat , error ) {
return nil , common . ErrNotImplementedError
return nil , common . ErrNotImplementedError
}
}
func ( p * Process ) TimesWithContext ( ctx context . Context ) ( * cpu . TimesStat , error ) {
func ( p * Process ) TimesWithContext ( _ context . Context ) ( * cpu . TimesStat , error ) {
sysTimes , err := getProcessCPUTimes ( p . Pid )
sysTimes , err := getProcessCPUTimes ( p . Pid )
if err != nil {
if err != nil {
return nil , err
return nil , err
@ -629,11 +629,11 @@ func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error)
} , nil
} , nil
}
}
func ( p * Process ) CPUAffinityWithContext ( ctx context . Context ) ( [ ] int32 , error ) {
func ( p * Process ) CPUAffinityWithContext ( _ context . Context ) ( [ ] int32 , error ) {
return nil , common . ErrNotImplementedError
return nil , common . ErrNotImplementedError
}
}
func ( p * Process ) MemoryInfoWithContext ( ctx context . Context ) ( * MemoryInfoStat , error ) {
func ( p * Process ) MemoryInfoWithContext ( _ context . Context ) ( * MemoryInfoStat , error ) {
mem , err := getMemoryInfo ( p . Pid )
mem , err := getMemoryInfo ( p . Pid )
if err != nil {
if err != nil {
return nil , err
return nil , err
@ -647,11 +647,11 @@ func (p *Process) MemoryInfoWithContext(ctx context.Context) (*MemoryInfoStat, e
return ret , nil
return ret , nil
}
}
func ( p * Process ) MemoryInfoExWithContext ( ctx context . Context ) ( * MemoryInfoExStat , error ) {
func ( p * Process ) MemoryInfoExWithContext ( _ context . Context ) ( * MemoryInfoExStat , error ) {
return nil , common . ErrNotImplementedError
return nil , common . ErrNotImplementedError
}
}
func ( p * Process ) PageFaultsWithContext ( ctx context . Context ) ( * PageFaultsStat , error ) {
func ( p * Process ) PageFaultsWithContext ( _ context . Context ) ( * PageFaultsStat , error ) {
mem , err := getMemoryInfo ( p . Pid )
mem , err := getMemoryInfo ( p . Pid )
if err != nil {
if err != nil {
return nil , err
return nil , err
@ -788,19 +788,19 @@ func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionS
return net . ConnectionsPidWithContext ( ctx , "all" , p . Pid )
return net . ConnectionsPidWithContext ( ctx , "all" , p . Pid )
}
}
func ( p * Process ) ConnectionsMaxWithContext ( ctx context . Context , maxConn int ) ( [ ] net . ConnectionStat , error ) {
func ( p * Process ) ConnectionsMaxWithContext ( _ context . Context , _ int ) ( [ ] net . ConnectionStat , error ) {
return nil , common . ErrNotImplementedError
return nil , common . ErrNotImplementedError
}
}
func ( p * Process ) MemoryMapsWithContext ( ctx context . Context , grouped bool ) ( * [ ] MemoryMapsStat , error ) {
func ( p * Process ) MemoryMapsWithContext ( _ context . Context , _ bool ) ( * [ ] MemoryMapsStat , error ) {
return nil , common . ErrNotImplementedError
return nil , common . ErrNotImplementedError
}
}
func ( p * Process ) SendSignalWithContext ( ctx context . Context , sig syscall . Signal ) error {
func ( p * Process ) SendSignalWithContext ( _ context . Context , _ syscall . Signal ) error {
return common . ErrNotImplementedError
return common . ErrNotImplementedError
}
}
func ( p * Process ) SuspendWithContext ( ctx context . Context ) error {
func ( p * Process ) SuspendWithContext ( _ context . Context ) error {
c , err := windows . OpenProcess ( windows . PROCESS_SUSPEND_RESUME , false , uint32 ( p . Pid ) )
c , err := windows . OpenProcess ( windows . PROCESS_SUSPEND_RESUME , false , uint32 ( p . Pid ) )
if err != nil {
if err != nil {
return err
return err
@ -816,7 +816,7 @@ func (p *Process) SuspendWithContext(ctx context.Context) error {
return nil
return nil
}
}
func ( p * Process ) ResumeWithContext ( ctx context . Context ) error {
func ( p * Process ) ResumeWithContext ( _ context . Context ) error {
c , err := windows . OpenProcess ( windows . PROCESS_SUSPEND_RESUME , false , uint32 ( p . Pid ) )
c , err := windows . OpenProcess ( windows . PROCESS_SUSPEND_RESUME , false , uint32 ( p . Pid ) )
if err != nil {
if err != nil {
return err
return err
@ -832,7 +832,7 @@ func (p *Process) ResumeWithContext(ctx context.Context) error {
return nil
return nil
}
}
func ( p * Process ) TerminateWithContext ( ctx context . Context ) error {
func ( p * Process ) TerminateWithContext ( _ context . Context ) error {
proc , err := windows . OpenProcess ( windows . PROCESS_TERMINATE , false , uint32 ( p . Pid ) )
proc , err := windows . OpenProcess ( windows . PROCESS_TERMINATE , false , uint32 ( p . Pid ) )
if err != nil {
if err != nil {
return err
return err
@ -842,7 +842,7 @@ func (p *Process) TerminateWithContext(ctx context.Context) error {
return err
return err
}
}
func ( p * Process ) KillWithContext ( ctx context . Context ) error {
func ( p * Process ) KillWithContext ( _ context . Context ) error {
process , err := os . FindProcess ( int ( p . Pid ) )
process , err := os . FindProcess ( int ( p . Pid ) )
if err != nil {
if err != nil {
return err
return err