Re: Cygwin: Implement sched_[gs]etaffinity() commit breaks RTEMS port
Corinna Vinschen <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <[email protected]> |
On Jun 26 13:05, Sebastian Huber wrote: > On 26/06/2019 11:37, Corinna Vinschen wrote: > > On Jun 26 10:24, Sebastian Huber wrote: > > > Hello, > > > > > > the following commit: > > > > > > commit 641ecb07533e85211b6abce334c85967f3f90209 > > > Author: Mark Geisert<[email protected]> > > > Date: Sun Jun 23 14:51:06 2019 -0700 > > > > > > Cygwin: Implement sched_[gs]etaffinity() > > > [...] > > > breaks the RTEMS port: > > > [...] > > Looks like Cygwin has to define its own sys/cpuset.h included via > > sys/_pthreadtypes.h. > > Yes, something like this. The RTEMS <sys/cpuset.h> is based on the FreeBSD > implementation and should be compatible to the Linux API. Maybe it can move > out of the RTEMS area into the global Newlib area. I'm not so sure, given the different names of macros and types used inside cpu_set_t. The new functions inside Cygwin rely on that. I prep'ed a patch to move the Cygwin-specific definitions out of the way, can you please test it on RTEMS? It's attached to this mail. Thanks, Corinna -- Corinna Vinschen Cygwin Maintainer Red Hat
0001-sched-Move-Cygwin-cpuset-definitions-into-Cygwin-spe.patch
(text/plain, 3.2 KB)
From cb828e0679ba06a6e7e57ae51a6e63ebc96d5987 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen <[email protected]> Date: Wed, 26 Jun 2019 15:08:57 +0200 Subject: [PATCH] sched: Move Cygwin cpuset definitions into Cygwin-specific header This avoids build breakage on RTEMS. Signed-off-by: Corinna Vinschen <[email protected]> --- newlib/libc/include/sched.h | 18 ---------------- winsup/cygwin/include/sys/_pthreadtypes.h | 5 +++-- winsup/cygwin/include/sys/cpuset.h | 25 +++++++++++++++++++++++ 3 files changed, 28 insertions(+), 20 deletions(-) create mode 100644 winsup/cygwin/include/sys/cpuset.h diff --git a/newlib/libc/include/sched.h b/newlib/libc/include/sched.h index fc44209d60dc..79b775e220c7 100644 --- a/newlib/libc/include/sched.h +++ b/newlib/libc/include/sched.h @@ -93,24 +93,6 @@ int sched_yield( void ); #if __GNU_VISIBLE int sched_getcpu(void); -/* Affinity-related definitions, here until numerous enough to separate out */ -#ifdef __x86_64__ -typedef uint64_t __cpu_mask; -#else -typedef uint32_t __cpu_mask; -#endif -#define __CPU_SETSIZE 1024 // maximum number of logical processors tracked -#define __NCPUBITS (8 * sizeof (__cpu_mask)) // max size of processor group -#define __CPU_GROUPMAX (__CPU_SETSIZE / __NCPUBITS) // maximum group number - -#define __CPUELT(cpu) ((cpu) / __NCPUBITS) -#define __CPUMASK(cpu) ((__cpu_mask) 1 << ((cpu) % __NCPUBITS)) - -typedef struct -{ - __cpu_mask __bits[__CPU_GROUPMAX]; -} cpu_set_t; - int sched_getaffinity (pid_t, size_t, cpu_set_t *); int sched_get_thread_affinity (void *, size_t, cpu_set_t *); int sched_setaffinity (pid_t, size_t, const cpu_set_t *); diff --git a/winsup/cygwin/include/sys/_pthreadtypes.h b/winsup/cygwin/include/sys/_pthreadtypes.h index 3063e833462e..e951fee6313b 100644 --- a/winsup/cygwin/include/sys/_pthreadtypes.h +++ b/winsup/cygwin/include/sys/_pthreadtypes.h @@ -1,5 +1,4 @@ -/* machine/types.h - Written by Robert Collins <[email protected]> +/* sys/_pthreadtypes.h This file is part of Cygwin. @@ -10,6 +9,8 @@ details. */ #ifndef _SYS__PTHREADTYPES_H_ #define _SYS__PTHREADTYPES_H_ +#include <sys/cpuset.h> + #if !defined(__INSIDE_CYGWIN__) || !defined(__cplusplus) typedef struct __pthread_t {char __dummy;} *pthread_t; diff --git a/winsup/cygwin/include/sys/cpuset.h b/winsup/cygwin/include/sys/cpuset.h new file mode 100644 index 000000000000..a83163d01635 --- /dev/null +++ b/winsup/cygwin/include/sys/cpuset.h @@ -0,0 +1,25 @@ +/* sys/cpuset.h + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + +#ifndef _SYS_CPUSET_H_ +#define _SYS_CPUSET_H_ + +typedef __SIZE_TYPE__ __cpu_mask; +#define __CPU_SETSIZE 1024 // maximum number of logical processors tracked +#define __NCPUBITS (8 * sizeof (__cpu_mask)) // max size of processor group +#define __CPU_GROUPMAX (__CPU_SETSIZE / __NCPUBITS) // maximum group number + +#define __CPUELT(cpu) ((cpu) / __NCPUBITS) +#define __CPUMASK(cpu) ((__cpu_mask) 1 << ((cpu) % __NCPUBITS)) + +typedef struct +{ + __cpu_mask __bits[__CPU_GROUPMAX]; +} cpu_set_t; + +#endif /* _SYS_CPUSET_H_ */ -- 2.20.1
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAl0TbyMACgkQ9TYGna5E T6CaHQ//W/PRnmxiVt2+cFGSRGYK6DgZYHOAmU/is9illpbfjl0Y0dysuAstozTM KeH4gi/MyGRe3VIZXBtmMN+8eZfAJyc8D0v7uWf0yVojjOsT8yNwwQlHWL35ZFo6 PLQt0k2v89NWCHLieQaPR++FG59WNcNd6Ve1MpeDG9a/IIqZ6CXJZxSLzM/zm6WH xGBxdqyfN6BA7gAl6/0DnA+bIgvcRz7iT5BRXQHa6+SBPIfZabGNjNl0EXmfGQrR mVNfHWtfg0hAU01cwaKQw9nJGVslvP/S/5Ot0lBltME7NxGG5zzlJAqJadm40NCk KdXqu6I78xwdfEEUH5eEMjLngFxj4IGCc85zsRCuvCooH3mqSDgl7kut2vg9Y4QX 1YROiTV1JmTyDHtw0a+6Y0xeFbEW5e+gAjwTvIhmAdjgK3vCOCir3FM+9nEh97rm g/fQ+QQGYLjoiUiWyhWz1b8JHF0/jS7EO/bY4HGal0Ybf5KTLxDxl4w4MSzybg4d PHmVLtGv6fJxFgHmtLGkehs4agQvnHoJO/dGgIbteXmQv9OUsxEk8+Wz7pnhslqL z+fZO86ADpT3MD7e43vJ8b6zquibF7UfXy1Z6LzZdA+Bz8I1eUcsUWSVA8BuDM8b DFuxNnAUdEDt9LUEX7bdV4Hetr3SemaYUMXALWreVZdQSYl1418= =+A4x -----END PGP SIGNATURE-----