Re: CLONE_DETACHED and exit notification (was user-vm-unlock-2.5.31-A2)

From: Ingo Molnar (mingo@elte.hu)
Date: Sat Aug 17 2002 - 13:48:57 EST


On Fri, 16 Aug 2002, Linus Torvalds wrote:

> Oh, good. If it turns out that even pthreads wants the futex, let's just
> do it that way. Pls send in a patch once you have something tested
> ready, ok?

tested patch (against BK-curr-ish) attached. glibc/pthreads had been
updated to use the TID-futex, this removes an extra system-call and it
also simplifies the pthread_join() code. The pthreads testcode works just
fine with the new kernel and does not work with a kernel that does not do
the futex wakeup, so it's working fine.

        Ingo

--- linux/include/linux/futex.h.orig Sat Aug 17 20:45:01 2002
+++ linux/include/linux/futex.h Sat Aug 17 20:45:07 2002
@@ -6,4 +6,6 @@
 #define FUTEX_WAKE (1)
 #define FUTEX_FD (2)
 
+extern asmlinkage int sys_futex(void *uaddr, int op, int val, struct timespec *utime);
+
 #endif
--- linux/kernel/fork.c.orig Sat Aug 17 20:45:17 2002
+++ linux/kernel/fork.c Sat Aug 17 20:46:30 2002
@@ -26,6 +26,7 @@
 #include <linux/mman.h>
 #include <linux/fs.h>
 #include <linux/security.h>
+#include <linux/futex.h>
 
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
@@ -370,12 +371,14 @@
                 tsk->vfork_done = NULL;
                 complete(vfork_done);
         }
- if (tsk->user_tid)
+ if (tsk->user_tid) {
                 /*
                  * We dont check the error code - if userspace has
                  * not set up a proper pointer then tough luck.
                  */
                 put_user(0UL, tsk->user_tid);
+ sys_futex(tsk->user_tid, FUTEX_WAKE, 1, NULL);
+ }
 }
 
 static int copy_mm(unsigned long clone_flags, struct task_struct * tsk)

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



This archive was generated by hypermail 2b29 : Fri Aug 23 2002 - 22:00:14 EST