Re: [PATCH] Prevent OOM from killing init

Patrick O'Rourke
2001-03-21T23:42:35Z

Eli Carter wrote:

> Having not looked at the code... Why not "if( p->pid > 1 )"? (Or can
> p->pid can be negative?!, um, typecast to unsigned...)

I simply mirrored the check done in do_exit():

if (tsk->pid == 1)
panic("Attempted to kill init!");

Since PID_MAX is 32768 I do not believe pids can be negative.

I suppose one could make an argument for skipping "daemons", i.e.
pids below 300 (see the get_pid() function in kernel/fork.c), but
I think that is a larger issue.

Pat

--
Patrick O'Rourke
978.606.0236
orourke@missioncriticallinux.com