sched: Move Cygwin cpuset definitions into Cygwin-specific header

This avoids build breakage on RTEMS.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2019-06-26 15:08:57 +02:00
parent aa55d22cb5
commit 383e19ca55
3 changed files with 28 additions and 20 deletions

View File

@ -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 *);

View File

@ -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;

View File

@ -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_ */