aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/adaint.c
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2004-11-19 11:54:33 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2004-11-19 11:54:33 +0100
commitf5a0cbf1083ff9d9635c813929b89d9f831f4ec9 (patch)
tree3063d70e8397901bd7a7baad967d07c7ed60675e /gcc/ada/adaint.c
parentf99652b5e31bf860a7a007e71e67796f047a3512 (diff)
downloadgcc-f5a0cbf1083ff9d9635c813929b89d9f831f4ec9.zip
gcc-f5a0cbf1083ff9d9635c813929b89d9f831f4ec9.tar.gz
gcc-f5a0cbf1083ff9d9635c813929b89d9f831f4ec9.tar.bz2
* adaint.h, adaint.c
(__gnat_portable_spawn): Fix cast of spawnvp third parameter to avoid warnings. Add also a cast to kill another warning. (win32_no_block_spawn): Initialize CreateProcess's dwCreationFlags parameter with the priority class of the parent process instead of always using the NORMAL_PRIORITY_CLASS. (__gnat_dup): New function. (__gnat_dup2): New function. (__gnat_is_symbolic_link): Enable the effective body of this function when __APPLE__ is defined. * g-os_lib.ads, g-os_lib.adb (Spawn): Two new procedures. Update comments. From-SVN: r90899
Diffstat (limited to 'gcc/ada/adaint.c')
-rw-r--r--gcc/ada/adaint.c39
1 files changed, 34 insertions, 5 deletions
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index c1b85a0..8ed3b40 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -1512,7 +1512,7 @@ __gnat_is_symbolic_link (char *name ATTRIBUTE_UNUSED)
#if defined (__vxworks)
return 0;
-#elif defined (_AIX) || defined (__unix__)
+#elif defined (_AIX) || defined (__APPLE__) || defined (__unix__)
int ret;
struct stat statbuf;
@@ -1557,11 +1557,11 @@ __gnat_portable_spawn (char *args[])
strcat (args[0], args_0);
strcat (args[0], "\"");
- status = spawnvp (P_WAIT, args_0, (const char* const*)args);
+ status = spawnvp (P_WAIT, args_0, (char* const*)args);
/* restore previous value */
free (args[0]);
- args[0] = args_0;
+ args[0] = (char *)args_0;
if (status < 0)
return -1;
@@ -1606,6 +1606,34 @@ __gnat_portable_spawn (char *args[])
return 0;
}
+/* Create a copy of the given file descriptor.
+ Return -1 if an error occurred. */
+
+int
+__gnat_dup (int oldfd)
+{
+#if defined (__vxworks)
+ /* Not supported on VxWorks. */
+ return -1;
+#else
+ return dup (oldfd);
+#endif
+}
+
+/* Make newfd be the copy of oldfd, closing newfd first if necessary.
+ Return -1 if an error occured. */
+
+int
+__gnat_dup2 (int oldfd, int newfd)
+{
+#if defined (__vxworks)
+ /* Not supported on VxWorks. */
+ return -1;
+#else
+ return dup2 (oldfd, newfd);
+#endif
+}
+
/* WIN32 code to implement a wait call that wait for any child process. */
#ifdef _WIN32
@@ -1743,8 +1771,9 @@ win32_no_block_spawn (char *command, char *args[])
k++;
}
- result = CreateProcess (NULL, (char *) full_command, &SA, NULL, TRUE,
- NORMAL_PRIORITY_CLASS, NULL, NULL, &SI, &PI);
+ result = CreateProcess
+ (NULL, (char *) full_command, &SA, NULL, TRUE,
+ GetPriorityClass (GetCurrentProcess()), NULL, NULL, &SI, &PI);
free (full_command);