[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
This commit is contained in:
Jerome Lambourg 2018-05-22 13:26:49 +00:00 committed by Pierre-Marie de Rodat
parent 817659c5f3
commit 9820b38978
2 changed files with 14 additions and 4 deletions

View file

@ -1,3 +1,8 @@
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.

View file

@ -39,7 +39,9 @@
#define _THREAD_SAFE
/* Use 64 bit Large File API */
#ifndef _LARGEFILE_SOURCE
#if defined (__QNX__)
#define _LARGEFILE64_SOURCE 1
#elif !defined(_LARGEFILE_SOURCE)
#define _LARGEFILE_SOURCE
#endif
#define _FILE_OFFSET_BITS 64
@ -81,8 +83,8 @@
#define __BSD_VISIBLE 1
#endif
#if defined (__QNX__)
#define _LARGEFILE64_SOURCE 1
#ifdef __QNX__
#include <sys/syspage.h>
#endif
#ifdef IN_RTS
@ -2350,9 +2352,12 @@ __gnat_number_of_cpus (void)
#if defined (__linux__) || defined (__sun__) || defined (_AIX) \
|| defined (__APPLE__) || defined (__FreeBSD__) || defined (__OpenBSD__) \
|| defined (__DragonFly__) || defined (__NetBSD__) || defined (__QNX__)
|| defined (__DragonFly__) || defined (__NetBSD__)
cores = (int) sysconf (_SC_NPROCESSORS_ONLN);
#elif defined (__QNX__)
cores = (int) _syspage_ptr->num_cpu;
#elif defined (__hpux__)
struct pst_dynamic psd;
if (pstat_getdynamic (&psd, sizeof (psd), 1, 0) != -1)