Patch: Add RTEMS Specific sys/cpuset.h

Sebastian Huber sebastian.huber@embedded-brains.de
Tue Nov 26 10:46:00 GMT 2013


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.



More information about the Newlib mailing list