Re: Reserved PID's

Jon Lewis (
Thu, 24 Jul 1997 16:13:51 -0400 (EDT)

On Thu, 24 Jul 1997, B. James Phillippe wrote:

> I've considered writing a simple PID reservation patch that would
> reserve a number of PID's (controlled on the fly by echo'ing an int to
> /proc/sys/kernel/reserved-pids) for root use only. It sounds easy enough
> to implement. If all non-reserved PID's are in use and a process attempts
> to be created under a UID >0, kernel would return EGAIN. This would allow
> only root-owned processes to fill the process table. In other cases, the
> superuser would be able to log in and fix the problem.

Isn't that already basically done via:

static inline int find_empty_process(void)
int i;

if (nr_tasks >= NR_TASKS - MIN_TASKS_LEFT_FOR_ROOT) {
if (current->uid)
return -EAGAIN;

in include/linux/tasks.h MIN_TASKS_LEFT_FOR_ROOT defaults to 4, but I
generally raise it to 64. Ideally, this should stop anyone but root (or
root owned processes) from filling the process table...if you have enough
processes reserved for root.

Jon Lewis <> | Unsolicited commercial e-mail will
Network Administrator | be proof-read for $199/message.
Florida Digital Turnpike |
________Finger for PGP public key_______