Re: vfork failing

Stephen C. Tweedie (sct@redhat.com)
Thu, 18 Mar 1999 17:28:09 GMT


Hi,

On Tue, 16 Mar 1999 20:58:49 +0100, Pavel Machek <pavel@bug.ucw.cz>
said:

> Hi!
> Pilot error. I had limit 256 of proccesses for each user, which was
> easily exhausted by this. Kernel reports ENOMEM in such case, which is
> I believe wrong. ENOMEM4U would be much better, EPERM seems
> reasonable. Any comments? Do I break posix? (I'm not sending it to
> linus. Yet.)

>From SingleUnix:

The vfork() function will fail if:

[EAGAIN]
The system-wide limit on the total number of processes
under execution would be exceeded, or the system-imposed
limit on the total number of processes under execution by
a single user would be exceeded.
[ENOMEM]
There is insufficient swap space for the new process.

EAGAIN is the one you want, not EPERM.

--Stephen

> Pavel

> --- clean/kernel/fork.c Wed Mar 10 22:37:42 1999
> +++ linux/kernel/fork.c Tue Mar 16 00:03:14 1999
> @@ -511,8 +533,10 @@
> lock_kernel();
>
> if (p->user) {
> - if (atomic_read(&p->user->count) >= p->rlim[RLIMIT_NPROC].rlim_cur)
> + if (atomic_read(&p->user->count) >= p->rlim[RLIMIT_NPROC].rlim_cur) {
> + retval = -EPERM;
> goto bad_fork_free;
> + }
> }
>
> {

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/