[Glibc-bsd-commits] r4606 - in trunk/glibc-ports/kfreebsd: . fbtl

Petr Salinger ps-guest at alioth.debian.org
Mon Jul 8 12:47:19 UTC 2013


Author: ps-guest
Date: 2013-06-25 07:41:24 +0000 (Tue, 25 Jun 2013)
New Revision: 4606

Modified:
   trunk/glibc-ports/kfreebsd/fbtl/Makefile
   trunk/glibc-ports/kfreebsd/fbtl/fork.c
   trunk/glibc-ports/kfreebsd/fbtl/lowlevellock.c
   trunk/glibc-ports/kfreebsd/fbtl/lowlevellock.h
   trunk/glibc-ports/kfreebsd/fbtl/pt-raise.c
   trunk/glibc-ports/kfreebsd/fbtl/pthread_kill.c
   trunk/glibc-ports/kfreebsd/syscalls-inline.h
Log:
ktid changes - part1


Modified: trunk/glibc-ports/kfreebsd/fbtl/Makefile
===================================================================
--- trunk/glibc-ports/kfreebsd/fbtl/Makefile	2013-06-25 07:40:03 UTC (rev 4605)
+++ trunk/glibc-ports/kfreebsd/fbtl/Makefile	2013-06-25 07:41:24 UTC (rev 4606)
@@ -34,6 +34,12 @@
 
 ifeq ($(subdir),fbtl)
 libpthread-routines += ptw-sys_sigprocmask ptw-sys_umtx
+libpthread-routines += ptw-sys_thr_kill
+libpthread-routines += ptw-sys_thr_kill2
+libpthread-routines += ptw-sys_thr_new
+libpthread-routines += ptw-sys_thr_self
+libpthread-routines += ptw-sys_thr_set_name
+libpthread-routines += ptw-sys_thr_exit
 endif
 
 ifeq ($(subdir),posix)

Modified: trunk/glibc-ports/kfreebsd/fbtl/fork.c
===================================================================
--- trunk/glibc-ports/kfreebsd/fbtl/fork.c	2013-06-25 07:40:03 UTC (rev 4605)
+++ trunk/glibc-ports/kfreebsd/fbtl/fork.c	2013-06-25 07:41:24 UTC (rev 4606)
@@ -143,7 +143,9 @@
 #else
       { 
          int val = __getpid();
-         THREAD_SETMEM (self, tid, val);
+         THREAD_SETMEM (self, pid, val);
+         INLINE_SYSCALL(thr_self, 1, &(self->ktid));
+                 
 # warning fetch both getpid() and ktid via SYS_thr_self
       }   
 #endif      

Modified: trunk/glibc-ports/kfreebsd/fbtl/lowlevellock.c
===================================================================
--- trunk/glibc-ports/kfreebsd/fbtl/lowlevellock.c	2013-06-25 07:40:03 UTC (rev 4605)
+++ trunk/glibc-ports/kfreebsd/fbtl/lowlevellock.c	2013-06-25 07:41:24 UTC (rev 4606)
@@ -90,17 +90,16 @@
   return 0;
 }
 
-#if 0
 int
-__lll_timedwait_tid (int *tidp, const struct timespec *abstime)
+__lll_timedwait_tid (long *tidp, const struct timespec *abstime)
 {
-  int tid;
+  long tid;
 
   if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)
     return EINVAL;
 
   /* Repeat until thread terminated.  */
-  while ((tid = *tidp) != 0)
+  while ((tid = *tidp) != KTID_TERMINATED)
     {
       struct timeval tv;
       struct timespec rt;
@@ -122,12 +121,9 @@
 	return ETIMEDOUT;
 
       /* Wait until thread terminates.  */
-      // XYZ: Lost the lock to check whether it was private.
-      if (lll_futex_timed_wait (tidp, tid, &rt, LLL_SHARED) == -ETIMEDOUT)
-	return ETIMEDOUT;
+      lll_umtx_long_wait_shared (tidp, tid, &rt);
     }
 
   return 0;
 }
 #endif
-#endif

Modified: trunk/glibc-ports/kfreebsd/fbtl/lowlevellock.h
===================================================================
--- trunk/glibc-ports/kfreebsd/fbtl/lowlevellock.h	2013-06-25 07:40:03 UTC (rev 4605)
+++ trunk/glibc-ports/kfreebsd/fbtl/lowlevellock.h	2013-06-25 07:41:24 UTC (rev 4606)
@@ -27,7 +27,7 @@
 
 #define LLL_PRIVATE	0
 #define LLL_SHARED	FUTEX_PRIVATE_FLAG
