]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
support: Add xpthread_attr_setaffinity_np wrapper
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 21 May 2021 18:09:43 +0000 (15:09 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 27 May 2021 16:12:07 +0000 (13:12 -0300)
support/Makefile
support/xpthread_attr_setaffinity_np.c [new file with mode: 0644]
support/xthread.h

index da6dc58d37d97048f7c82ca135358f9ed6c62231..0a4b057db5f9d87fa3bdad16697ffa0349d88d2f 100644 (file)
@@ -128,6 +128,7 @@ libsupport-routines = \
   xpthread_attr_init \
   xpthread_attr_setdetachstate \
   xpthread_attr_setguardsize \
+  xpthread_attr_setaffinity_np \
   xpthread_attr_setstack \
   xpthread_attr_setstacksize \
   xpthread_barrier_destroy \
diff --git a/support/xpthread_attr_setaffinity_np.c b/support/xpthread_attr_setaffinity_np.c
new file mode 100644 (file)
index 0000000..5bb5b41
--- /dev/null
@@ -0,0 +1,28 @@
+/* pthread_attr_setaffinity_np with error checking.
+   Copyright (C) 2021 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
+   <https://www.gnu.org/licenses/>.  */
+
+#include <support/xthread.h>
+
+void
+xpthread_attr_setaffinity_np (pthread_attr_t *attr,
+                              size_t cpusetsize, const cpu_set_t *cpuset)
+{
+  xpthread_check_return ("pthread_attr_setaffinity_np",
+                        pthread_attr_setaffinity_np (attr, cpusetsize,
+                                                     cpuset));
+}
index 1ba3f133adbfd47946f2ca068781895c22a773a3..c0dbb6086e1a7d9326d47466a2de60a0a2e9d3d8 100644 (file)
@@ -66,6 +66,9 @@ void *xpthread_join (pthread_t thr);
 void xpthread_once (pthread_once_t *guard, void (*func) (void));
 void xpthread_attr_destroy (pthread_attr_t *attr);
 void xpthread_attr_init (pthread_attr_t *attr);
+void xpthread_attr_setaffinity_np (pthread_attr_t *attr,
+                                  size_t cpusetsize,
+                                  const cpu_set_t *cpuset);
 void xpthread_attr_setdetachstate (pthread_attr_t *attr,
                                   int detachstate);
 void xpthread_attr_setstack (pthread_attr_t *attr, void *stackaddr,