public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* unknown type name 'cpu_set_t' in newlib/libc/include/sched.h
@ 2019-08-12  0:28 Giacomo Tesio
  2019-08-12  7:52 ` Corinna Vinschen
  0 siblings, 1 reply; 10+ messages in thread
From: Giacomo Tesio @ 2019-08-12  0:28 UTC (permalink / raw)
  To: newlib

Hello everybody,

apparently commit 383e19ca552234fa9af47e80cb00d843a96de9e3 moved the
cpu_set_t typedef from newlib/libc/include/sched.h to cygwin specific
stuff, but left a few functions using such type behind and
unprotected.

Is it intended?


Giacomo

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: unknown type name 'cpu_set_t' in newlib/libc/include/sched.h
  2019-08-12  0:28 unknown type name 'cpu_set_t' in newlib/libc/include/sched.h Giacomo Tesio
@ 2019-08-12  7:52 ` Corinna Vinschen
  2019-08-12  9:12   ` Giacomo Tesio
  2019-08-12 12:42   ` Joel Sherrill
  0 siblings, 2 replies; 10+ messages in thread
From: Corinna Vinschen @ 2019-08-12  7:52 UTC (permalink / raw)
  To: Giacomo Tesio; +Cc: newlib

[-- Attachment #1: Type: text/plain, Size: 458 bytes --]

On Aug 12 02:28, Giacomo Tesio wrote:
> Hello everybody,
> 
> apparently commit 383e19ca552234fa9af47e80cb00d843a96de9e3 moved the
> cpu_set_t typedef from newlib/libc/include/sched.h to cygwin specific
> stuff, but left a few functions using such type behind and
> unprotected.
> 
> Is it intended?

Probably not, if it leads to build errors on non-Cygwin, non-RTEMS.

Does it?


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* unknown type name 'cpu_set_t' in newlib/libc/include/sched.h
  2019-08-12  7:52 ` Corinna Vinschen
@ 2019-08-12  9:12   ` Giacomo Tesio
  2019-08-12 10:16     ` Corinna Vinschen
  2019-08-12 12:42   ` Joel Sherrill
  1 sibling, 1 reply; 10+ messages in thread
From: Giacomo Tesio @ 2019-08-12  9:12 UTC (permalink / raw)
  To: newlib, Giacomo Tesio

On Monday, 12 August 2019, Corinna Vinschen <vinschen@redhat.com> wrote:
> On Aug 12 02:28, Giacomo Tesio wrote:
>> Hello everybody,
>>
>> apparently commit 383e19ca552234fa9af47e80cb00d843a96de9e3 moved the
>> cpu_set_t typedef from newlib/libc/include/sched.h to cygwin specific
>> stuff, but left a few functions using such type behind and
>> unprotected.
>>
>> Is it intended?
>
> Probably not, if it leads to build errors on non-Cygwin, non-RTEMS.
>
> Does it?

Yes it produce build errore in my os port because I don't have it defined
anywhere.

You could either protect the functions with an ifdef or move back the
typedef to sched.h


Giacomo

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: unknown type name 'cpu_set_t' in newlib/libc/include/sched.h
  2019-08-12  9:12   ` Giacomo Tesio
@ 2019-08-12 10:16     ` Corinna Vinschen
  2019-08-12 23:47       ` Giacomo Tesio
  0 siblings, 1 reply; 10+ messages in thread
From: Corinna Vinschen @ 2019-08-12 10:16 UTC (permalink / raw)
  To: Giacomo Tesio, Sebastian Huber; +Cc: newlib

[-- Attachment #1: Type: text/plain, Size: 2019 bytes --]

On Aug 12 11:05, Giacomo Tesio wrote:
> On Monday, 12 August 2019, Corinna Vinschen <vinschen@redhat.com> wrote:
> > On Aug 12 02:28, Giacomo Tesio wrote:
> >> Hello everybody,
> >>
> >> apparently commit 383e19ca552234fa9af47e80cb00d843a96de9e3 moved the
> >> cpu_set_t typedef from newlib/libc/include/sched.h to cygwin specific
> >> stuff, but left a few functions using such type behind and
> >> unprotected.
> >>
> >> Is it intended?
> >
> > Probably not, if it leads to build errors on non-Cygwin, non-RTEMS.
> >
> > Does it?
> 
> Yes it produce build errore in my os port because I don't have it defined
> anywhere.
> 
> You could either protect the functions with an ifdef or move back the
> typedef to sched.h

I'd propose this patch:

From d192727fee2f85fcc7eb78c7cb09963a7b663d5a Mon Sep 17 00:00:00 2001
From: Corinna Vinschen <corinna@vinschen.de>
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.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: unknown type name 'cpu_set_t' in newlib/libc/include/sched.h
  2019-08-12  7:52 ` Corinna Vinschen
  2019-08-12  9:12   ` Giacomo Tesio
@ 2019-08-12 12:42   ` Joel Sherrill
  2019-08-12 17:01     ` Giacomo Tesio
  1 sibling, 1 reply; 10+ messages in thread
From: Joel Sherrill @ 2019-08-12 12:42 UTC (permalink / raw)
  To: Newlib, Giacomo Tesio

On Mon, Aug 12, 2019, 2:52 AM Corinna Vinschen <vinschen@redhat.com> wrote:

> On Aug 12 02:28, Giacomo Tesio wrote:
> > Hello everybody,
> >
> > apparently commit 383e19ca552234fa9af47e80cb00d843a96de9e3 moved the
> > cpu_set_t typedef from newlib/libc/include/sched.h to cygwin specific
> > stuff, but left a few functions using such type behind and
> > unprotected.
> >
> > Is it intended?
>
> Probably not, if it leads to build errors on non-Cygwin, non-RTEMS.
>
> Does it?
>

Is this with a test program or building Newlib itself. I have recently
built non-rtems targets to spot check some of the fenv work.

--joel



>
> Corinna
>
> --
> Corinna Vinschen
> Cygwin Maintainer
> Red Hat
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: unknown type name 'cpu_set_t' in newlib/libc/include/sched.h
  2019-08-12 12:42   ` Joel Sherrill
@ 2019-08-12 17:01     ` Giacomo Tesio
  2019-08-12 18:13       ` Joel Sherrill
  0 siblings, 1 reply; 10+ messages in thread
From: Giacomo Tesio @ 2019-08-12 17:01 UTC (permalink / raw)
  To: Joel Sherrill; +Cc: Newlib

On 12/08/2019, Joel Sherrill <joel.sherrill@gmail.com> wrote:
> On Mon, Aug 12, 2019, 2:52 AM Corinna Vinschen <vinschen@redhat.com> wrote:
> Is this with a test program or building Newlib itself. I have recently
> built non-rtems targets to spot check some of the fenv work.

Here is the error message:

x86_64-jehanne-gcc -B/newlib/build/x86_64-jehanne/newlib/ -isystem
/newlib/build/x86_64-jehanne/newlib/targ-include -isystem
/newlib/src/newlib/libc/include
-B/newlib/build/x86_64-jehanne/libgloss/x86_64
-L/newlib/build/x86_64-jehanne/libgloss/libnosys
-L/newlib/src/libgloss/x86_64
-I/newlib/src/newlib/libc/sys/jehanne/include
-DPACKAGE_NAME=\"newlib\" -DPACKAGE_TARNAME=\"newlib\"
-DPACKAGE_VERSION=\"3.1.0\" -DPACKAGE_STRING=\"newlib\ 3.1.0\"
-DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -I.
-I/newlib//src/newlib/libc/posix -fno-builtin
-DREENTRANT_SYSCALLS_PROVIDED -DMALLOC_PROVIDED -DSIGNAL_PROVIDED
-D_NO_GETLOGIN -D_NO_GETCWD -D_NO_GETPASS -D_NO_GETUT -D_NO_PWRITE
-D_NO_PREAD -DHAVE_FCNTL -fno-omit-frame-pointer -DHAVE_INIT_FINI
-D_GNU_SOURCE -g -gdwarf-2 -ggdb -O2 -c -o lib_a-posix_spawn.o `test
-f 'posix_spawn.c' || echo
'/newlib//src/newlib/libc/posix/'`posix_spawn.c
In file included from /newlib//src/newlib/libc/posix/posix_spawn.c:99:0:
/newlib/src/newlib/libc/include/sched.h:96:39: error: unknown type
name ‘cpu_set_t’
 int sched_getaffinity (pid_t, size_t, cpu_set_t *);
                                       ^
/newlib/src/newlib/libc/include/sched.h:97:48: error: unknown type
name ‘cpu_set_t’
 int sched_get_thread_affinity (void *, size_t, cpu_set_t *);
                                                ^
/newlib/src/newlib/libc/include/sched.h:98:45: error: unknown type
name ‘cpu_set_t’
 int sched_setaffinity (pid_t, size_t, const cpu_set_t *);
                                             ^
/newlib/src/newlib/libc/include/sched.h:99:54: error: unknown type
name ‘cpu_set_t’
 int sched_set_thread_affinity (void *, size_t, const cpu_set_t *);
                                                      ^
Makefile:594: recipe for target 'lib_a-posix_spawn.o' failed


@Corinna: I'll try your patch tonight... sorry for the delay...



Giacomo

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: unknown type name 'cpu_set_t' in newlib/libc/include/sched.h
  2019-08-12 17:01     ` Giacomo Tesio
@ 2019-08-12 18:13       ` Joel Sherrill
  2019-08-13  5:00         ` Sebastian Huber
  0 siblings, 1 reply; 10+ messages in thread
From: Joel Sherrill @ 2019-08-12 18:13 UTC (permalink / raw)
  To: Giacomo Tesio; +Cc: Newlib

On Mon, Aug 12, 2019 at 12:01 PM Giacomo Tesio <giacomo@tesio.it> wrote:

> On 12/08/2019, Joel Sherrill <joel.sherrill@gmail.com> wrote:
> > On Mon, Aug 12, 2019, 2:52 AM Corinna Vinschen <vinschen@redhat.com>
> wrote:
> > Is this with a test program or building Newlib itself. I have recently
> > built non-rtems targets to spot check some of the fenv work.
>
> Here is the error message:
>
> x86_64-jehanne-gcc -B/newlib/build/x86_64-jehanne/newlib/ -isystem
> /newlib/build/x86_64-jehanne/newlib/targ-include -isystem
> /newlib/src/newlib/libc/include
> -B/newlib/build/x86_64-jehanne/libgloss/x86_64
> -L/newlib/build/x86_64-jehanne/libgloss/libnosys
> -L/newlib/src/libgloss/x86_64
> -I/newlib/src/newlib/libc/sys/jehanne/include
> -DPACKAGE_NAME=\"newlib\" -DPACKAGE_TARNAME=\"newlib\"
> -DPACKAGE_VERSION=\"3.1.0\" -DPACKAGE_STRING=\"newlib\ 3.1.0\"
> -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -I.
> -I/newlib//src/newlib/libc/posix -fno-builtin
> -DREENTRANT_SYSCALLS_PROVIDED -DMALLOC_PROVIDED -DSIGNAL_PROVIDED
> -D_NO_GETLOGIN -D_NO_GETCWD -D_NO_GETPASS -D_NO_GETUT -D_NO_PWRITE
> -D_NO_PREAD -DHAVE_FCNTL -fno-omit-frame-pointer -DHAVE_INIT_FINI
> -D_GNU_SOURCE -g -gdwarf-2 -ggdb -O2 -c -o lib_a-posix_spawn.o `test
> -f 'posix_spawn.c' || echo
> '/newlib//src/newlib/libc/posix/'`posix_spawn.c
> In file included from /newlib//src/newlib/libc/posix/posix_spawn.c:99:0:
> /newlib/src/newlib/libc/include/sched.h:96:39: error: unknown type
> name ‘cpu_set_t’
>  int sched_getaffinity (pid_t, size_t, cpu_set_t *);
>                                        ^
> /newlib/src/newlib/libc/include/sched.h:97:48: error: unknown type
> name ‘cpu_set_t’
>  int sched_get_thread_affinity (void *, size_t, cpu_set_t *);
>                                                 ^
> /newlib/src/newlib/libc/include/sched.h:98:45: error: unknown type
> name ‘cpu_set_t’
>  int sched_setaffinity (pid_t, size_t, const cpu_set_t *);
>                                              ^
> /newlib/src/newlib/libc/include/sched.h:99:54: error: unknown type
> name ‘cpu_set_t’
>  int sched_set_thread_affinity (void *, size_t, const cpu_set_t *);
>                                                       ^
> Makefile:594: recipe for target 'lib_a-posix_spawn.o' failed
>
>
> @Corinna: I'll try your patch tonight... sorry for the delay...
>

Corinna's patch looks like it resolve it.

Is it safe to assume all <sys/cpuset.h> implementations will use the same
header guards?

--joel


>
>
> Giacomo
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: unknown type name 'cpu_set_t' in newlib/libc/include/sched.h
  2019-08-12 10:16     ` Corinna Vinschen
@ 2019-08-12 23:47       ` Giacomo Tesio
  0 siblings, 0 replies; 10+ messages in thread
From: Giacomo Tesio @ 2019-08-12 23:47 UTC (permalink / raw)
  To: newlib, Giacomo Tesio, Sebastian Huber

Hi Corinna I can confirm this patch works fine.

Thanks!


Giacomo

On 12/08/2019, Corinna Vinschen <vinschen@redhat.com> wrote:
> From d192727fee2f85fcc7eb78c7cb09963a7b663d5a Mon Sep 17 00:00:00 2001
> From: Corinna Vinschen <corinna@vinschen.de>
> 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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: unknown type name 'cpu_set_t' in newlib/libc/include/sched.h
  2019-08-12 18:13       ` Joel Sherrill
@ 2019-08-13  5:00         ` Sebastian Huber
  2019-08-13  7:39           ` Corinna Vinschen
  0 siblings, 1 reply; 10+ messages in thread
From: Sebastian Huber @ 2019-08-13  5:00 UTC (permalink / raw)
  To: Newlib

On 12/08/2019 20:13, Joel Sherrill wrote:
> Corinna's patch looks like it resolve it.
> 
> Is it safe to assume all <sys/cpuset.h> implementations will use the same
> header guards?

I think in the long run, it would be nice to have a standard 
<sys/cpuset.h> in Newlib which works on all targets. For now, this patch 
looks fine.

-- 
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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: unknown type name 'cpu_set_t' in newlib/libc/include/sched.h
  2019-08-13  5:00         ` Sebastian Huber
@ 2019-08-13  7:39           ` Corinna Vinschen
  0 siblings, 0 replies; 10+ messages in thread
From: Corinna Vinschen @ 2019-08-13  7:39 UTC (permalink / raw)
  To: Sebastian Huber; +Cc: Newlib

[-- Attachment #1: Type: text/plain, Size: 480 bytes --]

On Aug 13 07:00, Sebastian Huber wrote:
> On 12/08/2019 20:13, Joel Sherrill wrote:
> > Corinna's patch looks like it resolve it.
> > 
> > Is it safe to assume all <sys/cpuset.h> implementations will use the same
> > header guards?
> 
> I think in the long run, it would be nice to have a standard <sys/cpuset.h>
> in Newlib which works on all targets. For now, this patch looks fine.

Pushed.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-08-13  7:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-12  0:28 unknown type name 'cpu_set_t' in newlib/libc/include/sched.h Giacomo Tesio
2019-08-12  7:52 ` Corinna Vinschen
2019-08-12  9:12   ` Giacomo Tesio
2019-08-12 10:16     ` Corinna Vinschen
2019-08-12 23:47       ` Giacomo Tesio
2019-08-12 12:42   ` Joel Sherrill
2019-08-12 17:01     ` Giacomo Tesio
2019-08-12 18:13       ` Joel Sherrill
2019-08-13  5:00         ` Sebastian Huber
2019-08-13  7:39           ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).