Changes due to <sys/cpuset.h> from latest Newlib

This commit is contained in:
Sebastian Huber
2013-12-02 15:36:31 +01:00
parent 3e101be476
commit 2815cdbf4d
8 changed files with 17 additions and 69 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -16,7 +16,7 @@
#ifndef LOCORE
#include <sys/cpuset.h>
#include <rtems/bsd/sys/cpuset.h>
/*
* Topology of a NUMA or HTT system.

View File

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

View File

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