This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: Patch: Add RTEMS Specific sys/cpuset.h
- From: Sebastian Huber <sebastian dot huber at embedded-brains dot de>
- To: newlib at sourceware dot org
- Cc: Joel Sherrill <Joel dot Sherrill at oarcorp dot com>
- Date: Tue, 26 Nov 2013 11:46:10 +0100
- Subject: Re: Patch: Add RTEMS Specific sys/cpuset.h
- Authentication-results: sourceware.org; auth=none
- References: <5284F201 dot 4070901 at oarcorp dot com>
Hello Joel,
On 2013-11-14 16:53, Joel Sherrill wrote:
+#ifndef_SYS_CPUSET_H_
+#define_SYS_CPUSET_H_
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <stdint.h>
+
+/* RTEMS supports a maximum of 32 CPU cores */
+#ifndef CPU_SETSIZE
+#define CPU_SETSIZE 32
+#endif
+
+/* word in the cpu set */
+typedef uint32_t cpu_set_word_t;
+
+/* Number of bits per cpu_set_t element */
+#define _NCPUBITS (sizeof(cpu_set_word_t) * NBBY) /* bits per mask */
+/* Number of words in the cpu_set_t array */
+#define _NCPUWORDS howmany(CPU_SETSIZE, _NCPUBITS)
the file you checked in into the Newlib repository has not the same content as
the file posted to the list. In Newlib we have now:
#ifndef _SYS_CPUSET_H_
#define _SYS_CPUSET_H_
#if 0
#include <sys/types.h>
#endif
#include <stdint.h>
/* RTEMS supports a maximum of 32 CPU cores */
#ifndef CPU_SETSIZE
#define CPU_SETSIZE 32
#endif
/* word in the cpu set */
typedef uint32_t cpu_set_word_t;
/* Number of bits per cpu_set_t element */
#define _NCPUBITS (sizeof(cpu_set_word_t) * NBBY) /* bits per mask */
/* Number of words in the cpu_set_t array */
/* NOTE: Can't use howmany() because of circular dependency */
#define _NCPUWORDS (((CPU_SETSIZE)+((_NCPUBITS)-1))/(_NCPUBITS))
You didn't solve this circular dependency problem completely and it would have
been nice to inform the list about this issue. We still use NBBY which is
defined in <sys/types.h>. We also use size_t. For this we can include
<stddef.h>. We want to use <sys/cpuset.h> in <sys/types.h> to add the affinity
set to pthread_attr_t.
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.huber@embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.