aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/adaint.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/adaint.c')
-rw-r--r--gcc/ada/adaint.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 560f352..0a90c92 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -145,6 +145,13 @@
#include "version.h"
#endif
+/* limits.h is needed for LLONG_MIN. */
+#ifdef __cplusplus
+#include <climits>
+#else
+#include <limits.h>
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -237,6 +244,8 @@ UINT __gnat_current_ccs_encoding;
#include "adaint.h"
+int __gnat_in_child_after_fork = 0;
+
#if defined (__APPLE__) && defined (st_mtime)
#define st_atim st_atimespec
#define st_mtim st_mtimespec
@@ -2414,6 +2423,7 @@ __gnat_portable_spawn (char *args[] ATTRIBUTE_UNUSED)
if (pid == 0)
{
/* The child. */
+ __gnat_in_child_after_fork = 1;
if (execv (args[0], MAYBE_TO_PTR32 (args)) != 0)
_exit (1);
}
@@ -2476,9 +2486,7 @@ __gnat_number_of_cpus (void)
{
int cores = 1;
-#if defined (__linux__) || defined (__sun__) || defined (_AIX) \
- || defined (__APPLE__) || defined (__FreeBSD__) || defined (__OpenBSD__) \
- || defined (__DragonFly__) || defined (__NetBSD__)
+#ifdef _SC_NPROCESSORS_ONLN
cores = (int) sysconf (_SC_NPROCESSORS_ONLN);
#elif defined (__QNX__)
@@ -3262,7 +3270,22 @@ __gnat_copy_attribs (char *from ATTRIBUTE_UNUSED, char *to ATTRIBUTE_UNUSED,
return -1;
}
-#if _POSIX_C_SOURCE >= 200809L
+#if (defined (__vxworks) && _WRS_VXWORKS_MAJOR < 7)
+
+ /* VxWorks prior to 7 only has utime. */
+
+ /* Do we need to copy the timestamp ? */
+ if (mode != 2) {
+ struct utimbuf tbuf;
+
+ tbuf.actime = fbuf.st_atime;
+ tbuf.modtime = fbuf.st_mtime;
+
+ if (utime (to, &tbuf) == -1)
+ return -1;
+ }
+
+#elif _POSIX_C_SOURCE >= 200809L
struct timespec tbuf[2];
if (mode != 2) {