[rtems-libbsd commit] Changes due to <sys/cpuset.h> from latest Newlib
Sebastian Huber
sebh at rtems.org
Wed Dec 4 12:37:36 UTC 2013
Module: rtems-libbsd
Branch: master
Commit: 2815cdbf4d7bc39f71de83e75629d53f62a50dc1
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=2815cdbf4d7bc39f71de83e75629d53f62a50dc1
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Mon Dec 2 15:36:31 2013 +0100
Changes due to <sys/cpuset.h> from latest Newlib
---
freebsd-to-rtems.py | 1 +
freebsd/lib/libmemstat/memstat_uma.c | 2 +-
freebsd/sys/kern/init_main.c | 2 +-
freebsd/sys/kern/kern_intr.c | 2 +-
freebsd/sys/sys/_cpuset.h | 8 +++
freebsd/sys/sys/smp.h | 2 +-
freebsd/sys/sys/sysproto.h | 2 +-
.../include/rtems/bsd}/sys/cpuset.h | 67 +-------------------
8 files changed, 17 insertions(+), 69 deletions(-)
diff --git a/freebsd-to-rtems.py b/freebsd-to-rtems.py
index f472006..bed9818 100755
--- a/freebsd-to-rtems.py
+++ b/freebsd-to-rtems.py
@@ -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)
diff --git a/freebsd/lib/libmemstat/memstat_uma.c b/freebsd/lib/libmemstat/memstat_uma.c
index 86059b4..1be0ada 100644
--- a/freebsd/lib/libmemstat/memstat_uma.c
+++ b/freebsd/lib/libmemstat/memstat_uma.c
@@ -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>
diff --git a/freebsd/sys/kern/init_main.c b/freebsd/sys/kern/init_main.c
index e694f47..40fcacb 100644
--- a/freebsd/sys/kern/init_main.c
+++ b/freebsd/sys/kern/init_main.c
@@ -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>
diff --git a/freebsd/sys/kern/kern_intr.c b/freebsd/sys/kern/kern_intr.c
index b807402..169e1c7 100644
--- a/freebsd/sys/kern/kern_intr.c
+++ b/freebsd/sys/kern/kern_intr.c
@@ -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>
diff --git a/freebsd/sys/sys/_cpuset.h b/freebsd/sys/sys/_cpuset.h
index 42a0a6a..402d144 100644
--- a/freebsd/sys/sys/_cpuset.h
+++ b/freebsd/sys/sys/_cpuset.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_ */
diff --git a/freebsd/sys/sys/smp.h b/freebsd/sys/sys/smp.h
index 2db4ea8..6038c38 100644
--- a/freebsd/sys/sys/smp.h
+++ b/freebsd/sys/sys/smp.h
@@ -16,7 +16,7 @@
#ifndef LOCORE
-#include <sys/cpuset.h>
+#include <rtems/bsd/sys/cpuset.h>
/*
* Topology of a NUMA or HTT system.
diff --git a/freebsd/sys/sys/sysproto.h b/freebsd/sys/sys/sysproto.h
index ff77ddc..5b7b190 100644
--- a/freebsd/sys/sys/sysproto.h
+++ b/freebsd/sys/sys/sysproto.h
@@ -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>
diff --git a/freebsd/sys/sys/cpuset.h b/rtemsbsd/include/rtems/bsd/sys/cpuset.h
similarity index 74%
rename from freebsd/sys/sys/cpuset.h
rename to rtemsbsd/include/rtems/bsd/sys/cpuset.h
index 9e6c125..9048c2d 100644
--- a/freebsd/sys/sys/cpuset.h
+++ b/rtemsbsd/include/rtems/bsd/sys/cpuset.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_ */
More information about the vc
mailing list