Linux Headquarters
[ Register ]
[ About us ] [ Home Page ]

[ Kernel ] [ Documentation ] [ Links ] [ Books ]

Advertisement

Kernel v2.6.24 /kernel/posix-cpu-timers.c

Filename:/kernel/posix-cpu-timers.c
Lines Added:6
Lines Deleted:6
Also changed in: (Previous) 2.6.24-rc8  2.6.24-rc7  2.6.24-rc6  2.6.24-rc5  2.6.24-rc4  2.6.24-rc3 
(Following) 2.6.24-git2  2.6.24-git3  2.6.24-git4  2.6.24-git5  2.6.24-git6  2.6.24-git7 

Location
[  2.6.24
  [  kernel
     o  posix-cpu-timers.c

Patch

diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
index b53c8fc..68c9637 100644
--- a/kernel/posix-cpu-timers.c
+++ b/kernel/posix-cpu-timers.c
@@ -21,8 +21,8 @@ static int check_clock(const clockid_t which_clock)
 
    read_lock(&tasklist_lock);
    p = find_task_by_pid(pid);
-   if (!p || (CPUCLOCK_PERTHREAD(which_clock) ?
-         p->tgid != current->tgid : p->tgid != pid)) {
+   if (!p || !(CPUCLOCK_PERTHREAD(which_clock) ?
+         same_thread_group(p, current) : thread_group_leader(p))) {
       error = -EINVAL;
    }
    read_unlock(&tasklist_lock);
@@ -308,13 +308,13 @@ int posix_cpu_clock_get(const clockid_t which_clock, struct timespec *tp)
       p = find_task_by_pid(pid);
       if (p) {
          if (CPUCLOCK_PERTHREAD(which_clock)) {
-            if (p->tgid == current->tgid) {
+            if (same_thread_group(p, current)) {
                error = cpu_clock_sample(which_clock,
                          p, &rtn);
             }
          } else {
             read_lock(&tasklist_lock);
-            if (p->tgid == pid && p->signal) {
+            if (thread_group_leader(p) && p->signal) {
                error =
                    cpu_clock_sample_group(which_clock,
                                 p, &rtn);
@@ -355,7 +355,7 @@ int posix_cpu_timer_create(struct k_itimer *new_timer)
          p = current;
       } else {
          p = find_task_by_pid(pid);
-         if (p && p->tgid != current->tgid)
+         if (p && !same_thread_group(p, current))
             p = NULL;
       }
    } else {
@@ -363,7 +363,7 @@ int posix_cpu_timer_create(struct k_itimer *new_timer)
          p = current->group_leader;
       } else {
          p = find_task_by_pid(pid);
-         if (p && p->tgid != pid)
+         if (p && !thread_group_leader(p))
             p = NULL;
       }
    }


Comments: webmaster (at) linuxhq.com.
Advertising: banners (at) linuxhq.com.
Compilation ©1998-2008 Linux Headquarters, Inc.