Commit 9820b389 by Jerome Lambourg Committed by Pierre-Marie de Rodat

[Ada] Fix retrieval of number of CPUs on QNX

Although the sysconf SC_NPROCESSORS_ONLN is also defined by the API, the
only documented way to retrieve the number of CPUs is by using the syspage.

This also better organise the QNX-specific macros in adaint.c

2018-05-22  Jerome Lambourg  <lambourg@adacore.com>

gcc/ada/

	* adaint.c: Reorganize QNX-specific macros, use syspage to retreive the
	number of CPUs.

From-SVN: r260531
parent 817659c5
2018-05-22 Jerome Lambourg <lambourg@adacore.com> 2018-05-22 Jerome Lambourg <lambourg@adacore.com>
* adaint.c: Reorganize QNX-specific macros, use syspage to retreive the
number of CPUs.
2018-05-22 Jerome Lambourg <lambourg@adacore.com>
* sigtramp-qnx.c: Properly restore link register in signal trampoline. * sigtramp-qnx.c: Properly restore link register in signal trampoline.
2018-05-22 Hristian Kirtchev <kirtchev@adacore.com> 2018-05-22 Hristian Kirtchev <kirtchev@adacore.com>
......
...@@ -39,7 +39,9 @@ ...@@ -39,7 +39,9 @@
#define _THREAD_SAFE #define _THREAD_SAFE
/* Use 64 bit Large File API */ /* Use 64 bit Large File API */
#ifndef _LARGEFILE_SOURCE #if defined (__QNX__)
#define _LARGEFILE64_SOURCE 1
#elif !defined(_LARGEFILE_SOURCE)
#define _LARGEFILE_SOURCE #define _LARGEFILE_SOURCE
#endif #endif
#define _FILE_OFFSET_BITS 64 #define _FILE_OFFSET_BITS 64
...@@ -81,8 +83,8 @@ ...@@ -81,8 +83,8 @@
#define __BSD_VISIBLE 1 #define __BSD_VISIBLE 1
#endif #endif
#if defined (__QNX__) #ifdef __QNX__
#define _LARGEFILE64_SOURCE 1 #include <sys/syspage.h>
#endif #endif
#ifdef IN_RTS #ifdef IN_RTS
...@@ -2350,9 +2352,12 @@ __gnat_number_of_cpus (void) ...@@ -2350,9 +2352,12 @@ __gnat_number_of_cpus (void)
#if defined (__linux__) || defined (__sun__) || defined (_AIX) \ #if defined (__linux__) || defined (__sun__) || defined (_AIX) \
|| defined (__APPLE__) || defined (__FreeBSD__) || defined (__OpenBSD__) \ || defined (__APPLE__) || defined (__FreeBSD__) || defined (__OpenBSD__) \
|| defined (__DragonFly__) || defined (__NetBSD__) || defined (__QNX__) || defined (__DragonFly__) || defined (__NetBSD__)
cores = (int) sysconf (_SC_NPROCESSORS_ONLN); cores = (int) sysconf (_SC_NPROCESSORS_ONLN);
#elif defined (__QNX__)
cores = (int) _syspage_ptr->num_cpu;
#elif defined (__hpux__) #elif defined (__hpux__)
struct pst_dynamic psd; struct pst_dynamic psd;
if (pstat_getdynamic (&psd, sizeof (psd), 1, 0) != -1) if (pstat_getdynamic (&psd, sizeof (psd), 1, 0) != -1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment