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