Page MenuHomeFreeBSD

Don't hardcode maximum PID.
AcceptedPublic

Authored by pjd on Jan 18 2024, 4:08 PM.
Tags
None
Referenced Files
F164734055: D43496.id132932.diff
Mon, Aug 3, 10:55 AM
F164734047: D43496.id132932.diff
Mon, Aug 3, 10:55 AM
F164734043: D43496.id132932.diff
Mon, Aug 3, 10:55 AM
F164734038: D43496.id132932.diff
Mon, Aug 3, 10:55 AM
F164734025: D43496.id132932.diff
Mon, Aug 3, 10:55 AM
Unknown Object (File)
Sun, Aug 2, 12:44 AM
Unknown Object (File)
Sun, Aug 2, 12:44 AM
Unknown Object (File)
Sun, Jul 26, 8:45 AM
Subscribers

Details

Summary
  • Obtain maximum PID from kern.pid_max_limit sysctl, not kern.pid_max, as kern.pid_max can be lowered while processes with higher PIDs still exist.
  • Use kern.pid_max_limit and hw.ncpu to calculate column widths in top(1).
  • pkill: Don't check if the PID is greater than pid_max. It doesn't really help much - kill(2) will fail on invalid PID anyway. We do want to check for MIN_PID, so we won't kill so important system processes.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 55511
Build 52400: arc lint + arc unit

Event Timeline

pjd requested review of this revision.Jan 18 2024, 4:08 PM
lib/libc/gen/sched_getaffinity.c
37–38

Looking anew at the libc chunks, I think we can safely remove P_OSREL_TIDPID compat instead of patching it. All kernels running this libc must be newer than the 14.0 branch point.

Remove compatibility code from libc.

Requested by: kib

The libc bits, the removal of the compat code, should be a separate commit.

This revision is now accepted and ready to land.Jan 20 2024, 6:11 PM
pjd marked an inline comment as done.Jan 20 2024, 7:41 PM
oshogbo added inline comments.
bin/ps/ps.c
102

Is this indentation correct?