diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-07-29 15:32:08 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-07-29 15:32:08 +0200 |
commit | a7737c19cff44e5d8cb0863e6ff514bbf0999ad5 (patch) | |
tree | 1b9801dad6fcea89c40c836bedfbaeb1048fb1d5 /gcc/ada/expect.c | |
parent | ab01e614837a76c828d7168bd34570beb69d7afc (diff) | |
download | gcc-a7737c19cff44e5d8cb0863e6ff514bbf0999ad5.zip gcc-a7737c19cff44e5d8cb0863e6ff514bbf0999ad5.tar.gz gcc-a7737c19cff44e5d8cb0863e6ff514bbf0999ad5.tar.bz2 |
[multiple changes]
2014-07-29 Jerome Lambourg <lambourg@adacore.com>
* expect.c (__gnat_expect_poll): New parameter dead_process
used to return the dead process among the array of file
descriptors. The Windows, VMS and HPUX implementations now
properly report the dead process via this parameter. Other unixes
don't need it.
* g-expect.adb (Poll): Adapt to the C profile.
(Expect_Internal): Use the new parameter to properly close the
File Descriptor. This then can be properly reported by the
function First_Dead_Process as is expected.
2014-07-29 Robert Dewar <dewar@adacore.com>
* gnat_ugn.texi: Minor clarification of -gnatQ switch.
From-SVN: r213177
Diffstat (limited to 'gcc/ada/expect.c')
-rw-r--r-- | gcc/ada/expect.c | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/gcc/ada/expect.c b/gcc/ada/expect.c index aa014a6..ce03224 100644 --- a/gcc/ada/expect.c +++ b/gcc/ada/expect.c @@ -148,7 +148,11 @@ __gnat_pipe (int *fd) } int -__gnat_expect_poll (int *fd, int num_fd, int timeout, int *is_set) +__gnat_expect_poll (int *fd, + int num_fd, + int timeout, + int *dead_process, + int *is_set) { #define MAX_DELAY 100 @@ -156,6 +160,8 @@ __gnat_expect_poll (int *fd, int num_fd, int timeout, int *is_set) DWORD avail; HANDLE handles[num_fd]; + *dead_process = 0; + for (i = 0; i < num_fd; i++) is_set[i] = 0; @@ -174,6 +180,7 @@ __gnat_expect_poll (int *fd, int num_fd, int timeout, int *is_set) for (i = 0; i < num_fd; i++) { if (!PeekNamedPipe (handles [i], NULL, 0, NULL, &avail, NULL)) + *dead_process = i + 1; return -1; if (avail > 0) @@ -245,7 +252,11 @@ __gnat_expect_portable_execvp (int *pid, char *cmd, char *argv[]) } int -__gnat_expect_poll (int *fd, int num_fd, int timeout, int *is_set) +__gnat_expect_poll (int *fd, + int num_fd, + int timeout, + int *dead_process, + int *is_set) { int i, num, ready = 0; unsigned int status; @@ -258,6 +269,8 @@ __gnat_expect_poll (int *fd, int num_fd, int timeout, int *is_set) } iosb; char buf [256]; + *dead_process = 0; + for (i = 0; i < num_fd; i++) is_set[i] = 0; @@ -280,6 +293,7 @@ __gnat_expect_poll (int *fd, int num_fd, int timeout, int *is_set) if ((status & 1) != 1) { ready = -1; + dead_process = i + 1; return ready; } } @@ -395,7 +409,11 @@ __gnat_expect_portable_execvp (int *pid, char *cmd, char *argv[]) } int -__gnat_expect_poll (int *fd, int num_fd, int timeout, int *is_set) +__gnat_expect_poll (int *fd, + int num_fd, + int timeout, + int *dead_process, + int *is_set) { struct timeval tv; SELECT_MASK rset; @@ -406,6 +424,8 @@ __gnat_expect_poll (int *fd, int num_fd, int timeout, int *is_set) int i; int received; + *dead_process = 0; + tv.tv_sec = timeout / 1000; tv.tv_usec = (timeout % 1000) * 1000; @@ -458,6 +478,7 @@ __gnat_expect_poll (int *fd, int num_fd, int timeout, int *is_set) if (ei.request == TIOCCLOSE) { ioctl (fd[i], TIOCREQSET, &ei); + dead_process = i + 1; return -1; } @@ -510,10 +531,12 @@ __gnat_expect_portable_execvp (int *pid ATTRIBUTE_UNUSED, int __gnat_expect_poll (int *fd ATTRIBUTE_UNUSED, - int num_fd ATTRIBUTE_UNUSED, - int timeout ATTRIBUTE_UNUSED, - int *is_set ATTRIBUTE_UNUSED) + int num_fd ATTRIBUTE_UNUSED, + int timeout ATTRIBUTE_UNUSED, + int *dead_process ATTRIBUTE_UNUSED, + int *is_set ATTRIBUTE_UNUSED) { + *dead_process = 0; return -1; } #endif |