Gerrit Huizenga wrote:
> Index: linux-2.6.12-ckrm1/kernel/fork.c
> ===================================================================
> --- linux-2.6.12-ckrm1.orig/kernel/fork.c 2005-06-20 13:08:27.000000000 -0700
> +++ linux-2.6.12-ckrm1/kernel/fork.c 2005-06-20 13:08:34.000000000 -0700
> @@ -42,6 +42,8 @@
> #include <linux/rmap.h>
> #include <linux/acct.h>
> #include <linux/ckrm_events.h>
> +#include <linux/ckrm_tsk.h>
> +#include <linux/ckrm_tc.h>
>
> #include <asm/pgtable.h>
> #include <asm/pgalloc.h>
> @@ -1211,6 +1213,9 @@ long do_fork(unsigned long clone_flags,
> clone_flags |= CLONE_PTRACE;
> }
>
> + if (numtasks_get_ref(¤t->taskclass->core, 0) == 0) {
> + return -ENOMEM;
> + }
> p = copy_process(clone_flags, stack_start, regs, stack_size, parent_tidptr, child_tidptr, pid);
> /*
> * Do this prior waking up the new thread - the thread pointer
> @@ -1250,6 +1255,7 @@ long do_fork(unsigned long clone_flags,
> ptrace_notify ((PTRACE_EVENT_VFORK_DONE << 8) | SIGTRAP);
> }
> } else {
> + numtasks_put_ref(¤t->taskclass->core);
> free_pidmap(pid);
> pid = PTR_ERR(p);
> }
Instead of returning -ENOMEM on fork fail due to numtask or forkrate
limit, I'd rather prefer returning -EAGAIN.
Because, according to IEEE Std 1003.1, if fork() fails due to
reaching limit, it shall set the errno to EAGAIN.
Thanks,
MAEDA Naoaki
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]