public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] Let libstdc++ know that VxWorks has_nanosleep
@ 2019-12-13 17:54 Olivier Hainque
  2019-12-19 11:13 ` Jonathan Wakely
  0 siblings, 1 reply; 5+ messages in thread
From: Olivier Hainque @ 2019-12-13 17:54 UTC (permalink / raw)
  To: GCC Patches; +Cc: Olivier Hainque, Corentin Gay, libstdc++

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


This change adjusts the libstdc++ configuration for VxWorks
to set ac_has_nanosleep=yes, which enables the use of nanosleep
from the library.

While this technically depends on the kernel configuration
(INCLUDE_POSIX_TIMERS) this is the normal configuration in all
the environments we have been given to work with for the past
decade and activating this improves the library in our experience.

Tested in accordance with the description in
https://gcc.gnu.org/ml/gcc-patches/2019-12/msg00911.html

Best Regards,

Olivier

2019-12-13  Corentin Gay  <gay@adacore.com>

	libstdc++/
	* acinclude.m4 (vxworks*): New entry. Set ac_has_nanosleep=yes.
	* configure: Regenerate.


[-- Attachment #2: 0018-Configure-libstdc-with-nanosleep-support-for-VxWorks.patch.txt --]
[-- Type: text/plain, Size: 1286 bytes --]

--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -1408,6 +1408,11 @@ AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [
         ac_has_nanosleep=yes
         ac_has_sched_yield=yes
         ;;
+      # VxWorks has nanosleep as soon as the kernel is configured with
+      # INCLUDE_POSIX_TIMERS, which is normally/most-often the case.
+      vxworks*)
+        ac_has_nanosleep=yes
+        ;;
       gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
         AC_MSG_CHECKING([for at least GNU libc 2.17])
         AC_TRY_COMPILE(
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index fa86ca1e731..717f5c1d21d 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -20871,6 +20871,11 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
         ac_has_nanosleep=yes
         ac_has_sched_yield=yes
         ;;
+      # VxWorks has nanosleep as soon as the kernel is configured with
+      # INCLUDE_POSIX_TIMERS, which is normally/most-often the case.
+      vxworks*)
+        ac_has_nanosleep=yes
+        ;;
       gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for at least GNU libc 2.17" >&5
 $as_echo_n "checking for at least GNU libc 2.17... " >&6; }
-- 
2.17.1


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

* Re: [patch] Let libstdc++ know that VxWorks has_nanosleep
  2019-12-13 17:54 [patch] Let libstdc++ know that VxWorks has_nanosleep Olivier Hainque
@ 2019-12-19 11:13 ` Jonathan Wakely
  2019-12-22 22:20   ` Olivier Hainque
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Wakely @ 2019-12-19 11:13 UTC (permalink / raw)
  To: Olivier Hainque; +Cc: GCC Patches, Corentin Gay, libstdc++

On 13/12/19 18:54 +0100, Olivier Hainque wrote:
>
>This change adjusts the libstdc++ configuration for VxWorks
>to set ac_has_nanosleep=yes, which enables the use of nanosleep
>from the library.
>
>While this technically depends on the kernel configuration
>(INCLUDE_POSIX_TIMERS) this is the normal configuration in all
>the environments we have been given to work with for the past
>decade and activating this improves the library in our experience.

Is there a way to detect that more reliably? Should we replicate the
test used later in the file, to detect whether the timers are really
enabled for VxWorks?

       AC_MSG_CHECKING([for nanosleep])
       AC_TRY_LINK(
	[#include <unistd.h>
	 #include <time.h>
	],
	[#if _POSIX_TIMERS > 0
	  timespec tp;
	 #endif
	  nanosleep(&tp, 0);
	], [ac_has_nanosleep=yes], [ac_has_nanosleep=no])

       AC_MSG_RESULT($ac_has_nanosleep)


You're the port maintainer though, so if you think that's not needed
then the patch is OK for trunk.

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

* Re: [patch] Let libstdc++ know that VxWorks has_nanosleep
  2019-12-19 11:13 ` Jonathan Wakely
@ 2019-12-22 22:20   ` Olivier Hainque
  2020-01-06 15:21     ` Jonathan Wakely
  0 siblings, 1 reply; 5+ messages in thread