-
+#define KTID_TERMINATED 1
 #include <stap-probe.h>
 
 #ifndef __ASSEMBLER__
@@ -140,35 +140,28 @@
   (futex != 0)
 
 
-#if 1
-/* TODO:::::  #warning pthread join waiting */
-#define lll_wait_tid(tid)	do {} while (0)
-#define lll_timedwait_tid(tid, abstime)	0
-#else
 /* The kernel notifies a process which uses CLONE_CHILD_CLEARTID via futex
    wakeup when the clone terminates.  The memory location contains the
-   thread ID while the clone is running and is reset to zero
+   thread ID while the clone is running and is reset to one (not zero as on linux)
    afterwards.	*/
 #define lll_wait_tid(tid) \
   do {					\
     __typeof (tid) __tid;		\
-    while ((__tid = (tid)) != 0)	\
-      lll_futex_wait (&(tid), __tid, LLL_SHARED);\
+    while ((__tid = (tid)) != KTID_TERMINATED)	\
+      lll_umtx_long_wait_shared (&(tid), __tid, NULL);\
   } while (0)
 
-extern int __lll_timedwait_tid (int *, const struct timespec *)
+extern int __lll_timedwait_tid (long *, const struct timespec *)
      attribute_hidden;
 
 #define lll_timedwait_tid(tid, abstime) \
   ({							\
     int __res = 0;					\
-    if ((tid) != 0)					\
+    if ((tid) != KTID_TERMINATED)			\
       __res = __lll_timedwait_tid (&(tid), (abstime));	\
     __res;						\
   })
   
-#endif
-
 #endif  /* !__ASSEMBLER__ */
 
 #endif	/* lowlevellock.h */

Modified: trunk/glibc-ports/kfreebsd/fbtl/pt-raise.c
===================================================================
--- trunk/glibc-ports/kfreebsd/fbtl/pt-raise.c	2013-06-25 07:40:03 UTC (rev 4605)
+++ trunk/glibc-ports/kfreebsd/fbtl/pt-raise.c	2013-06-25 07:41:24 UTC (rev 4606)
@@ -30,6 +30,9 @@
   /* raise is an async-safe function.  It could be called while the
      fork function temporarily invalidated the PID field.  Adjust for
      that.  */
+     
+     return INLINE_SYSCALL(thr_kill, 2, THREAD_GETMEM (THREAD_SELF, tid), sig);
+     
 #warning TODO all
 #if 0
   pid_t pid = THREAD_GETMEM (THREAD_SELF, pid);

Modified: trunk/glibc-ports/kfreebsd/fbtl/pthread_kill.c
===================================================================
--- trunk/glibc-ports/kfreebsd/fbtl/pthread_kill.c	2013-06-25 07:40:03 UTC (rev 4605)
+++ trunk/glibc-ports/kfreebsd/fbtl/pthread_kill.c	2013-06-25 07:41:24 UTC (rev 4606)
@@ -48,6 +48,8 @@
      for the setxid implementation.  */
   if (signo == SIGCANCEL || signo == SIGTIMER || signo == SIGSETXID)
     return EINVAL;
+    
+  return INLINE_SYSCALL(thr_kill, 2, tid, signo);  
 #warning  kill needed    
 #if 0
   /* We have a special syscall to do the work.  */

Modified: trunk/glibc-ports/kfreebsd/syscalls-inline.h
===================================================================
--- trunk/glibc-ports/kfreebsd/syscalls-inline.h	2013-06-25 07:40:03 UTC (rev 4605)
+++ trunk/glibc-ports/kfreebsd/syscalls-inline.h	2013-06-25 07:41:24 UTC (rev 4606)
@@ -58,4 +58,18 @@
 libc_hidden_proto (__syscall_sigprocmask)
 libc_hidden_proto (__syscall_nanosleep)
 
+
+int __syscall_thr_exit(long *p);
+int __syscall_thr_kill(long id, int sig);
+int __syscall_thr_kill2(int pid, long id, int sig);
+int __syscall_thr_new(void *arg, int size);
+int __syscall_thr_self(long *id);
+int __syscall_thr_set_name(long id, char*name);
+libc_hidden_proto (__syscall_thr_exit)
+libc_hidden_proto (__syscall_thr_kill)
+libc_hidden_proto (__syscall_thr_kill2)
+libc_hidden_proto (__syscall_thr_new)
+libc_hidden_proto (__syscall_thr_self)
+libc_hidden_proto (__syscall_thr_set_name)
+
 #endif




More information about the Glibc-bsd-commits mailing list