linux-lock-tracking-20070208
authorJeffrey Hutzelman <jhutz@cmu.edu>
Thu, 8 Feb 2007 22:37:41 +0000 (22:37 +0000)
committerDerrick Brashear <shadow@dementia.org>
Thu, 8 Feb 2007 22:37:41 +0000 (22:37 +0000)
FIXES 31818

avoid a potential leaked lock when closing firefox.

acinclude.m4
src/afs/LINUX/osi_machdep.h
src/afs/afs_osi.h
src/cf/linux-test4.m4

index db38569..50a9419 100644 (file)
@@ -622,6 +622,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_RLIM
                 LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM
                 LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_EXIT_STATE
+                LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_TGID
                 LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_TODO
                 LINUX_GET_SB_HAS_STRUCT_VFSMOUNT
                 LINUX_STATFS_TAKES_DENTRY
@@ -801,6 +802,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 if test "x$ac_cv_linux_sched_struct_task_struct_has_exit_state" = "xyes"; then 
                  AC_DEFINE(STRUCT_TASK_STRUCT_HAS_EXIT_STATE, 1, [define if your struct task_struct has exit_state])
                 fi
+                if test "x$ac_cv_linux_sched_struct_task_struct_has_tgid" = "xyes"; then 
+                 AC_DEFINE(STRUCT_TASK_STRUCT_HAS_TGID, 1, [define if your struct task_struct has tgid])
+                fi
                 if test "x$ac_cv_linux_sched_struct_task_struct_has_todo" = "xyes"; then 
                  AC_DEFINE(STRUCT_TASK_STRUCT_HAS_TODO, 1, [define if your struct task_struct has todo])
                 fi
index 52488af..836a98d 100644 (file)
 
 #undef getuerror
 
+#ifdef STRUCT_TASK_STRUCT_HAS_TGID
+#define getpid() current->tgid
+#ifdef STRUCT_TASK_STRUCT_HAS_REAL_PARENT
+#define getppid() current->real_parent->tgid
+#elif defined(STRUCT_TASK_STRUCT_HAS_PARENT)
+#define getppid() current->parent->tgid
+#else
+#define getppid() current->p_opptr->tgid
+#endif
+#else /* !STRUCT_TASK_STRUCT_HAS_TGID */
 #define getpid() current->pid
 #ifdef STRUCT_TASK_STRUCT_HAS_REAL_PARENT
 #define getppid() current->real_parent->pid
@@ -36,6 +46,7 @@
 #else
 #define getppid() current->p_opptr->pid
 #endif
+#endif /* STRUCT_TASK_STRUCT_HAS_TGID */
 
 #ifdef RECALC_SIGPENDING_TAKES_VOID
 #define RECALC_SIGPENDING(X) recalc_sigpending()
index 9eb0a27..c66ece8 100644 (file)
@@ -212,8 +212,12 @@ typedef struct timeval osi_timeval_t;
 /* should use curthread, but 'ps' can't display it */
 #define osi_ThreadUnique()     curproc
 #else
+#ifdef AFS_LINUX_ENV
+#define osi_ThreadUnique()     (current->pid)
+#else
 #define osi_ThreadUnique()     getpid()
 #endif
+#endif
 
 
 
index 6beb68c..0fd4e3c 100644 (file)
@@ -333,6 +333,18 @@ printk("%d\n", _tsk.parent);],
   AC_MSG_RESULT($ac_cv_linux_sched_struct_task_struct_has_parent)])
 
 
+AC_DEFUN([LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_TGID], [
+  AC_MSG_CHECKING([for tgid in struct task_struct])
+  AC_CACHE_VAL([ac_cv_linux_sched_struct_task_struct_has_tgid], [
+    AC_TRY_KBUILD(
+[#include <linux/sched.h>],
+[struct task_struct _tsk;
+printk("%d\n", _tsk.tgid);],
+      ac_cv_linux_sched_struct_task_struct_has_tgid=yes,
+      ac_cv_linux_sched_struct_task_struct_has_tgid=no)])
+  AC_MSG_RESULT($ac_cv_linux_sched_struct_task_struct_has_tgid)])
+
+
 AC_DEFUN([LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_REAL_PARENT], [
   AC_MSG_CHECKING([for real_parent in struct task_struct])
   AC_CACHE_VAL([ac_cv_linux_sched_struct_task_struct_has_real_parent], [