Page MenuHomeFreeBSD

Don't hardcode maximum PID.
AcceptedPublic

Authored by pjd on Jan 18 2024, 4:08 PM.
Tags
None
Referenced Files
F123173928: D43496.id.diff
Fri, Jul 11, 9:02 PM
Unknown Object (File)
Wed, Jul 9, 5:50 PM
Unknown Object (File)
Mon, Jun 30, 2:18 AM
Unknown Object (File)
Tue, Jun 24, 11:49 AM
Unknown Object (File)
Sun, Jun 22, 12:51 AM
Unknown Object (File)
Thu, Jun 19, 5:41 PM
Unknown Object (File)
Wed, Jun 18, 9:19 PM
Unknown Object (File)
Wed, Jun 18, 2:29 PM
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 55478
Build 52367: arc lint + arc unit

Event Timeline

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

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?