1// +build !darwin,!linux,!freebsd,!openbsd,!windows 2 3package process 4 5import ( 6 "context" 7 "syscall" 8 9 "github.com/shirou/gopsutil/cpu" 10 "github.com/shirou/gopsutil/internal/common" 11 "github.com/shirou/gopsutil/net" 12) 13 14type MemoryMapsStat struct { 15 Path string `json:"path"` 16 Rss uint64 `json:"rss"` 17 Size uint64 `json:"size"` 18 Pss uint64 `json:"pss"` 19 SharedClean uint64 `json:"sharedClean"` 20 SharedDirty uint64 `json:"sharedDirty"` 21 PrivateClean uint64 `json:"privateClean"` 22 PrivateDirty uint64 `json:"privateDirty"` 23 Referenced uint64 `json:"referenced"` 24 Anonymous uint64 `json:"anonymous"` 25 Swap uint64 `json:"swap"` 26} 27 28type MemoryInfoExStat struct { 29} 30 31func pidsWithContext(ctx context.Context) ([]int32, error) { 32 return []int32{}, common.ErrNotImplementedError 33} 34 35func Processes() ([]*Process, error) { 36 return nil, common.ErrNotImplementedError 37} 38 39func ProcessesWithContext(ctx context.Context) ([]*Process, error) { 40 return nil, common.ErrNotImplementedError 41} 42 43func PidExistsWithContext(ctx context.Context, pid int32) (bool, error) { 44 pids, err := PidsWithContext(ctx) 45 if err != nil { 46 return false, err 47 } 48 49 for _, i := range pids { 50 if i == pid { 51 return true, err 52 } 53 } 54 55 return false, err 56} 57 58func (p *Process) Ppid() (int32, error) { 59 return p.PpidWithContext(context.Background()) 60} 61 62func (p *Process) PpidWithContext(ctx context.Context) (int32, error) { 63 return 0, common.ErrNotImplementedError 64} 65func (p *Process) Name() (string, error) { 66 return p.NameWithContext(context.Background()) 67} 68 69func (p *Process) NameWithContext(ctx context.Context) (string, error) { 70 return "", common.ErrNotImplementedError 71} 72func (p *Process) Tgid() (int32, error) { 73 return 0, common.ErrNotImplementedError 74} 75func (p *Process) Exe() (string, error) { 76 return p.ExeWithContext(context.Background()) 77} 78 79func (p *Process) ExeWithContext(ctx context.Context) (string, error) { 80 return "", common.ErrNotImplementedError 81} 82func (p *Process) Cmdline() (string, error) { 83 return p.CmdlineWithContext(context.Background()) 84} 85 86func (p *Process) CmdlineWithContext(ctx context.Context) (string, error) { 87 return "", common.ErrNotImplementedError 88} 89func (p *Process) CmdlineSlice() ([]string, error) { 90 return p.CmdlineSliceWithContext(context.Background()) 91} 92 93func (p *Process) CmdlineSliceWithContext(ctx context.Context) ([]string, error) { 94 return []string{}, common.ErrNotImplementedError 95} 96 97func (p *Process) createTimeWithContext(ctx context.Context) (int64, error) { 98 return 0, common.ErrNotImplementedError 99} 100func (p *Process) Cwd() (string, error) { 101 return p.CwdWithContext(context.Background()) 102} 103 104func (p *Process) CwdWithContext(ctx context.Context) (string, error) { 105 return "", common.ErrNotImplementedError 106} 107func (p *Process) Parent() (*Process, error) { 108 return p.ParentWithContext(context.Background()) 109} 110 111func (p *Process) ParentWithContext(ctx context.Context) (*Process, error) { 112 return nil, common.ErrNotImplementedError 113} 114func (p *Process) Status() (string, error) { 115 return p.StatusWithContext(context.Background()) 116} 117 118func (p *Process) StatusWithContext(ctx context.Context) (string, error) { 119 return "", common.ErrNotImplementedError 120} 121func (p *Process) Foreground() (bool, error) { 122 return p.ForegroundWithContext(context.Background()) 123} 124 125func (p *Process) ForegroundWithContext(ctx context.Context) (bool, error) { 126 return false, common.ErrNotImplementedError 127} 128func (p *Process) Uids() ([]int32, error) { 129 return p.UidsWithContext(context.Background()) 130} 131 132func (p *Process) UidsWithContext(ctx context.Context) ([]int32, error) { 133 return []int32{}, common.ErrNotImplementedError 134} 135func (p *Process) Gids() ([]int32, error) { 136 return p.GidsWithContext(context.Background()) 137} 138 139func (p *Process) GidsWithContext(ctx context.Context) ([]int32, error) { 140 return []int32{}, common.ErrNotImplementedError 141} 142func (p *Process) Terminal() (string, error) { 143 return p.TerminalWithContext(context.Background()) 144} 145 146func (p *Process) TerminalWithContext(ctx context.Context) (string, error) { 147 return "", common.ErrNotImplementedError 148} 149func (p *Process) Nice() (int32, error) { 150 return p.NiceWithContext(context.Background()) 151} 152 153func (p *Process) NiceWithContext(ctx context.Context) (int32, error) { 154 return 0, common.ErrNotImplementedError 155} 156func (p *Process) IOnice() (int32, error) { 157 return p.IOniceWithContext(context.Background()) 158} 159 160func (p *Process) IOniceWithContext(ctx context.Context) (int32, error) { 161 return 0, common.ErrNotImplementedError 162} 163func (p *Process) Rlimit() ([]RlimitStat, error) { 164 return p.RlimitWithContext(context.Background()) 165} 166 167func (p *Process) RlimitWithContext(ctx context.Context) ([]RlimitStat, error) { 168 return nil, common.ErrNotImplementedError 169} 170func (p *Process) RlimitUsage(gatherUsed bool) ([]RlimitStat, error) { 171 return p.RlimitUsageWithContext(context.Background(), gatherUsed) 172} 173 174func (p *Process) RlimitUsageWithContext(ctx context.Context, gatherUsed bool) ([]RlimitStat, error) { 175 return nil, common.ErrNotImplementedError 176} 177func (p *Process) IOCounters() (*IOCountersStat, error) { 178 return p.IOCountersWithContext(context.Background()) 179} 180 181func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, error) { 182 return nil, common.ErrNotImplementedError 183} 184func (p *Process) NumCtxSwitches() (*NumCtxSwitchesStat, error) { 185 return p.NumCtxSwitchesWithContext(context.Background()) 186} 187 188func (p *Process) NumCtxSwitchesWithContext(ctx context.Context) (*NumCtxSwitchesStat, error) { 189 return nil, common.ErrNotImplementedError 190} 191func (p *Process) NumFDs() (int32, error) { 192 return p.NumFDsWithContext(context.Background()) 193} 194 195func (p *Process) NumFDsWithContext(ctx context.Context) (int32, error) { 196 return 0, common.ErrNotImplementedError 197} 198func (p *Process) NumThreads() (int32, error) { 199 return p.NumThreadsWithContext(context.Background()) 200} 201 202func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) { 203 return 0, common.ErrNotImplementedError 204} 205func (p *Process) Threads() (map[int32]*cpu.TimesStat, error) { 206 return p.ThreadsWithContext(context.Background()) 207} 208 209func (p *Process) ThreadsWithContext(ctx context.Context) (map[int32]*cpu.TimesStat, error) { 210 return nil, common.ErrNotImplementedError 211} 212func (p *Process) Times() (*cpu.TimesStat, error) { 213 return p.TimesWithContext(context.Background()) 214} 215 216func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error) { 217 return nil, common.ErrNotImplementedError 218} 219func (p *Process) CPUAffinity() ([]int32, error) { 220 return p.CPUAffinityWithContext(context.Background()) 221} 222 223func (p *Process) CPUAffinityWithContext(ctx context.Context) ([]int32, error) { 224 return nil, common.ErrNotImplementedError 225} 226func (p *Process) MemoryInfo() (*MemoryInfoStat, error) { 227 return p.MemoryInfoWithContext(context.Background()) 228} 229 230func (p *Process) MemoryInfoWithContext(ctx context.Context) (*MemoryInfoStat, error) { 231 return nil, common.ErrNotImplementedError 232} 233func (p *Process) MemoryInfoEx() (*MemoryInfoExStat, error) { 234 return p.MemoryInfoExWithContext(context.Background()) 235} 236 237func (p *Process) MemoryInfoExWithContext(ctx context.Context) (*MemoryInfoExStat, error) { 238 return nil, common.ErrNotImplementedError 239} 240func (p *Process) PageFaults() (*PageFaultsStat, error) { 241 return p.PageFaultsWithContext(context.Background()) 242} 243func (p *Process) PageFaultsWithContext(ctx context.Context) (*PageFaultsStat, error) { 244 return nil, common.ErrNotImplementedError 245} 246func (p *Process) Children() ([]*Process, error) { 247 return p.ChildrenWithContext(context.Background()) 248} 249 250func (p *Process) ChildrenWithContext(ctx context.Context) ([]*Process, error) { 251 return nil, common.ErrNotImplementedError 252} 253func (p *Process) OpenFiles() ([]OpenFilesStat, error) { 254 return p.OpenFilesWithContext(context.Background()) 255} 256 257func (p *Process) OpenFilesWithContext(ctx context.Context) ([]OpenFilesStat, error) { 258 return []OpenFilesStat{}, common.ErrNotImplementedError 259} 260func (p *Process) Connections() ([]net.ConnectionStat, error) { 261 return p.ConnectionsWithContext(context.Background()) 262} 263 264func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionStat, error) { 265 return []net.ConnectionStat{}, common.ErrNotImplementedError 266} 267 268func (p *Process) ConnectionsMax(max int) ([]net.ConnectionStat, error) { 269 return p.ConnectionsMaxWithContext(context.Background(), max) 270} 271 272func (p *Process) ConnectionsMaxWithContext(ctx context.Context, max int) ([]net.ConnectionStat, error) { 273 return []net.ConnectionStat{}, common.ErrNotImplementedError 274} 275 276func (p *Process) NetIOCounters(pernic bool) ([]net.IOCountersStat, error) { 277 return p.NetIOCountersWithContext(context.Background(), pernic) 278} 279 280func (p *Process) NetIOCountersWithContext(ctx context.Context, pernic bool) ([]net.IOCountersStat, error) { 281 return []net.IOCountersStat{}, common.ErrNotImplementedError 282} 283 284func (p *Process) MemoryMaps(grouped bool) (*[]MemoryMapsStat, error) { 285 return p.MemoryMapsWithContext(context.Background(), grouped) 286} 287 288func (p *Process) MemoryMapsWithContext(ctx context.Context, grouped bool) (*[]MemoryMapsStat, error) { 289 return nil, common.ErrNotImplementedError 290} 291func (p *Process) SendSignal(sig syscall.Signal) error { 292 return p.SendSignalWithContext(context.Background(), sig) 293} 294 295func (p *Process) SendSignalWithContext(ctx context.Context, sig syscall.Signal) error { 296 return common.ErrNotImplementedError 297} 298func (p *Process) Suspend() error { 299 return p.SuspendWithContext(context.Background()) 300} 301 302func (p *Process) SuspendWithContext(ctx context.Context) error { 303 return common.ErrNotImplementedError 304} 305func (p *Process) Resume() error { 306 return p.ResumeWithContext(context.Background()) 307} 308 309func (p *Process) ResumeWithContext(ctx context.Context) error { 310 return common.ErrNotImplementedError 311} 312func (p *Process) Terminate() error { 313 return p.TerminateWithContext(context.Background()) 314} 315 316func (p *Process) TerminateWithContext(ctx context.Context) error { 317 return common.ErrNotImplementedError 318} 319func (p *Process) Kill() error { 320 return p.KillWithContext(context.Background()) 321} 322 323func (p *Process) KillWithContext(ctx context.Context) error { 324 return common.ErrNotImplementedError 325} 326func (p *Process) Username() (string, error) { 327 return p.UsernameWithContext(context.Background()) 328} 329 330func (p *Process) UsernameWithContext(ctx context.Context) (string, error) { 331 return "", common.ErrNotImplementedError 332} 333