summaryrefslogtreecommitdiff
path: root/gcc/ada/g-expect.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-15 13:57:56 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-15 13:57:56 +0000
commit5b91f0e70dfc5d0289f1ca6b140743763b5675a1 (patch)
treea05042bd8367388bbe2377d8298b4111af9eaae7 /gcc/ada/g-expect.adb
parent54d2a5c93f32e49178b8abc676dcde04b48ea400 (diff)
downloadgcc-5b91f0e70dfc5d0289f1ca6b140743763b5675a1.tar.gz
2005-11-14 Pascal Obry <obry@adacore.com>
* expect.c (__gnat_kill) [Win32]: Fix implementation, the pid returned by spawnve is a process handle, no need to convert. Add a parameter close to control wether the process handle must be closed. (__gnat_waitpid): Fix implementation, the pid returned by spawnve is a process handle, not need to convert. (__gnat_kill) [*]: Add dummy parameter close to match the Win32 spec. * g-expect.adb: (Kill): Document the new close parameter. (Close): Do not release the process handle in the kill there as waitpid() is using it. (Send_Signal): Release the process handle. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@106974 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/g-expect.adb')
-rw-r--r--gcc/ada/g-expect.adb14
1 files changed, 8 insertions, 6 deletions
diff --git a/gcc/ada/g-expect.adb b/gcc/ada/g-expect.adb
index e94d5b657a1..1cb07881f12 100644
--- a/gcc/ada/g-expect.adb
+++ b/gcc/ada/g-expect.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2000-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2000-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -89,8 +89,9 @@ package body GNAT.Expect is
procedure Dup2 (Old_Fd, New_Fd : File_Descriptor);
pragma Import (C, Dup2);
- procedure Kill (Pid : Process_Id; Sig_Num : Integer);
+ procedure Kill (Pid : Process_Id; Sig_Num : Integer; Close : Integer);
pragma Import (C, Kill, "__gnat_kill");
+ -- if Close is set to 1 all OS resources used by the Pid must be freed
function Create_Pipe (Pipe : access Pipe_Type) return Integer;
pragma Import (C, Create_Pipe, "__gnat_pipe");
@@ -221,7 +222,7 @@ package body GNAT.Expect is
-- ??? Should have timeouts for different signals
- Kill (Descriptor.Pid, 9);
+ Kill (Descriptor.Pid, 9, 0);
GNAT.OS_Lib.Free (Descriptor.Buffer);
Descriptor.Buffer_Size := 0;
@@ -339,10 +340,11 @@ package body GNAT.Expect is
return;
end if;
- -- Calculate the timeout for the next turn.
+ -- Calculate the timeout for the next turn
+
-- Note that Timeout is, from the caller's perspective, the maximum
-- time until a match, not the maximum time until some output is
- -- read, and thus can not be reused as is for Expect_Internal.
+ -- read, and thus cannot be reused as is for Expect_Internal.
if Timeout /= -1 then
Timeout_Tmp := Integer (Try_Until - Clock) * 1000;
@@ -1148,7 +1150,7 @@ package body GNAT.Expect is
Signal : Integer)
is
begin
- Kill (Descriptor.Pid, Signal);
+ Kill (Descriptor.Pid, Signal, 1);
-- ??? Need to check process status here
end Send_Signal;