From 7538d461134bf306e31b40e4032f0c225bb40d51 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Tue, 2 Jun 2020 10:33:30 +0200 Subject: 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 --- nptl/pthread_attr_copy.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'nptl/pthread_attr_copy.c') diff --git a/nptl/pthread_attr_copy.c b/nptl/pthread_attr_copy.c index 77a1a43..eb29557 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) { -- cgit v1.1