Page MenuHomeFreeBSD

Don't hardcode maximum PID.

Authored by pjd on Jan 18 2024, 4:08 PM.
Referenced Files
Unknown Object (File)
Fri, Apr 19, 7:52 AM
Unknown Object (File)
Mar 2 2024, 4:43 PM
Unknown Object (File)
Feb 19 2024, 10:14 PM
Unknown Object (File)
Feb 17 2024, 7:34 AM
Unknown Object (File)
Jan 28 2024, 2:00 AM
Unknown Object (File)
Jan 19 2024, 12:53 PM
Unknown Object (File)
Jan 18 2024, 7:11 PM
Unknown Object (File)
Jan 18 2024, 7:08 PM


  • 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

rG FreeBSD src repository
Lint Skipped
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

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.

Is this indentation correct?