Messages in this thread Patch in this message | | | Date | Thu, 18 Mar 1999 03:25:12 +0100 (CET) | From | Andrea Arcangeli <> | Subject | Re: [patch] Re: vfork failing - posix compliance fix |
| |
On Wed, 17 Mar 1999, Pavel Machek wrote:
>It seems to me that this patch is required for correct return code >(according to posix). (It is much better idea than returning >ENOMEM, because we return ENOMEM for almost anything else.)
Agreed.
>--- 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 = -EAGAIN; > goto bad_fork_free; >+ } > }
I have a _minor_ remark only about the implementation. I think this my approch will perform a bit better.
In general I think that the goto has to be the only thing to be done in the if(true)path to make sure that the fast path will be preserved.
Index: kernel/fork.c =================================================================== RCS file: /var/cvs/linux/kernel/fork.c,v retrieving revision 1.1.1.4 retrieving revision 1.1.2.14 diff -u -r1.1.1.4 -r1.1.2.14 --- fork.c 1999/03/09 00:55:51 1.1.1.4 +++ linux/kernel/fork.c 1999/03/17 18:38:29 1.1.2.14 @@ -506,6 +509,7 @@ goto fork_out; *p = *current; + retval = -EAGAIN; down(¤t->mm->mmap_sem); lock_kernel(); @@ -518,7 +522,6 @@ { struct task_struct **tslot; tslot = find_empty_process(); - retval = -EAGAIN; if (!tslot) goto bad_fork_free; p->tarray_ptr = tslot; Andrea Arcangeli
- 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/
| |