aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/adaint.c
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2021-01-03 21:40:04 +0100
committerThomas Koenig <tkoenig@gcc.gnu.org>2021-01-03 21:40:04 +0100
commitafae4a55ccaa0de95ea11e5f634084db6ab2f444 (patch)
treed632cc867d10410ba9fb750523be790b86846ac4 /gcc/ada/adaint.c
parent9d9a82ec8478ff52c7a9d61f58cd2a7b6295b5f9 (diff)
parentd2eb616a0f7bea78164912aa438c29fe1ef5774a (diff)
downloadgcc-afae4a55ccaa0de95ea11e5f634084db6ab2f444.zip
gcc-afae4a55ccaa0de95ea11e5f634084db6ab2f444.tar.gz
gcc-afae4a55ccaa0de95ea11e5f634084db6ab2f444.tar.bz2
Merge branch 'master' into devel/coarray_native
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) {