2024-02-17 03:48:29 +00:00
|
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
2021-12-22 21:54:41 +00:00
|
|
|
//go:build !darwin && !linux && !freebsd && !openbsd && !windows && !solaris && !plan9
|
2016-08-22 15:31:26 -07:00
|
|
|
|
|
|
|
package process
|
|
|
|
|
|
|
|
import (
|
2017-12-31 15:25:49 +09:00
|
|
|
"context"
|
2016-08-22 15:31:26 -07:00
|
|
|
"syscall"
|
|
|
|
|
2024-02-17 03:48:29 +00:00
|
|
|
"github.com/shirou/gopsutil/v4/cpu"
|
|
|
|
"github.com/shirou/gopsutil/v4/internal/common"
|
|
|
|
"github.com/shirou/gopsutil/v4/net"
|
2016-08-22 15:31:26 -07:00
|
|
|
)
|
|
|
|
|
2021-11-06 09:53:56 +00:00
|
|
|
type Signal = syscall.Signal
|
|
|
|
|
2016-08-22 15:31:26 -07:00
|
|
|
type MemoryMapsStat struct {
|
|
|
|
Path string `json:"path"`
|
|
|
|
Rss uint64 `json:"rss"`
|
|
|
|
Size uint64 `json:"size"`
|
|
|
|
Pss uint64 `json:"pss"`
|
|
|
|
SharedClean uint64 `json:"sharedClean"`
|
|
|
|
SharedDirty uint64 `json:"sharedDirty"`
|
|
|
|
PrivateClean uint64 `json:"privateClean"`
|
|
|
|
PrivateDirty uint64 `json:"privateDirty"`
|
|
|
|
Referenced uint64 `json:"referenced"`
|
|
|
|
Anonymous uint64 `json:"anonymous"`
|
|
|
|
Swap uint64 `json:"swap"`
|
|
|
|
}
|
|
|
|
|
2021-12-22 21:54:41 +00:00
|
|
|
type MemoryInfoExStat struct{}
|
2016-08-22 15:31:26 -07:00
|
|
|
|
2019-08-22 21:09:10 +02:00
|
|
|
func pidsWithContext(ctx context.Context) ([]int32, error) {
|
2018-07-26 15:10:44 -07:00
|
|
|
return nil, common.ErrNotImplementedError
|
|
|
|
}
|
|
|
|
|
|
|
|
func ProcessesWithContext(ctx context.Context) ([]*Process, error) {
|
|
|
|
return nil, common.ErrNotImplementedError
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:42:36 +02:00
|
|
|
func PidExistsWithContext(ctx context.Context, pid int32) (bool, error) {
|
2020-10-10 14:18:22 +03:00
|
|
|
return false, common.ErrNotImplementedError
|
2017-12-31 15:25:49 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *Process) PpidWithContext(ctx context.Context) (int32, error) {
|
2016-08-22 15:31:26 -07:00
|
|
|
return 0, common.ErrNotImplementedError
|
|
|
|
}
|
2017-12-31 15:25:49 +09:00
|
|
|
|
|
|
|
func (p *Process) NameWithContext(ctx context.Context) (string, error) {
|
2016-08-22 15:31:26 -07:00
|
|
|
return "", common.ErrNotImplementedError
|
|
|
|
}
|
2020-10-10 14:18:22 +03:00
|
|
|
|
|
|
|
func (p *Process) TgidWithContext(ctx context.Context) (int32, error) {
|
2018-01-04 11:30:39 -08:00
|
|
|
return 0, common.ErrNotImplementedError
|
2016-08-22 15:31:26 -07:00
|
|
|
}
|
2017-12-31 15:25:49 +09:00
|
|
|
|
|
|
|
func (p *Process) ExeWithContext(ctx context.Context) (string, error) {
|
2016-08-22 15:31:26 -07:00
|
|
|
return "", common.ErrNotImplementedError
|
|
|
|
}
|
2017-12-31 15:25:49 +09:00
|
|
|
|
|
|
|
func (p *Process) CmdlineWithContext(ctx context.Context) (string, error) {
|
2016-08-22 15:31:26 -07:00
|
|
|
return "", common.ErrNotImplementedError
|
|
|
|
}
|
2017-12-31 15:25:49 +09:00
|
|
|
|
|
|
|
func (p *Process) CmdlineSliceWithContext(ctx context.Context) ([]string, error) {
|
2020-10-10 14:18:22 +03:00
|
|
|
return nil, common.ErrNotImplementedError
|
2016-08-22 15:31:26 -07:00
|
|
|
}
|
2017-12-31 15:25:49 +09:00
|
|
|
|
2019-09-06 13:36:22 +02:00
|
|
|
func (p *Process) createTimeWithContext(ctx context.Context) (int64, error) {
|
2016-08-22 15:31:26 -07:00
|
|
|
return 0, common.ErrNotImplementedError
|
|
|
|
}
|
2017-12-31 15:25:49 +09:00
|
|
|
|
|
|
|
func (p *Process) CwdWithContext(ctx context.Context) (string, error) {
|
2016-08-22 15:31:26 -07:00
|
|
|
return "", common.ErrNotImplementedError
|
|
|
|
}
|
2017-12-31 15:25:49 +09:00
|
|
|
|
2021-11-06 09:53:56 +00:00
|
|
|
func (p *Process) StatusWithContext(ctx context.Context) ([]string, error) {
|
|
|
|
return []string{""}, common.ErrNotImplementedError
|
2016-08-22 15:31:26 -07:00
|
|
|
}
|
2018-11-08 20:25:44 +01:00
|
|
|
|
2018-12-10 20:20:53 +09:00
|
|
|
func (p *Process) ForegroundWithContext(ctx context.Context) (bool, error) {
|
2018-11-08 20:25:44 +01:00
|
|
|
return false, common.ErrNotImplementedError
|
|
|
|
}
|
2017-12-31 15:25:49 +09:00
|
|
|
|
2024-02-17 12:39:18 +00:00
|
|
|
func (p *Process) UidsWithContext(ctx context.Context) ([]uint32, error) {
|
2020-10-10 14:18:22 +03:00
|
|
|
return nil, common.ErrNotImplementedError
|
2017-12-31 15:25:49 +09:00
|
|
|
}
|
|
|
|
|
2024-02-17 12:39:18 +00:00
|
|
|
func (p *Process) GidsWithContext(ctx context.Context) ([]uint32, error) {
|
2020-10-10 14:18:22 +03:00
|
|
|
return nil, common.ErrNotImplementedError
|
2016-08-22 15:31:26 -07:00
|
|
|
}
|
2019-10-07 12:59:36 +09:00
|
|
|
|
2023-02-28 15:05:12 +03:00
|
|
|
func (p *Process) GroupsWithContext(ctx context.Context) ([]uint32, error) {
|
2020-10-10 14:18:22 +03:00
|
|
|
return nil, common.ErrNotImplementedError
|
2017-12-31 15:25:49 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *Process) TerminalWithContext(ctx context.Context) (string, error) {
|
2016-08-22 15:31:26 -07:00
|
|
|
return "", common.ErrNotImplementedError
|
|
|
|
}
|
2017-12-31 15:25:49 +09:00
|
|
|
|
|
|
|
func (p *Process) NiceWithContext(ctx context.Context) (int32, error) {
|
2016-08-22 15:31:26 -07:00
|
|
|
return 0, common.ErrNotImplementedError
|
|
|
|
}
|
2017-12-31 15:25:49 +09:00
|
|
|
|
|
|
|
func (p *Process) IOniceWithContext(ctx context.Context) (int32, error) {
|
2016-08-22 15:31:26 -07:00
|
|
|
return 0, common.ErrNotImplementedError
|
|
|
|
}
|
2017-12-31 15:25:49 +09:00
|
|
|
|
|
|
|
func (p *Process) RlimitWithContext(ctx context.Context) ([]RlimitStat, error) {
|
2016-08-22 15:31:26 -07:00
|
|
|
return nil, common.ErrNotImplementedError
|
|
|
|
}
|
2017-12-31 15:25:49 +09:00
|
|
|
|
|
|
|
func (p *Process) RlimitUsageWithContext(ctx context.Context, gatherUsed bool) ([]RlimitStat, error) {
|
2017-04-05 12:01:59 -04:00
|
|
|
return nil, common.ErrNotImplementedError
|
|
|
|
}
|
2017-12-31 15:25:49 +09:00
|
|
|
|
|
|
|
func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, error) {
|
2016-08-22 15:31:26 -07:00
|
|
|
return nil, common.ErrNotImplementedError
|
|
|
|
}
|
2017-12-31 15:25:49 +09:00
|
|
|
|
|
|
|
func (p *Process) NumCtxSwitchesWithContext(ctx context.Context) (*NumCtxSwitchesStat, error) {
|
2016-08-22 15:31:26 -07:00
|
|
|
return nil, common.ErrNotImplementedError
|
|
|
|
}
|
2017-12-31 15:25:49 +09:00
|
|
|
|
|
|
|
func (p *Process) NumFDsWithContext(ctx context.Context) (int32, error) {
|
2016-08-22 15:31:26 -07:00
|
|
|
return 0, common.ErrNotImplementedError
|
|
|
|
}
|
2017-12-31 15:25:49 +09:00
|
|
|
|
|
|
|
func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) {
|
2016-08-22 15:31:26 -07:00
|
|
|
return 0, common.ErrNotImplementedError
|
|
|
|
}
|
2017-12-31 15:25:49 +09:00
|
|
|
|
|
|
|
func (p *Process) ThreadsWithContext(ctx context.Context) (map[int32]*cpu.TimesStat, error) {
|
2016-08-22 15:31:26 -07:00
|
|
|
return nil, common.ErrNotImplementedError
|
|
|
|
}
|
2017-12-31 15:25:49 +09:00
|
|
|
|
|
|
|
func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error) {
|
2016-08-22 15:31:26 -07:00
|
|
|
return nil, common.ErrNotImplementedError
|
|
|
|
}
|
2017-12-31 15:25:49 +09:00
|
|
|
|
|
|
|
func (p *Process) CPUAffinityWithContext(ctx context.Context) ([]int32, error) {
|
2016-08-22 15:31:26 -07:00
|
|
|
return nil, common.ErrNotImplementedError
|
|
|
|
}
|
2017-12-31 15:25:49 +09:00
|
|
|
|
|
|
|
func (p *Process) MemoryInfoWithContext(ctx context.Context) (*MemoryInfoStat, error) {
|
2016-08-22 15:31:26 -07:00
|
|
|
return nil, common.ErrNotImplementedError
|
|
|
|
}
|
2017-12-31 15:25:49 +09:00
|
|
|
|
|
|
|
func (p *Process) MemoryInfoExWithContext(ctx context.Context) (*MemoryInfoExStat, error) {
|
2016-08-22 15:31:26 -07:00
|
|
|
return nil, common.ErrNotImplementedError
|
|
|
|
}
|
2020-10-10 14:18:22 +03:00
|
|
|
|
2018-12-13 12:34:27 -08:00
|
|
|
func (p *Process) PageFaultsWithContext(ctx context.Context) (*PageFaultsStat, error) {
|
|
|
|
return nil, common.ErrNotImplementedError
|
|
|
|
}
|
2017-12-31 15:25:49 +09:00
|
|
|
|
|
|
|
func (p *Process) ChildrenWithContext(ctx context.Context) ([]*Process, error) {
|
2016-08-22 15:31:26 -07:00
|
|
|
return nil, common.ErrNotImplementedError
|
|
|
|
}
|
2017-12-31 15:25:49 +09:00
|
|
|
|
|
|
|
func (p *Process) OpenFilesWithContext(ctx context.Context) ([]OpenFilesStat, error) {
|
2020-10-10 14:18:22 +03:00
|
|
|
return nil, common.ErrNotImplementedError
|
2017-12-31 15:25:49 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionStat, error) {
|
2020-10-10 14:18:22 +03:00
|
|
|
return nil, common.ErrNotImplementedError
|
2019-02-23 18:55:31 +08:00
|
|
|
}
|
|
|
|
|
2024-08-17 22:41:29 +09:00
|
|
|
func (p *Process) ConnectionsMaxWithContext(ctx context.Context, maxConn int) ([]net.ConnectionStat, error) {
|
2020-10-10 14:18:22 +03:00
|
|
|
return nil, common.ErrNotImplementedError
|
2017-12-31 15:25:49 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *Process) MemoryMapsWithContext(ctx context.Context, grouped bool) (*[]MemoryMapsStat, error) {
|
2016-08-22 15:31:26 -07:00
|
|
|
return nil, common.ErrNotImplementedError
|
|
|
|
}
|
2017-12-31 15:25:49 +09:00
|
|
|
|
2021-11-06 09:53:56 +00:00
|
|
|
func (p *Process) SendSignalWithContext(ctx context.Context, sig Signal) error {
|
2016-08-22 15:31:26 -07:00
|
|
|
return common.ErrNotImplementedError
|
|
|
|
}
|
2017-12-31 15:25:49 +09:00
|
|
|
|
|
|
|
func (p *Process) SuspendWithContext(ctx context.Context) error {
|
2016-08-22 15:31:26 -07:00
|
|
|
return common.ErrNotImplementedError
|
|
|
|
}
|
2017-12-31 15:25:49 +09:00
|
|
|
|
|
|
|
func (p *Process) ResumeWithContext(ctx context.Context) error {
|
2016-08-22 15:31:26 -07:00
|
|
|
return common.ErrNotImplementedError
|
|
|
|
}
|
2017-12-31 15:25:49 +09:00
|
|
|
|
|
|
|
func (p *Process) TerminateWithContext(ctx context.Context) error {
|
2016-08-22 15:31:26 -07:00
|
|
|
return common.ErrNotImplementedError
|
|
|
|
}
|
2017-12-31 15:25:49 +09:00
|
|
|
|
|
|
|
func (p *Process) KillWithContext(ctx context.Context) error {
|
2016-08-22 15:31:26 -07:00
|
|
|
return common.ErrNotImplementedError
|
|
|
|
}
|
2017-12-31 15:25:49 +09:00
|
|
|
|
|
|
|
func (p *Process) UsernameWithContext(ctx context.Context) (string, error) {
|
2016-08-22 15:31:26 -07:00
|
|
|
return "", common.ErrNotImplementedError
|
|
|
|
}
|
2021-07-13 14:57:40 +02:00
|
|
|
|
|
|
|
func (p *Process) EnvironWithContext(ctx context.Context) ([]string, error) {
|
|
|
|
return nil, common.ErrNotImplementedError
|
|
|
|
}
|