public inbox for newlib-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: cygwin-cvs@sourceware.org, newlib-cvs@sourceware.org Subject: [newlib-cygwin] sched: Move Cygwin cpuset definitions into Cygwin-specific header Date: Fri, 28 Jun 2019 14:15:00 -0000 [thread overview] Message-ID: <20190628141533.90961.qmail@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=383e19ca552234fa9af47e80cb00d843a96de9e3 commit 383e19ca552234fa9af47e80cb00d843a96de9e3 Author: Corinna Vinschen <corinna@vinschen.de> Date: Wed Jun 26 15:08:57 2019 +0200 sched: Move Cygwin cpuset definitions into Cygwin-specific header This avoids build breakage on RTEMS. Signed-off-by: Corinna Vinschen <corinna@vinschen.de> Diff: --- 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(-) diff --git a/newlib/libc/include/sched.h b/newlib/libc/include/sched.h index fc44209..79b775e 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 3063e83..e951fee 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 <rbtcollins@hotmail.com> +/* 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 0000000..a83163d --- /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_ */
reply other threads:[~2019-06-28 14:15 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190628141533.90961.qmail@sourceware.org \ --to=corinna@sourceware.org \ --cc=cygwin-cvs@sourceware.org \ --cc=newlib-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).