mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-10-19 04:14:33 +08:00
Changes due to <sys/cpuset.h> from latest Newlib
This commit is contained in:
@@ -175,6 +175,7 @@ def processIfDifferent(new, old, src):
|
||||
def fixIncludes(data):
|
||||
data = re.sub('#include <sys/lock.h>', '#include <rtems/bsd/sys/lock.h>', data)
|
||||
data = re.sub('#include <sys/time.h>', '#include <rtems/bsd/sys/time.h>', data)
|
||||
data = re.sub('#include <sys/cpuset.h>', '#include <rtems/bsd/sys/cpuset.h>', data)
|
||||
data = re.sub('#include <sys/errno.h>', '#include <rtems/bsd/sys/errno.h>', data)
|
||||
data = re.sub('#include <sys/param.h>', '#include <rtems/bsd/sys/param.h>', data)
|
||||
data = re.sub('#include <sys/types.h>', '#include <rtems/bsd/sys/types.h>', data)
|
||||
|
@@ -29,7 +29,7 @@
|
||||
*/
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/cpuset.h>
|
||||
#include <rtems/bsd/sys/cpuset.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
|
@@ -77,7 +77,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <rtems/bsd/sys/unistd.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/cpuset.h>
|
||||
#include <rtems/bsd/sys/cpuset.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
|
||||
|
@@ -34,7 +34,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/cpuset.h>
|
||||
#include <rtems/bsd/sys/cpuset.h>
|
||||
#include <sys/rtprio.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/interrupt.h>
|
||||
|
@@ -33,7 +33,9 @@
|
||||
#define _SYS__CPUSET_H_
|
||||
|
||||
#ifdef _KERNEL
|
||||
#ifndef __rtems__
|
||||
#define CPU_SETSIZE MAXCPU
|
||||
#endif /* __rtems__ */
|
||||
#endif
|
||||
|
||||
#define CPU_MAXSIZE 128
|
||||
@@ -42,11 +44,17 @@
|
||||
#define CPU_SETSIZE CPU_MAXSIZE
|
||||
#endif
|
||||
|
||||
#ifndef __rtems__
|
||||
#define _NCPUBITS (sizeof(long) * NBBY) /* bits per mask */
|
||||
#define _NCPUWORDS howmany(CPU_SETSIZE, _NCPUBITS)
|
||||
|
||||
typedef struct _cpuset {
|
||||
long __bits[howmany(CPU_SETSIZE, _NCPUBITS)];
|
||||
} cpuset_t;
|
||||
#else /* __rtems__ */
|
||||
#include <sys/cpuset.h>
|
||||
|
||||
typedef cpu_set_t cpuset_t;
|
||||
#endif /* __rtems__ */
|
||||
|
||||
#endif /* !_SYS__CPUSET_H_ */
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
#ifndef LOCORE
|
||||
|
||||
#include <sys/cpuset.h>
|
||||
#include <rtems/bsd/sys/cpuset.h>
|
||||
|
||||
/*
|
||||
* Topology of a NUMA or HTT system.
|
||||
|
@@ -11,7 +11,7 @@
|
||||
|
||||
#include <sys/signal.h>
|
||||
#include <sys/acl.h>
|
||||
#include <sys/cpuset.h>
|
||||
#include <rtems/bsd/sys/cpuset.h>
|
||||
#include <sys/_semaphore.h>
|
||||
#include <sys/ucontext.h>
|
||||
|
||||
|
@@ -29,51 +29,18 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _SYS_CPUSET_H_
|
||||
#define _SYS_CPUSET_H_
|
||||
#ifndef _RTEMS_BSD_SYS_CPUSET_H_
|
||||
#define _RTEMS_BSD_SYS_CPUSET_H_
|
||||
|
||||
#include <sys/_cpuset.h>
|
||||
|
||||
#define CPUSETBUFSIZ ((2 + sizeof(long) * 2) * _NCPUWORDS)
|
||||
|
||||
/*
|
||||
* Macros addressing word and bit within it, tuned to make compiler
|
||||
* optimize cases when CPU_SETSIZE fits into single machine word.
|
||||
*/
|
||||
#define __cpuset_mask(n) \
|
||||
((long)1 << ((_NCPUWORDS == 1) ? (__size_t)(n) : ((n) % _NCPUBITS)))
|
||||
#define __cpuset_word(n) ((_NCPUWORDS == 1) ? 0 : ((n) / _NCPUBITS))
|
||||
|
||||
#define CPU_CLR(n, p) ((p)->__bits[__cpuset_word(n)] &= ~__cpuset_mask(n))
|
||||
#define CPU_COPY(f, t) (void)(*(t) = *(f))
|
||||
#define CPU_ISSET(n, p) (((p)->__bits[__cpuset_word(n)] & __cpuset_mask(n)) != 0)
|
||||
#define CPU_SET(n, p) ((p)->__bits[__cpuset_word(n)] |= __cpuset_mask(n))
|
||||
#define CPU_ZERO(p) do { \
|
||||
__size_t __i; \
|
||||
for (__i = 0; __i < _NCPUWORDS; __i++) \
|
||||
(p)->__bits[__i] = 0; \
|
||||
} while (0)
|
||||
|
||||
#define CPU_FILL(p) do { \
|
||||
__size_t __i; \
|
||||
for (__i = 0; __i < _NCPUWORDS; __i++) \
|
||||
(p)->__bits[__i] = -1; \
|
||||
} while (0)
|
||||
|
||||
#define CPU_SETOF(n, p) do { \
|
||||
CPU_ZERO(p); \
|
||||
((p)->__bits[__cpuset_word(n)] = __cpuset_mask(n)); \
|
||||
} while (0)
|
||||
|
||||
/* Is p empty. */
|
||||
#define CPU_EMPTY(p) __extension__ ({ \
|
||||
__size_t __i; \
|
||||
for (__i = 0; __i < _NCPUWORDS; __i++) \
|
||||
if ((p)->__bits[__i]) \
|
||||
break; \
|
||||
__i == _NCPUWORDS; \
|
||||
})
|
||||
|
||||
/* Is p full set. */
|
||||
#define CPU_ISFULLSET(p) __extension__ ({ \
|
||||
__size_t __i; \
|
||||
@@ -104,34 +71,6 @@
|
||||
__i != _NCPUWORDS; \
|
||||
})
|
||||
|
||||
/* Compare two sets, returns 0 if equal 1 otherwise. */
|
||||
#define CPU_CMP(p, c) __extension__ ({ \
|
||||
__size_t __i; \
|
||||
for (__i = 0; __i < _NCPUWORDS; __i++) \
|
||||
if (((c)->__bits[__i] != \
|
||||
(p)->__bits[__i])) \
|
||||
break; \
|
||||
__i != _NCPUWORDS; \
|
||||
})
|
||||
|
||||
#define CPU_OR(d, s) do { \
|
||||
__size_t __i; \
|
||||
for (__i = 0; __i < _NCPUWORDS; __i++) \
|
||||
(d)->__bits[__i] |= (s)->__bits[__i]; \
|
||||
} while (0)
|
||||
|
||||
#define CPU_AND(d, s) do { \
|
||||
__size_t __i; \
|
||||
for (__i = 0; __i < _NCPUWORDS; __i++) \
|
||||
(d)->__bits[__i] &= (s)->__bits[__i]; \
|
||||
} while (0)
|
||||
|
||||
#define CPU_NAND(d, s) do { \
|
||||
__size_t __i; \
|
||||
for (__i = 0; __i < _NCPUWORDS; __i++) \
|
||||
(d)->__bits[__i] &= ~(s)->__bits[__i]; \
|
||||
} while (0)
|
||||
|
||||
#define CPU_CLR_ATOMIC(n, p) \
|
||||
atomic_clear_long(&(p)->__bits[__cpuset_word(n)], __cpuset_mask(n))
|
||||
|
||||
@@ -226,4 +165,4 @@ int cpuset_getaffinity(cpulevel_t, cpuwhich_t, id_t, size_t, cpuset_t *);
|
||||
int cpuset_setaffinity(cpulevel_t, cpuwhich_t, id_t, size_t, const cpuset_t *);
|
||||
__END_DECLS
|
||||
#endif
|
||||
#endif /* !_SYS_CPUSET_H_ */
|
||||
#endif /* !_RTEMS_BSD_SYS_CPUSET_H_ */
|
Reference in New Issue
Block a user