[03/11] support: Add xpthread_attr_setaffinity_np wrapper
Checks
Commit Message
---
support/Makefile | 1 +
support/xpthread_attr_setaffinity_np.c | 28 ++++++++++++++++++++++++++
support/xthread.h | 3 +++
3 files changed, 32 insertions(+)
create mode 100644 support/xpthread_attr_setaffinity_np.c
Comments
* Adhemerval Zanella via Libc-alpha:
> ---
> support/Makefile | 1 +
> support/xpthread_attr_setaffinity_np.c | 28 ++++++++++++++++++++++++++
> support/xthread.h | 3 +++
> 3 files changed, 32 insertions(+)
> create mode 100644 support/xpthread_attr_setaffinity_np.c
Looks good, please push this.
Thanks,
Florian
I think this has broken the build for Hurd.
xpthread_attr_setaffinity_np.c: In function 'xpthread_attr_setaffinity_np':
xpthread_attr_setaffinity_np.c:26:26: error: implicit declaration of function 'pthread_attr_setaffinity_np'; did you mean 'xpthread_attr_setaffinity_np'? [-Werror=implicit-function-declaration]
26 | pthread_attr_setaffinity_np (attr, cpusetsize,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
| xpthread_attr_setaffinity_np
On 27/05/2021 19:35, Joseph Myers wrote:
> I think this has broken the build for Hurd.
>
> xpthread_attr_setaffinity_np.c: In function 'xpthread_attr_setaffinity_np':
> xpthread_attr_setaffinity_np.c:26:26: error: implicit declaration of function 'pthread_attr_setaffinity_np'; did you mean 'xpthread_attr_setaffinity_np'? [-Werror=implicit-function-declaration]
> 26 | pthread_attr_setaffinity_np (attr, cpusetsize,
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> | xpthread_attr_setaffinity_np
>
It does, I will fix it.
@@ -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 \
new file mode 100644
@@ -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));
+}
@@ -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,