Re: unknown type name 'cpu_set_t' in newlib/libc/include/sched.h

Giacomo Tesio <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <CAHL7psE-g53ZwzSYFiiOctCLb-M=ZQfk2tXx3A8uGYsE_Hb=uQ@mail.gmail.com>
Hi Corinna I can confirm this patch works fine.

Thanks!


Giacomo

On 12/08/2019, Corinna Vinschen <[email protected]> wrote:
> From d192727fee2f85fcc7eb78c7cb09963a7b663d5a Mon Sep 17 00:00:00 2001
> From: Corinna Vinschen <[email protected]>
> Date: Mon, 12 Aug 2019 12:13:20 +0200
> Subject: [PATCH] sched.h: Declare affinity functions only on targets
>  supporting them
>
> ---
>  newlib/libc/include/sched.h | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/newlib/libc/include/sched.h b/newlib/libc/include/sched.h
> index 79b775e220c7..31599aa7e6ca 100644
> --- a/newlib/libc/include/sched.h
> +++ b/newlib/libc/include/sched.h
> @@ -93,10 +93,16 @@ int sched_yield( void );
>  #if __GNU_VISIBLE
>  int sched_getcpu(void);
>
> +/* The following functions should only be declared if the type
> +   cpu_set_t is defined through indirect inclusion of sys/cpuset.h,
> +   only available on some targets. */
> +#ifdef _SYS_CPUSET_H_
>  int sched_getaffinity (pid_t, size_t, cpu_set_t *);
>  int sched_get_thread_affinity (void *, size_t, cpu_set_t *);
>  int sched_setaffinity (pid_t, size_t, const cpu_set_t *);
>  int sched_set_thread_affinity (void *, size_t, const cpu_set_t *);
> +#endif /* _SYS_CPUSET_H_ */
> +
>  #endif
>
>  #ifdef __cplusplus
> --
> 2.20.1
>
>
> Please test or suggest an alternative.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.