about summary refs log tree commit diff
path: root/nptl/pthread_attr_copy.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2020-06-02 10:33:30 +0200
committerFlorian Weimer <fweimer@redhat.com>2020-06-02 11:54:58 +0200
commit7538d461134bf306e31b40e4032f0c225bb40d51 (patch)
tree34c4ceb7c6565864dfc62d8e23dd8f37e24944af /nptl/pthread_attr_copy.c
parent6993670b52daa413717e840dfb17b5322e7f4a88 (diff)
downloadglibc-7538d461134bf306e31b40e4032f0c225bb40d51.tar.gz
glibc-7538d461134bf306e31b40e4032f0c225bb40d51.tar.xz
glibc-7538d461134bf306e31b40e4032f0c225bb40d51.zip
nptl: Make pthread_attr_t dynamically extensible
This introduces the function __pthread_attr_extension to allocate the
extension space, which is freed by pthread_attr_destroy.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'nptl/pthread_attr_copy.c')
-rw-r--r--nptl/pthread_attr_copy.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/nptl/pthread_attr_copy.c b/nptl/pthread_attr_copy.c
index 77a1a43eeb..eb29557505 100644
--- a/nptl/pthread_attr_copy.c
+++ b/nptl/pthread_attr_copy.c
@@ -29,18 +29,20 @@ __pthread_attr_copy (pthread_attr_t *target, const pthread_attr_t *source)
   temp.external = *source;
 
   /* Force new allocation.  This function has full ownership of temp.  */
-  temp.internal.cpuset = NULL;
-  temp.internal.cpusetsize = 0;
+  temp.internal.extension = NULL;
 
   int ret = 0;
 
   struct pthread_attr *isource = (struct pthread_attr *) source;
 
-  /* Propagate affinity mask information.  */
-  if (isource->cpusetsize > 0)
-    ret = __pthread_attr_setaffinity_np (&temp.external,
-                                         isource->cpusetsize,
-                                         isource->cpuset);
+  if (isource->extension != NULL)
+    {
+      /* Propagate affinity mask information.  */
+      if (isource->extension->cpusetsize > 0)
+        ret = __pthread_attr_setaffinity_np (&temp.external,
+                                             isource->extension->cpusetsize,
+                                             isource->extension->cpuset);
+    }
 
   if (ret != 0)
     {