From: Olivier Hainque @ 2019-12-22 22:20 UTC (permalink / raw)
  To: Jonathan Wakely
  Cc: GCC Patches, Corentin Gay, libstdc++, Jérôme Lambourg

Hi Jonathan,

> On 19 Dec 2019, at 12:13, Jonathan Wakely <jwakely@redhat.com> wrote:
> 
> 
> Is there a way to detect that more reliably? Should we replicate the
> test used later in the file, to detect whether the timers are really
> enabled for VxWorks?
> 
>      AC_MSG_CHECKING([for nanosleep])
...
> You're the port maintainer though, so if you think that's not needed
> then the patch is OK for trunk.

Thanks for your feedback Jonathan,

Unfortunately, the AC kind of check is actually less reliable
on VxWorks, in particular for the so called "kernel" mode where
linking a "module" actually performs only a partial link to be
downloaded on a target where the run-time loader takes care of
the rest.

The current assumption on the environment configuration is on
a component included by default and required for a number
of very common time related operations anyway, so always there
in practice in our experience.

The rare/unlikely users that would not have the library
configured in on the VxWorks end would just not access to the
c++ time related facilities, which is not a problem.

Overall, this really seems like a good setting for
--enable-libstdcxx-time auto.

Olivier

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

* Re: [patch] Let libstdc++ know that VxWorks has_nanosleep
  2019-12-22 22:20   ` Olivier Hainque
@ 2020-01-06 15:21     ` Jonathan Wakely
  2020-01-07 10:12       ` Olivier Hainque
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Wakely @ 2020-01-06 15:21 UTC (permalink / raw)
  To: Olivier Hainque
  Cc: GCC Patches, Corentin Gay, libstdc++, Jérôme Lambourg

On 22/12/19 23:20 +0100, Olivier Hainque wrote:
>Hi Jonathan,
>
>> On 19 Dec 2019, at 12:13, Jonathan Wakely <jwakely@redhat.com> wrote:
>>
>>
>> Is there a way to detect that more reliably? Should we replicate the
>> test used later in the file, to detect whether the timers are really
>> enabled for VxWorks?
>>
>>      AC_MSG_CHECKING([for nanosleep])
>...
>> You're the port maintainer though, so if you think that's not needed
>> then the patch is OK for trunk.
>
>Thanks for your feedback Jonathan,
>
>Unfortunately, the AC kind of check is actually less reliable
>on VxWorks, in particular for the so called "kernel" mode where
>linking a "module" actually performs only a partial link to be
>downloaded on a target where the run-time loader takes care of
>the rest.
>
>The current assumption on the environment configuration is on
>a component included by default and required for a number
>of very common time related operations anyway, so always there
>in practice in our experience.
>
>The rare/unlikely users that would not have the library
>configured in on the VxWorks end would just not access to the
>c++ time related facilities, which is not a problem.
>
>Overall, this really seems like a good setting for
>--enable-libstdcxx-time auto.

OK, that makes sense. Thanks!


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

* Re: [patch] Let libstdc++ know that VxWorks has_nanosleep
  2020-01-06 15:21     ` Jonathan Wakely
@ 2020-01-07 10:12       ` Olivier Hainque
  0 siblings, 0 replies; 5+ messages in thread
From: Olivier Hainque @ 2020-01-07 10:12 UTC (permalink / raw)
  To: Jonathan Wakely
  Cc: Olivier Hainque, GCC Patches, Corentin Gay, libstdc++,
	Jérôme Lambourg



> On 6 Jan 2020, at 16:21, Jonathan Wakely <jwakely@redhat.com> wrote:
>> 
>> Overall, this really seems like a good setting for
>> --enable-libstdcxx-time auto.
> 
> OK, that makes sense. Thanks!

Sure, thank you for your feedback :)

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

end of thread, other threads:[~2020-01-07 10:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-13 17:54 [patch] Let libstdc++ know that VxWorks has_nanosleep Olivier Hainque
2019-12-19 11:13 ` Jonathan Wakely
2019-12-22 22:20   ` Olivier Hainque
2020-01-06 15:21     ` Jonathan Wakely
2020-01-07 10:12       ` Olivier Hainque

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