This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH v3] New functions pthread_[sg]etattr_default_np for default thread attributes
- From: Siddhesh Poyarekar <siddhesh at redhat dot com>
- To: Roland McGrath <roland at hack dot frob dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Thu, 6 Jun 2013 18:42:13 +0530
- Subject: [PATCH v3] New functions pthread_[sg]etattr_default_np for default thread attributes
- References: <20130314122003 dot GY22471 at spoyarek dot pnq dot redhat dot com> <20130314154905 dot ADDDD2C09C at topped-with-meat dot com> <20130315043154 dot GG22471 at spoyarek dot pnq dot redhat dot com> <20130318222239 dot 7A2712C084 at topped-with-meat dot com> <CAAHN_R13bRF0UY_XZ7Rj6tSeSgq8c_0j4bbEH6m9BbGD32EycQ at mail dot gmail dot com> <20130528220730 dot 33C262C06F at topped-with-meat dot com> <20130529065138 dot GF2145 at spoyarek dot pnq dot redhat dot com> <20130529224222 dot 8A87F2C07E at topped-with-meat dot com>
Hi,
Here's the updated patch now, with the test case covering all
attributes that could be set as default. I have renamed the functions
to pthread_{g,s}etattr_default_np as suggested, hence the change in
the subject as well.
Siddhesh
ChangeLog:
* Versions.def (libpthread): Add GLIBC_2.18.
* sysdeps/unix/sysv/linux/i386/nptl/libpthread.abilist: Add
GLIBC_2.18
(GLIBC_2.18): Add pthread_getattr_default_np and
pthread_setattr_default_np.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libpthread.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libpthread.abilist:
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/nptl/libpthread.abilist:
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/nptl/libpthread.abilist:
Likewise.
* sysdeps/unix/sysv/linux/sh/nptl/libpthread.abilist:
Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libpthread.abilist:
Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libpthread.abilist:
Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/nptl/libpthread.abilist:
Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/nptl/libpthread.abilist:
Likewise.
nptl/ChangeLog:
* Makefile (libpthread-routines): Add
pthread_setattr_default_np and pthread_getattr_default_np.
(tests): Add tst-default-attr.
* Versions (libpthread): Add GLIBC_2.18.
(GLIBC_2.18): Add pthread_setattr_default_np and
pthread_getattr_default_np.
* nptl-init.c (__pthread_initialize_minimal_internal):
Initialize default guardsize.
* pthread_getattr_default_np.c: New file.
* pthread_setattr_default_np.c: New file.
* pthread_create.c (__pthread_create_2_1): Allow default flags
to be used.
* sysdeps/pthread/pthread.h (pthread_getattr_default_np,
pthread_setattr_default_np): Declare.
* tst-default-attr.c: New test case.
ChangeLog.tile
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libpthread.abilist:
Add GLIBC_2.18.
(GLIBC_2.18): Add pthread_getattr_default_np and
pthread_setattr_default_np.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libpthread.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/nptl/libpthread.abilist:
Likewise.
ChangeLog.m68k
* sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libpthread.abilist:
Add GLIBC_2.18.
(GLIBC_2.18): Add pthread_getattr_default_np and
pthread_setattr_default_np.
* sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libpthread.abilist:
Likewise.
ChangeLog.ia64
* sysdeps/unix/sysv/linux/ia64/nptl/libpthread.abilist:
Add GLIBC_2.18.
(GLIBC_2.18): Add pthread_getattr_default_np and
pthread_setattr_default_np.
ChangeLog.aarch64
* sysdeps/unix/sysv/linux/aarch64/nptl/libpthread.abilist:
Add GLIBC_2.18.
(GLIBC_2.18): Add pthread_getattr_default_np and
pthread_setattr_default_np.
ChangeLog.alpha
* sysdeps/unix/sysv/linux/alpha/nptl/libpthread.abilist:
Add GLIBC_2.18.
(GLIBC_2.18): Add pthread_getattr_default_np and
pthread_setattr_default_np.
ChangeLog.powerpc
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libpthread.abilist:
Add GLIBC_2.18.
(GLIBC_2.18): Add pthread_getattr_default_np and
pthread_setattr_default_np.
ChangeLog.arm
* sysdeps/unix/sysv/linux/arm/nptl/libpthread.abilist:
Add GLIBC_2.18.
(GLIBC_2.18): Add pthread_getattr_default_np and
pthread_setattr_default_np.
ChangeLog.mips
* sysdeps/unix/sysv/linux/mips/mips32/nptl/libpthread.abilist:
Add GLIBC_2.18.
(GLIBC_2.18): Add pthread_getattr_default_np and
pthread_setattr_default_np.
* sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libpthread.abilist:
Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libpthread.abilist:
Likewise.
diff --git a/Versions.def b/Versions.def
index 0462239..0854e6e 100644
--- a/Versions.def
+++ b/Versions.def
@@ -102,6 +102,7 @@ libpthread {
GLIBC_2.6
GLIBC_2.11
GLIBC_2.12
+ GLIBC_2.18
GLIBC_PRIVATE
}
libresolv {
diff --git a/nptl/Makefile b/nptl/Makefile
index 7fa991b..f1fbf25 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -125,7 +125,8 @@ libpthread-routines = nptl-init vars events version \
pthread_mutexattr_setprioceiling tpp \
pthread_mutex_getprioceiling \
pthread_mutex_setprioceiling \
- pthread_setname pthread_getname
+ pthread_setname pthread_getname \
+ pthread_setattr_default_np pthread_getattr_default_np
# pthread_setuid pthread_seteuid pthread_setreuid \
# pthread_setresuid \
# pthread_setgid pthread_setegid pthread_setregid \
@@ -201,7 +202,7 @@ CFLAGS-pt-system.c = -fexceptions
tests = tst-typesizes \
- tst-attr1 tst-attr2 tst-attr3 \
+ tst-attr1 tst-attr2 tst-attr3 tst-default-attr \
tst-mutex1 tst-mutex2 tst-mutex3 tst-mutex4 tst-mutex5 tst-mutex6 \
tst-mutex7 tst-mutex8 tst-mutex9 tst-mutex5a tst-mutex7a \
tst-mutexpi1 tst-mutexpi2 tst-mutexpi3 tst-mutexpi4 tst-mutexpi5 \
diff --git a/nptl/Versions b/nptl/Versions
index 6a10375..bb11277 100644
--- a/nptl/Versions
+++ b/nptl/Versions
@@ -252,6 +252,11 @@ libpthread {
pthread_setname_np; pthread_getname_np;
};
+ GLIBC_2.18 {
+ pthread_getattr_default_np;
+ pthread_setattr_default_np;
+ }
+
GLIBC_PRIVATE {
__pthread_initialize_minimal;
__pthread_clock_gettime; __pthread_clock_settime;
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
index 56bf257..08e2fa1 100644
--- a/nptl/allocatestack.c
+++ b/nptl/allocatestack.c
@@ -357,8 +357,19 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
assert (TCB_ALIGNMENT >= STACK_ALIGN);
/* Get the stack size from the attribute if it is set. Otherwise we
- use the default we determined at start time. */
- size = attr->stacksize ?: __default_pthread_attr.stacksize;
+ use the default we determined at start time. Our lock attempt here will
+ never trip with the lock in pthread_create because the stacksize in
+ __default_pthread_attr_lock will never be zero. So if we deadlock on
+ ourselves here, it is because a bug led to
+ __default_pthread_attr.stacksize being zero. */
+ if (attr->stacksize)
+ size = attr->stacksize;
+ else
+ {
+ lll_lock (__default_pthread_attr_lock, LLL_PRIVATE);
+ size = __default_pthread_attr.stacksize;
+ lll_unlock (__default_pthread_attr_lock, LLL_PRIVATE);
+ }
/* Get memory for the stack. */
if (__builtin_expect (attr->flags & ATTR_FLAG_STACKADDR, 0))
@@ -919,8 +930,9 @@ __reclaim_stacks (void)
in_flight_stack = 0;
- /* Initialize the lock. */
+ /* Initialize locks. */
stack_cache_lock = LLL_LOCK_INITIALIZER;
+ __default_pthread_attr_lock = LLL_LOCK_INITIALIZER;
}
diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c
index 63fb729..4e99a38 100644
--- a/nptl/nptl-init.c
+++ b/nptl/nptl-init.c
@@ -423,8 +423,10 @@ __pthread_initialize_minimal_internal (void)
/* Round the resource limit up to page size. */
limit.rlim_cur = (limit.rlim_cur + pagesz - 1) & -pagesz;
+ lll_lock (__default_pthread_attr_lock, LLL_PRIVATE);
__default_pthread_attr.stacksize = limit.rlim_cur;
__default_pthread_attr.guardsize = GLRO (dl_pagesize);
+ lll_unlock (__default_pthread_attr_lock, LLL_PRIVATE);
#ifdef SHARED
/* Transfer the old value from the dynamic linker's internal location. */
diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
index fd52b07..7883fdf 100644
--- a/nptl/pthreadP.h
+++ b/nptl/pthreadP.h
@@ -149,6 +149,7 @@ enum
/* Default pthread attributes. */
extern struct pthread_attr __default_pthread_attr attribute_hidden;
+extern int __default_pthread_attr_lock attribute_hidden;
/* Size and alignment of static TLS block. */
extern size_t __static_tls_size attribute_hidden;
diff --git a/nptl/pthread_attr_getstacksize.c b/nptl/pthread_attr_getstacksize.c
index 42d3f8f..bf0070d 100644
--- a/nptl/pthread_attr_getstacksize.c
+++ b/nptl/pthread_attr_getstacksize.c
@@ -32,7 +32,14 @@ __pthread_attr_getstacksize (attr, stacksize)
/* If the user has not set a stack size we return what the system
will use as the default. */
- *stacksize = iattr->stacksize ?: __default_pthread_attr.stacksize;
+ if (iattr->stacksize)
+ *stacksize = iattr->stacksize;
+ else
+ {
+ lll_lock (__default_pthread_attr_lock, LLL_PRIVATE);
+ *stacksize = __default_pthread_attr.stacksize;
+ lll_unlock (__default_pthread_attr_lock, LLL_PRIVATE);
+ }
return 0;
}
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index b78bd95..24735e7 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -450,17 +450,25 @@ __pthread_create_2_1 (newthread, attr, start_routine, arg)
const struct pthread_attr *iattr = (struct pthread_attr *) attr;
if (iattr == NULL)
- /* Is this the best idea? On NUMA machines this could mean
- accessing far-away memory. */
- iattr = &__default_pthread_attr;
+ {
+ /* Is this the best idea? On NUMA machines this could mean
+ accessing far-away memory. */
+ iattr = &__default_pthread_attr;
+ lll_lock (__default_pthread_attr_lock, LLL_PRIVATE);
+ }
struct pthread *pd = NULL;
int err = ALLOCATE_STACK (iattr, &pd);
+ int retval = 0;
+
if (__builtin_expect (err != 0, 0))
/* Something went wrong. Maybe a parameter of the attributes is
invalid or we could not allocate memory. Note we have to
translate error codes. */
- return err == ENOMEM ? EAGAIN : err;
+ {
+ retval = err == ENOMEM ? EAGAIN : err;
+ goto out;
+ }
/* Initialize the TCB. All initializations with zero should be
@@ -511,8 +519,7 @@ __pthread_create_2_1 (newthread, attr, start_routine, arg)
#endif
/* Determine scheduling parameters for the thread. */
- if (attr != NULL
- && __builtin_expect ((iattr->flags & ATTR_FLAG_NOTINHERITSCHED) != 0, 0)
+ if (__builtin_expect ((iattr->flags & ATTR_FLAG_NOTINHERITSCHED) != 0, 0)
&& (iattr->flags & (ATTR_FLAG_SCHED_SET | ATTR_FLAG_POLICY_SET)) != 0)
{
INTERNAL_SYSCALL_DECL (scerr);
@@ -551,7 +558,8 @@ __pthread_create_2_1 (newthread, attr, start_routine, arg)
__deallocate_stack (pd);
- return EINVAL;
+ retval = EINVAL;
+ goto out;
}
}
@@ -561,7 +569,13 @@ __pthread_create_2_1 (newthread, attr, start_routine, arg)
LIBC_PROBE (pthread_create, 4, newthread, attr, start_routine, arg);
/* Start the thread. */
- return create_thread (pd, iattr, STACK_VARIABLES_ARGS);
+ retval = create_thread (pd, iattr, STACK_VARIABLES_ARGS);
+
+ out:
+ if (attr == NULL)
+ lll_unlock (__default_pthread_attr_lock, LLL_PRIVATE);
+
+ return retval;
}
versioned_symbol (libpthread, __pthread_create_2_1, pthread_create, GLIBC_2_1);
diff --git a/nptl/pthread_getattr_default_np.c b/nptl/pthread_getattr_default_np.c
new file mode 100644
index 0000000..f3a6b47
--- /dev/null
+++ b/nptl/pthread_getattr_default_np.c
@@ -0,0 +1,37 @@
+/* Get the default attributes used by pthread_create in the process.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <stdlib.h>
+#include <pthreadP.h>
+#include <assert.h>
+
+int
+pthread_getattr_default_np (pthread_attr_t *out)
+{
+ struct pthread_attr *real_out;
+
+ assert (sizeof (*out) >= sizeof (struct pthread_attr));
+ real_out = (struct pthread_attr *) out;
+
+ lll_lock (__default_pthread_attr_lock, LLL_PRIVATE);
+ *real_out = __default_pthread_attr;
+ lll_unlock (__default_pthread_attr_lock, LLL_PRIVATE);
+
+ return 0;
+}
diff --git a/nptl/pthread_setattr_default_np.c b/nptl/pthread_setattr_default_np.c
new file mode 100644
index 0000000..b897d93
--- /dev/null
+++ b/nptl/pthread_setattr_default_np.c
@@ -0,0 +1,110 @@
+/* Set the default attributes to be used by pthread_create in the process.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <stdlib.h>
+#include <pthreadP.h>
+#include <assert.h>
+
+int
+pthread_setattr_default_np (const pthread_attr_t *in)
+{
+ struct pthread_attr *real_in, attrs;
+ int ret;
+
+ assert (sizeof (*in) >= sizeof (struct pthread_attr));
+ real_in = (struct pthread_attr *) in;
+
+ /* Catch invalid values. */
+ int policy = real_in->schedpolicy;
+
+ ret = check_sched_policy_attr (policy);
+ if (ret)
+ return ret;
+
+ struct sched_param *param = &real_in->schedparam;
+
+ if (param->sched_priority > 0)
+ {
+ ret = check_sched_priority_attr (param->sched_priority, policy);
+
+ if (ret)
+ return ret;
+ }
+
+ ret = check_cpuset_attr (real_in->cpuset, real_in->cpusetsize);
+ if (ret)
+ return ret;
+
+ /* stacksize == 0 is fine. It means that we don't change the current
+ value. */
+ if (real_in->stacksize != 0)
+ {
+ ret = check_stacksize_attr (real_in->stacksize);
+ if (ret)
+ return ret;
+ }
+ else
+ real_in->stacksize = __default_pthread_attr.stacksize;
+
+ /* Having a default stack address is wrong. */
+ if (real_in->flags & ATTR_FLAG_STACKADDR)
+ return EINVAL;
+
+ attrs = *real_in;
+
+ /* Mantain stacksize as a non-zero value. This is a computed fallback that
+ we get on library initialization, so we don't want to overwrite it unless
+ there is a valid value to replace it. */
+ if (real_in->stacksize > 0)
+ attrs.stacksize = real_in->stacksize;
+
+ /* Now take the lock because we start writing into
+ __default_pthread_attr. */
+ lll_lock (__default_pthread_attr_lock, LLL_PRIVATE);
+
+ /* Free the cpuset if the input is 0. Otherwise copy in the cpuset
+ contents. */
+ if (attrs.cpuset == NULL || attrs.cpusetsize == 0)
+ free (__default_pthread_attr.cpuset);
+ else if (attrs.cpusetsize != __default_pthread_attr.cpusetsize)
+ {
+ /* This may look wrong at first sight, but it isn't. We're freeing
+ __default_pthread_attr.cpuset and allocating to attrs.cpuset because
+ we'll copy over all of attr to __default_pthread_attr later. */
+ void *newp = (cpu_set_t *) realloc (__default_pthread_attr.cpuset,
+ attrs.cpusetsize);
+
+ if (newp == NULL)
+ {
+ ret = ENOMEM;
+ goto out;
+ }
+
+ attrs.cpuset = newp;
+ }
+ else
+ attrs.cpuset = __default_pthread_attr.cpuset;
+
+ memcpy (attrs.cpuset, real_in->cpuset, real_in->cpusetsize);
+ __default_pthread_attr = attrs;
+
+ out:
+ lll_unlock (__default_pthread_attr_lock, LLL_PRIVATE);
+ return ret;
+}
diff --git a/nptl/sysdeps/pthread/pthread.h b/nptl/sysdeps/pthread/pthread.h
index 10bcb80..ded5ae5 100644
--- a/nptl/sysdeps/pthread/pthread.h
+++ b/nptl/sysdeps/pthread/pthread.h
@@ -404,6 +404,14 @@ extern int pthread_attr_getaffinity_np (const pthread_attr_t *__attr,
cpu_set_t *__cpuset)
__THROW __nonnull ((1, 3));
+/* Get the default attributes used by pthread_create in this process. */
+extern int pthread_getattr_default_np (pthread_attr_t *__attr)
+ __THROW __nonnull ((1));
+
+/* Set the default attributes to be used by pthread_create in this
+ process. */
+extern int pthread_setattr_default_np (const pthread_attr_t *__attr)
+ __THROW __nonnull ((1));
/* Initialize thread attribute *ATTR with attributes corresponding to the
already running thread TH. It shall be called on uninitialized ATTR
diff --git a/nptl/tst-default-attr.c b/nptl/tst-default-attr.c
new file mode 100644
index 0000000..32a48ec
--- /dev/null
+++ b/nptl/tst-default-attr.c
@@ -0,0 +1,377 @@
+/* Verify that pthread_[gs]etattr_default_np work correctly.
+
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <stdbool.h>
+
+#define RETURN_IF_FAIL(f, ...) \
+ ({ \
+ int ret = f (__VA_ARGS__); \
+ if (ret != 0) \
+ { \
+ printf ("%s returned %d (errno = %d)\n", #f, ret, errno); \
+ return ret; \
+ } \
+ })
+
+static int (*verify_result) (pthread_attr_t *);
+static size_t stacksize = 1024 * 1024;
+static size_t guardsize;
+static bool do_join = true;
+static int running = 0;
+static int detach_failed = 0;
+static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
+static pthread_cond_t c = PTHREAD_COND_INITIALIZER;
+
+static void *
+thr (void *unused)
+{
+ pthread_attr_t attr;
+ int ret;
+
+ /* To verify that the pthread_setattr_default_np worked. */
+ if ((ret = pthread_getattr_default_np (&attr)) != 0)
+ {
+ printf ("pthread_getattr_default_np failed: %s\n", strerror (ret));
+ goto out;
+ }
+
+ if ((ret = verify_result (&attr)) != 0)
+ goto out;
+
+ /* To verify that the attributes actually got applied. */
+ if ((ret = pthread_getattr_np (pthread_self (), &attr)) != 0)
+ {
+ printf ("pthread_getattr_np failed: %s\n", strerror (ret));
+ goto out;
+ }
+
+ ret = verify_result (&attr);
+
+out:
+ if (!do_join)
+ {
+ pthread_mutex_lock (&m);
+ running--;
+ pthread_cond_signal (&c);
+ pthread_mutex_unlock (&m);
+
+ detach_failed |= ret;
+ }
+
+ return (void *) (uintptr_t) ret;
+}
+
+static int
+run_threads (pthread_attr_t *attr)
+{
+ pthread_t t;
+ void *tret = NULL;
+
+ RETURN_IF_FAIL (pthread_setattr_default_np, attr);
+
+ /* Run twice to ensure that the attributes do not get overwritten in the
+ first run somehow. */
+ for (int i = 0; i < 2; i++)
+ {
+ RETURN_IF_FAIL (pthread_create, &t, NULL, thr, NULL);
+ if (do_join)
+ RETURN_IF_FAIL (pthread_join, t, &tret);
+ else
+ {
+ pthread_mutex_lock (&m);
+ running++;
+ pthread_mutex_unlock (&m);
+ }
+
+ if (tret != NULL)
+ {
+ puts ("Thread failed\n");
+ return 1;
+ }
+ }
+
+ /* Stay in sync for detached threads and get their status. */
+ while (!do_join)
+ {
+ pthread_mutex_lock (&m);
+ if (running == 0)
+ {
+ pthread_mutex_unlock (&m);
+ break;
+ }
+ pthread_cond_wait (&c, &m);
+ pthread_mutex_unlock (&m);
+ }
+
+ return 0;
+}
+
+static int
+verify_detach_result (pthread_attr_t *attr)
+{
+ int state;
+
+ RETURN_IF_FAIL (pthread_attr_getdetachstate, attr, &state);
+
+ if (state != PTHREAD_CREATE_DETACHED)
+ {
+ printf ("pthread_attr_set_default failed to set detach state\n");
+ return 1;
+ }
+
+ return 0;
+}
+
+static int
+do_detach_test (void)
+{
+ pthread_attr_t attr;
+
+ do_join = false;
+ RETURN_IF_FAIL (pthread_attr_init, &attr);
+ RETURN_IF_FAIL (pthread_attr_setdetachstate, &attr, PTHREAD_CREATE_DETACHED);
+
+ RETURN_IF_FAIL (run_threads, &attr);
+ return detach_failed;
+}
+
+static int
+verify_affinity_result (pthread_attr_t *attr)
+{
+ cpu_set_t cpuset;
+
+ RETURN_IF_FAIL (pthread_attr_getaffinity_np, attr, sizeof (cpuset), &cpuset);
+ if (!CPU_ISSET (0, &cpuset))
+ {
+ printf ("pthread_attr_set_default failed to set cpu affinity\n");
+ return 1;
+ }
+
+ return 0;
+}
+
+static int
+do_affinity_test (void)
+{
+ pthread_attr_t attr;
+
+ RETURN_IF_FAIL (pthread_attr_init, &attr);
+
+ /* Processor affinity. Like scheduling policy, this could fail if the user
+ does not have the necessary privileges. So we only spew a warning if
+ pthread_create fails with EPERM. A computer has at least one CPU. */
+ cpu_set_t cpuset;
+ CPU_ZERO (&cpuset);
+ CPU_SET (0, &cpuset);
+ RETURN_IF_FAIL (pthread_attr_setaffinity_np, &attr, sizeof (cpuset), &cpuset);
+
+ int ret = run_threads (&attr);
+
+ if (ret == EPERM)
+ {
+ fprintf (stderr, "Skipping CPU Affinity test: %s\n", strerror (ret));
+ return 0;
+ }
+ else if (ret != 0)
+ return ret;
+
+ return 0;
+}
+
+static int
+verify_sched_result (pthread_attr_t *attr)
+{
+ int inherited, policy;
+ struct sched_param param;
+
+ RETURN_IF_FAIL (pthread_attr_getinheritsched, attr, &inherited);
+ if (inherited != PTHREAD_EXPLICIT_SCHED)
+ {
+ printf ("pthread_attr_set_default failed to set EXPLICIT_SCHED\n");
+ return 1;
+ }
+
+ RETURN_IF_FAIL (pthread_attr_getschedpolicy, attr, &policy);
+ if (policy != SCHED_RR)
+ {
+ printf ("pthread_attr_set_default failed to set SCHED_RR\n");
+ return 1;
+ }
+
+ RETURN_IF_FAIL (pthread_attr_getschedparam, attr, ¶m);
+ if (param.sched_priority != 42)
+ {
+ printf ("pthread_attr_set_default failed to set sched_priority\n");
+ return 1;
+ }
+
+ return 0;
+}
+
+static int
+do_sched_test (void)
+{
+ pthread_attr_t attr;
+
+ RETURN_IF_FAIL (pthread_attr_init, &attr);
+
+ /* Scheduling policy. Note that we don't always test these since it's
+ possible that the user the tests run as don't have the appropriate
+ privileges. */
+ RETURN_IF_FAIL (pthread_attr_setinheritsched, &attr, PTHREAD_EXPLICIT_SCHED);
+ RETURN_IF_FAIL (pthread_attr_setschedpolicy, &attr, SCHED_RR);
+
+ struct sched_param param;
+ param.sched_priority = 42;
+ RETURN_IF_FAIL (pthread_attr_setschedparam, &attr, ¶m);
+
+ int ret = run_threads (&attr);
+
+ if (ret == EPERM)
+ {
+ fprintf (stderr, "Skipping Scheduler Attributes test: %s\n",
+ strerror (ret));
+ return 0;
+ }
+ else if (ret != 0)
+ return ret;
+
+ return 0;
+}
+
+static int
+verify_guardsize_result (pthread_attr_t *attr)
+{
+ size_t guard;
+
+ RETURN_IF_FAIL (pthread_attr_getguardsize, attr, &guard);
+
+ if (guardsize != guard)
+ {
+ printf ("pthread_attr_set_default failed for guardsize (%zu, %zu)\n",
+ guardsize, guard);
+ return 1;
+ }
+
+ return 0;
+}
+
+static int
+do_guardsize_test (void)
+{
+ long pagesize = sysconf (_SC_PAGESIZE);
+ pthread_attr_t attr;
+
+ if (pagesize < 0)
+ {
+ printf ("sysconf failed: %s\n", strerror (errno));
+ return 1;
+ }
+
+ RETURN_IF_FAIL (pthread_getattr_default_np, &attr);
+
+ /* Increase default guardsize by a page. */
+ RETURN_IF_FAIL (pthread_attr_getguardsize, &attr, &guardsize);
+ guardsize += pagesize;
+ RETURN_IF_FAIL (pthread_attr_setguardsize, &attr, guardsize);
+ RETURN_IF_FAIL (run_threads, &attr);
+
+ return 0;
+}
+
+static int
+verify_stacksize_result (pthread_attr_t *attr)
+{
+ size_t stack;
+
+ RETURN_IF_FAIL (pthread_attr_getstacksize, attr, &stack);
+
+ if (stacksize != stack)
+ {
+ printf ("pthread_attr_set_default failed for stacksize (%zu, %zu)\n",
+ stacksize, stack);
+ return 1;
+ }
+
+ return 0;
+}
+
+static int
+do_stacksize_test (void)
+{
+ long pagesize = sysconf (_SC_PAGESIZE);
+ pthread_attr_t attr;
+
+ if (pagesize < 0)
+ {
+ printf ("sysconf failed: %s\n", strerror (errno));
+ return 1;
+ }
+
+ /* Perturb the size by a page so that we're not aligned on the 64K boundary.
+ pthread_create does this perturbation on x86 to avoid causing the 64k
+ aliasing conflict. We want to prevent pthread_create from doing that
+ since it is not consistent for all architectures. */
+ stacksize += pagesize;
+
+ RETURN_IF_FAIL (pthread_attr_init, &attr);
+
+ /* Run twice to ensure that we don't give a false positive. */
+ RETURN_IF_FAIL (pthread_attr_setstacksize, &attr, stacksize);
+ RETURN_IF_FAIL (run_threads, &attr);
+ stacksize *= 2;
+ RETURN_IF_FAIL (pthread_attr_setstacksize, &attr, stacksize);
+ RETURN_IF_FAIL (run_threads, &attr);
+ return 0;
+}
+
+static int
+do_test (void)
+{
+ puts ("stacksize test");
+ verify_result = verify_stacksize_result;
+ RETURN_IF_FAIL (do_stacksize_test);
+
+ puts ("guardsize test");
+ verify_result = verify_guardsize_result;
+ RETURN_IF_FAIL (do_guardsize_test);
+
+ puts ("sched test");
+ verify_result = verify_sched_result;
+ RETURN_IF_FAIL (do_sched_test);
+
+ puts ("affinity test");
+ verify_result = verify_affinity_result;
+ RETURN_IF_FAIL (do_affinity_test);
+
+ puts ("detach test");
+ verify_result = verify_detach_result;
+ RETURN_IF_FAIL (do_detach_test);
+
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/nptl/vars.c b/nptl/vars.c
index 45ca486..3e2db42 100644
--- a/nptl/vars.c
+++ b/nptl/vars.c
@@ -24,6 +24,9 @@
provide any. */
struct pthread_attr __default_pthread_attr attribute_hidden;
+/* Mutex protecting __default_pthread_attr. */
+int __default_pthread_attr_lock = LLL_LOCK_INITIALIZER;
+
/* Flag whether the machine is SMP or not. */
int __is_smp attribute_hidden;
diff --git a/ports/sysdeps/unix/sysv/linux/aarch64/nptl/libpthread.abilist b/ports/sysdeps/unix/sysv/linux/aarch64/nptl/libpthread.abilist
index 696158a..5520312 100644
--- a/ports/sysdeps/unix/sysv/linux/aarch64/nptl/libpthread.abilist
+++ b/ports/sysdeps/unix/sysv/linux/aarch64/nptl/libpthread.abilist
@@ -222,3 +222,7 @@ GLIBC_2.17
wait F
waitpid F
write F
+GLIBC_2.18
+ GLIBC_2.18 A
+ pthread_getattr_default_np F
+ pthread_setattr_default_np F
diff --git a/ports/sysdeps/unix/sysv/linux/alpha/nptl/libpthread.abilist b/ports/sysdeps/unix/sysv/linux/alpha/nptl/libpthread.abilist
index 9626730..4c75b17 100644
--- a/ports/sysdeps/unix/sysv/linux/alpha/nptl/libpthread.abilist
+++ b/ports/sysdeps/unix/sysv/linux/alpha/nptl/libpthread.abilist
@@ -174,6 +174,10 @@ GLIBC_2.12
pthread_mutexattr_getrobust F
pthread_mutexattr_setrobust F
pthread_setname_np F
+GLIBC_2.18
+ GLIBC_2.18 A
+ pthread_getattr_default_np F
+ pthread_setattr_default_np F
GLIBC_2.2
GLIBC_2.2 A
__open64 F
diff --git a/ports/sysdeps/unix/sysv/linux/arm/nptl/libpthread.abilist b/ports/sysdeps/unix/sysv/linux/arm/nptl/libpthread.abilist
index de8095a..ac46302 100644
--- a/ports/sysdeps/unix/sysv/linux/arm/nptl/libpthread.abilist
+++ b/ports/sysdeps/unix/sysv/linux/arm/nptl/libpthread.abilist
@@ -8,6 +8,10 @@ GLIBC_2.12
pthread_mutexattr_getrobust F
pthread_mutexattr_setrobust F
pthread_setname_np F
+GLIBC_2.18
+ GLIBC_2.18 A
+ pthread_getattr_default_np F
+ pthread_setattr_default_np F
GLIBC_2.4
GLIBC_2.4 A
_IO_flockfile F
diff --git a/ports/sysdeps/unix/sysv/linux/ia64/nptl/libpthread.abilist b/ports/sysdeps/unix/sysv/linux/ia64/nptl/libpthread.abilist
index b7749e2..a84c113 100644
--- a/ports/sysdeps/unix/sysv/linux/ia64/nptl/libpthread.abilist
+++ b/ports/sysdeps/unix/sysv/linux/ia64/nptl/libpthread.abilist
@@ -8,6 +8,10 @@ GLIBC_2.12
pthread_mutexattr_getrobust F
pthread_mutexattr_setrobust F
pthread_setname_np F
+GLIBC_2.18
+ GLIBC_2.18 A
+ pthread_getattr_default_np F
+ pthread_setattr_default_np F
GLIBC_2.2
GLIBC_2.2 A
_IO_flockfile F
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libpthread.abilist b/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libpthread.abilist
index de8095a..ac46302 100644
--- a/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libpthread.abilist
+++ b/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libpthread.abilist
@@ -8,6 +8,10 @@ GLIBC_2.12
pthread_mutexattr_getrobust F
pthread_mutexattr_setrobust F
pthread_setname_np F
+GLIBC_2.18
+ GLIBC_2.18 A
+ pthread_getattr_default_np F
+ pthread_setattr_default_np F
GLIBC_2.4
GLIBC_2.4 A
_IO_flockfile F
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libpthread.abilist b/ports/sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libpthread.abilist
index 827114f..865364e 100644
--- a/ports/sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libpthread.abilist
+++ b/ports/sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libpthread.abilist
@@ -174,6 +174,10 @@ GLIBC_2.12
pthread_mutexattr_getrobust F
pthread_mutexattr_setrobust F
pthread_setname_np F
+GLIBC_2.18
+ GLIBC_2.18 A
+ pthread_getattr_default_np F
+ pthread_setattr_default_np F
GLIBC_2.2
GLIBC_2.2 A
__open64 F
diff --git a/ports/sysdeps/unix/sysv/linux/mips/mips32/nptl/libpthread.abilist b/ports/sysdeps/unix/sysv/linux/mips/mips32/nptl/libpthread.abilist
index c3ba9d4..00ad3ab 100644
--- a/ports/sysdeps/unix/sysv/linux/mips/mips32/nptl/libpthread.abilist
+++ b/ports/sysdeps/unix/sysv/linux/mips/mips32/nptl/libpthread.abilist
@@ -130,6 +130,10 @@ GLIBC_2.12
pthread_mutexattr_getrobust F
pthread_mutexattr_setrobust F
pthread_setname_np F
+GLIBC_2.18
+ GLIBC_2.18 A
+ pthread_getattr_default_np F
+ pthread_setattr_default_np F
GLIBC_2.2
GLIBC_2.2 A
__libc_allocate_rtsig F
diff --git a/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libpthread.abilist b/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libpthread.abilist
index 4e0b07f..fdcd0cc 100644
--- a/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libpthread.abilist
+++ b/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libpthread.abilist
@@ -130,6 +130,10 @@ GLIBC_2.12
pthread_mutexattr_getrobust F
pthread_mutexattr_setrobust F
pthread_setname_np F
+GLIBC_2.18
+ GLIBC_2.18 A
+ pthread_getattr_default_np F
+ pthread_setattr_default_np F
GLIBC_2.2
GLIBC_2.2 A
__libc_allocate_rtsig F
diff --git a/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libpthread.abilist b/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libpthread.abilist
index 4e0b07f..fdcd0cc 100644
--- a/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libpthread.abilist
+++ b/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libpthread.abilist
@@ -130,6 +130,10 @@ GLIBC_2.12
pthread_mutexattr_getrobust F
pthread_mutexattr_setrobust F
pthread_setname_np F
+GLIBC_2.18
+ GLIBC_2.18 A
+ pthread_getattr_default_np F
+ pthread_setattr_default_np F
GLIBC_2.2
GLIBC_2.2 A
__libc_allocate_rtsig F
diff --git a/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libpthread.abilist b/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libpthread.abilist
index 7719099..c8a2a04 100644
--- a/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libpthread.abilist
+++ b/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libpthread.abilist
@@ -174,6 +174,10 @@ GLIBC_2.12
pthread_mutexattr_getrobust F
pthread_mutexattr_setrobust F
pthread_setname_np F
+GLIBC_2.18
+ GLIBC_2.18 A
+ pthread_getattr_default_np F
+ pthread_setattr_default_np F
GLIBC_2.2
GLIBC_2.2 A
__open64 F
diff --git a/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libpthread.abilist b/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libpthread.abilist
index 658c4bf..f3c2600 100644
--- a/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libpthread.abilist
+++ b/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libpthread.abilist
@@ -222,3 +222,7 @@ GLIBC_2.12
wait F
waitpid F
write F
+GLIBC_2.18
+ GLIBC_2.18 A
+ pthread_getattr_default_np F
+ pthread_setattr_default_np F
diff --git a/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libpthread.abilist b/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libpthread.abilist
index 658c4bf..f3c2600 100644
--- a/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libpthread.abilist
+++ b/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libpthread.abilist
@@ -222,3 +222,7 @@ GLIBC_2.12
wait F
waitpid F
write F
+GLIBC_2.18
+ GLIBC_2.18 A
+ pthread_getattr_default_np F
+ pthread_setattr_default_np F
diff --git a/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libpthread.abilist b/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libpthread.abilist
index 658c4bf..f3c2600 100644
--- a/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libpthread.abilist
+++ b/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libpthread.abilist
@@ -222,3 +222,7 @@ GLIBC_2.12
wait F
waitpid F
write F
+GLIBC_2.18
+ GLIBC_2.18 A
+ pthread_getattr_default_np F
+ pthread_setattr_default_np F
diff --git a/sysdeps/unix/sysv/linux/i386/nptl/libpthread.abilist b/sysdeps/unix/sysv/linux/i386/nptl/libpthread.abilist
index 827114f..865364e 100644
--- a/sysdeps/unix/sysv/linux/i386/nptl/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/i386/nptl/libpthread.abilist
@@ -174,6 +174,10 @@ GLIBC_2.12
pthread_mutexattr_getrobust F
pthread_mutexattr_setrobust F
pthread_setname_np F
+GLIBC_2.18
+ GLIBC_2.18 A
+ pthread_getattr_default_np F
+ pthread_setattr_default_np F
GLIBC_2.2
GLIBC_2.2 A
__open64 F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libpthread.abilist
index 7719099..c8a2a04 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libpthread.abilist
@@ -174,6 +174,10 @@ GLIBC_2.12
pthread_mutexattr_getrobust F
pthread_mutexattr_setrobust F
pthread_setname_np F
+GLIBC_2.18
+ GLIBC_2.18 A
+ pthread_getattr_default_np F
+ pthread_setattr_default_np F
GLIBC_2.2
GLIBC_2.2 A
__open64 F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libpthread.abilist
index 7930c75..0faa1b8 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libpthread.abilist
@@ -8,6 +8,10 @@ GLIBC_2.12
pthread_mutexattr_getrobust F
pthread_mutexattr_setrobust F
pthread_setname_np F
+GLIBC_2.18
+ GLIBC_2.18 A
+ pthread_getattr_default_np F
+ pthread_setattr_default_np F
GLIBC_2.3
GLIBC_2.3 A
_IO_flockfile F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libpthread.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libpthread.abilist
index 827114f..865364e 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libpthread.abilist
@@ -174,6 +174,10 @@ GLIBC_2.12
pthread_mutexattr_getrobust F
pthread_mutexattr_setrobust F
pthread_setname_np F
+GLIBC_2.18
+ GLIBC_2.18 A
+ pthread_getattr_default_np F
+ pthread_setattr_default_np F
GLIBC_2.2
GLIBC_2.2 A
__open64 F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libpthread.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libpthread.abilist
index 596fdd3..6613c09 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libpthread.abilist
@@ -8,6 +8,10 @@ GLIBC_2.12
pthread_mutexattr_getrobust F
pthread_mutexattr_setrobust F
pthread_setname_np F
+GLIBC_2.18
+ GLIBC_2.18 A
+ pthread_getattr_default_np F
+ pthread_setattr_default_np F
GLIBC_2.2
GLIBC_2.2 A
_IO_flockfile F
diff --git a/sysdeps/unix/sysv/linux/sh/nptl/libpthread.abilist b/sysdeps/unix/sysv/linux/sh/nptl/libpthread.abilist
index 596fdd3..6613c09 100644
--- a/sysdeps/unix/sysv/linux/sh/nptl/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/sh/nptl/libpthread.abilist
@@ -8,6 +8,10 @@ GLIBC_2.12
pthread_mutexattr_getrobust F
pthread_mutexattr_setrobust F
pthread_setname_np F
+GLIBC_2.18
+ GLIBC_2.18 A
+ pthread_getattr_default_np F
+ pthread_setattr_default_np F
GLIBC_2.2
GLIBC_2.2 A
_IO_flockfile F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libpthread.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libpthread.abilist
index 9626730..4c75b17 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libpthread.abilist
@@ -174,6 +174,10 @@ GLIBC_2.12
pthread_mutexattr_getrobust F
pthread_mutexattr_setrobust F
pthread_setname_np F
+GLIBC_2.18
+ GLIBC_2.18 A
+ pthread_getattr_default_np F
+ pthread_setattr_default_np F
GLIBC_2.2
GLIBC_2.2 A
__open64 F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libpthread.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libpthread.abilist
index b7749e2..a84c113 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libpthread.abilist
@@ -8,6 +8,10 @@ GLIBC_2.12
pthread_mutexattr_getrobust F
pthread_mutexattr_setrobust F
pthread_setname_np F
+GLIBC_2.18
+ GLIBC_2.18 A
+ pthread_getattr_default_np F
+ pthread_setattr_default_np F
GLIBC_2.2
GLIBC_2.2 A
_IO_flockfile F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/nptl/libpthread.abilist b/sysdeps/unix/sysv/linux/x86_64/64/nptl/libpthread.abilist
index 7c33f35..1b5192b 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/nptl/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/nptl/libpthread.abilist
@@ -8,6 +8,10 @@ GLIBC_2.12
pthread_mutexattr_getrobust F
pthread_mutexattr_setrobust F
pthread_setname_np F
+GLIBC_2.18
+ GLIBC_2.18 A
+ pthread_getattr_default_np F
+ pthread_setattr_default_np F
GLIBC_2.2.5
GLIBC_2.2.5 A
_IO_flockfile F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/nptl/libpthread.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/nptl/libpthread.abilist
index b07d16f..328f69a 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/nptl/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/nptl/libpthread.abilist
@@ -222,3 +222,7 @@ GLIBC_2.16
wait F
waitpid F
write F
+GLIBC_2.18
+ GLIBC_2.18 A
+ pthread_getattr_default_np F
+ pthread_setattr_default_np F