getMaxPID returns the maximum PID value for the current OS
()
| 365 | |
| 366 | // getMaxPID returns the maximum PID value for the current OS |
| 367 | func (pv *ProcessValidator) getMaxPID() int { |
| 368 | switch runtime.GOOS { |
| 369 | case "linux": |
| 370 | // Linux default max PID is 4194304 (2^22) |
| 371 | // Could also read from /proc/sys/kernel/pid_max but using safe default |
| 372 | return 4194304 |
| 373 | case "darwin": |
| 374 | // macOS typical max PID |
| 375 | return 99998 |
| 376 | case "windows": |
| 377 | // Windows typical max PID |
| 378 | return 65536 |
| 379 | default: |
| 380 | // Conservative default for other Unix-like systems |
| 381 | return 32768 |
| 382 | } |
| 383 | } |
| 384 | |
| 385 | // isCriticalSystemProcess checks if a PID represents a critical system process |
| 386 | func (pv *ProcessValidator) isCriticalSystemProcess(pid int) bool { |