aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/adaint.c
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2010-10-11 10:28:58 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2010-10-11 10:28:58 +0200
commit20261dc1c7dacc89a7206a601c5f21c36c2c4b9e (patch)
tree53a36f30d39dd6dce627ca1d62602a2ede3ceae1 /gcc/ada/adaint.c
parent9694c03951602dd1216838de82dc1c2de54d2754 (diff)
downloadgcc-20261dc1c7dacc89a7206a601c5f21c36c2c4b9e.zip
gcc-20261dc1c7dacc89a7206a601c5f21c36c2c4b9e.tar.gz
gcc-20261dc1c7dacc89a7206a601c5f21c36c2c4b9e.tar.bz2
[multiple changes]
2010-10-11 Robert Dewar <dewar@adacore.com> * sem_ch6.adb, s-htable.ads: Minor reformatting. 2010-10-11 Ed Schonberg <schonberg@adacore.com> * sem_ch4.adb (Analyze_Selected_Component): If the selector is invisible in an instantiation, and both the formal and the actual are private extensions of the same type, look for the desired component in the proper view of the parent type. 2010-10-11 Vincent Celier <celier@adacore.com> * adaint.c (__gnat_number_of_cpus): Add implementation for Solaris, AIX, Tru64, Darwin, IRIX and HP-UX. From-SVN: r165277
Diffstat (limited to 'gcc/ada/adaint.c')
-rw-r--r--gcc/ada/adaint.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index a012ab6..b6c19de 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -49,6 +49,15 @@
#endif /* VxWorks */
+#if (defined (__mips) && defined (__sgi)) || defined (__APPLE__)
+#include <unistd.h>
+#endif
+
+#if defined (__hpux__)
+#include <sys/param.h>
+#include <sys/pstat.h>
+#endif
+
#ifdef VMS
#define _POSIX_EXIT 1
#define HOST_EXECUTABLE_SUFFIX ".exe"
@@ -2363,8 +2372,18 @@ __gnat_number_of_cpus (void)
{
int cores = 1;
-#if defined (linux)
+#if defined (linux) || defined (sun) || defined (AIX) || \
+ (defined (__alpha__) && defined (_osf_)) || defined (__APPLE__)
cores = (int)sysconf(_SC_NPROCESSORS_ONLN);
+
+#elif (defined (__mips) && defined (__sgi))
+ cores = (int)sysconf(_SC_NPROC_ONLN);
+
+#elif defined (__hpux__)
+ struct pst_dynamic psd;
+ if (pstat_getdynamic(&psd, sizeof(psd), 1, 0) != -1)
+ cores = (int)psd.psd_proc_cnt;
+
#endif
return cores;