mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-08 18:19:08 +08:00
Cygwin: sys/cpuset.h: add cpuset-specific external functions
The latest incarnation of sys/cpuset.h broke building coreutils. The reason is the inclusion of stdlib.h and string.h and hence premature requests for datatypes not yet defined in the include chain. Avoid this by defining __cpuset_alloc and __cpuset_free as external functions, now defined in sched.cc. Linux is doing this too, just using different names for the functions. Redefine __cpuset_zero_s to use __builtin_memset only on compilers supporting it, otherwise using a simple loop. Drop the stdlib.h and string.h includes. Fixes: 3f2790e04439 ("Cygwin: Make gcc-specific code in <sys/cpuset.h> compiler-agnostic") Reported-by: Denis Excoffier <cygwin@Denis-Excoffier.org> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
930f210b21
commit
797d1bbd2e
@ -49,6 +49,8 @@ __b64_ntop NOSIGFE
|
|||||||
__b64_pton NOSIGFE
|
__b64_pton NOSIGFE
|
||||||
__bsd_qsort_r NOSIGFE
|
__bsd_qsort_r NOSIGFE
|
||||||
__chk_fail SIGFE
|
__chk_fail SIGFE
|
||||||
|
__cpuset_alloc SIGFE
|
||||||
|
__cpuset_free SIGFE
|
||||||
__cxa_atexit = cygwin__cxa_atexit SIGFE
|
__cxa_atexit = cygwin__cxa_atexit SIGFE
|
||||||
__cxa_finalize SIGFE
|
__cxa_finalize SIGFE
|
||||||
__dn_comp SIGFE
|
__dn_comp SIGFE
|
||||||
|
@ -9,8 +9,7 @@ details. */
|
|||||||
#ifndef _SYS_CPUSET_H_
|
#ifndef _SYS_CPUSET_H_
|
||||||
#define _SYS_CPUSET_H_
|
#define _SYS_CPUSET_H_
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <sys/features.h>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -42,25 +41,23 @@ __cpuset_alloc_size (int num)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define CPU_ALLOC(num) __cpuset_alloc (num)
|
#define CPU_ALLOC(num) __cpuset_alloc (num)
|
||||||
static __inline cpu_set_t *
|
extern cpu_set_t * __cpuset_alloc (int);
|
||||||
__cpuset_alloc (int num)
|
|
||||||
{
|
|
||||||
return (cpu_set_t *) malloc (CPU_ALLOC_SIZE(num));
|
|
||||||
}
|
|
||||||
|
|
||||||
#define CPU_FREE(set) __cpuset_free (set)
|
#define CPU_FREE(set) __cpuset_free (set)
|
||||||
static __inline void
|
void __cpuset_free (cpu_set_t *);
|
||||||
__cpuset_free (cpu_set_t *set)
|
|
||||||
{
|
|
||||||
free (set);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* These _S macros operate on dynamically-sized cpu sets of size 'siz' bytes */
|
/* These _S macros operate on dynamically-sized cpu sets of size 'siz' bytes */
|
||||||
#define CPU_ZERO_S(siz, set) __cpuset_zero_s (siz, set)
|
#define CPU_ZERO_S(siz, set) __cpuset_zero_s (siz, set)
|
||||||
static __inline void
|
static __inline
|
||||||
__cpuset_zero_s (size_t siz, cpu_set_t *set)
|
__cpuset_zero_s (size_t siz, cpu_set_t *set)
|
||||||
{
|
{
|
||||||
(void) memset (set, 0, siz);
|
#if __GNUC_PREREQ (2, 91)
|
||||||
|
__builtin_memset (set, 0, siz);
|
||||||
|
#else
|
||||||
|
siz /= sizeof (__cpu_mask);
|
||||||
|
while (siz > 0)
|
||||||
|
set->_bits[--siz] = 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CPU_SET_S(cpu, siz, set) __cpuset_set_s (cpu, siz, set)
|
#define CPU_SET_S(cpu, siz, set) __cpuset_set_s (cpu, siz, set)
|
||||||
|
@ -684,4 +684,16 @@ done:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cpu_set_t *
|
||||||
|
__cpuset_alloc (int num)
|
||||||
|
{
|
||||||
|
return (cpu_set_t *) malloc (CPU_ALLOC_SIZE(num));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
__cpuset_free (cpu_set_t *set)
|
||||||
|
{
|
||||||
|
free (set);
|
||||||
|
}
|
||||||
|
|
||||||
} /* extern C */
|
} /* extern C */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user