Set cpuset using pthread_getaffinity_np.
authordrepper <drepper>
Wed, 17 Sep 2003 18:21:55 +0000 (18:21 +0000)
committerdrepper <drepper>
Wed, 17 Sep 2003 18:21:55 +0000 (18:21 +0000)
nptl/pthread_getattr_np.c

index 9a920f5..9cc948f 100644 (file)
@@ -132,6 +132,23 @@ pthread_getattr_np (thread_id, attr)
 
   iattr->flags |= ATTR_FLAG_STACKADDR;
 
+  if (ret == 0)
+    {
+      iattr->cpuset = (cpu_set_t *) malloc (sizeof (cpu_set_t));
+      if (iattr->cpuset == NULL)
+       ret = ENOMEM;
+      else
+       {
+         ret = pthread_getaffinity_np (thread_id, iattr->cpuset);
+         if (ret == ENOSYS)
+           {
+             free (iattr->cpuset);
+             iattr->cpuset = NULL;
+             ret = 0;
+           }
+       }
+    }
+
   lll_unlock (thread->lock);
 
   pthread_cleanup_pop (0);