summaryrefslogtreecommitdiff
path: root/gcc/ada/g-os_lib.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-02-10 13:51:58 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-02-10 13:51:58 +0000
commit6d9c34431eee95df76a218c14f690c5ed75b76db (patch)
treef7ea7fe8c9dc03d190dde2da59b05740c31b5ca4 /gcc/ada/g-os_lib.adb
parent8ee79a8446354ac1a9e20fd284e879a3d55860ba (diff)
downloadgcc-6d9c34431eee95df76a218c14f690c5ed75b76db.tar.gz
2005-02-09 Doug Rupp <rupp@adacore.com>
Thomas Quinot <quinot@adacore.com> * adaint.c, adaint.h [VMS] (to_ptr32): New function. (MAYBE_TO_PTR32): New macro. (__gnat_portable_spawn,__gnat_portable_no_block_spawn): Adjust argv for pointer size. [VMS] (descriptor_s, ile_s): Use __char_ptr32 for adr field. [VMS] (#define fork()): Remove since unneccessary. (__gnat_set_close_on_exec): New routine to support GNAT.OS_Lib.Set_Close_On_Exec. * g-expect.adb (Set_Up_Communications): Mark the pipe descriptors for the parent side as close-on-exec so that they are not inherited by the child. * g-os_lib.ads, g-os_lib.adb (Set_Close_On_Exec): New subprogram to set or clear the FD_CLOEXEC flag on a file descriptor. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@94811 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/g-os_lib.adb')
-rw-r--r--gcc/ada/g-os_lib.adb27
1 files changed, 22 insertions, 5 deletions
diff --git a/gcc/ada/g-os_lib.adb b/gcc/ada/g-os_lib.adb
index 64122462ec4..65213cd5247 100644
--- a/gcc/ada/g-os_lib.adb
+++ b/gcc/ada/g-os_lib.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1995-2004 Ada Core Technologies, Inc. --
+-- Copyright (C) 1995-2005 Ada Core Technologies, Inc. --
-- --
-- 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- --
@@ -1075,7 +1075,7 @@ package body GNAT.OS_Lib is
S : Integer;
begin
- -- Use the global lock because To_GM_Time is not thread safe.
+ -- Use the global lock because To_GM_Time is not thread safe
Locked_Processing : begin
SSL.Lock_Task.all;
@@ -1920,7 +1920,7 @@ package body GNAT.OS_Lib is
if Status <= 0 then
Last := Finish + 1;
- -- Replace symbolic link with its value.
+ -- Replace symbolic link with its value
else
if Is_Absolute_Path (Link_Buffer (1 .. Status)) then
@@ -2056,6 +2056,23 @@ package body GNAT.OS_Lib is
Rename_File (C_Old_Name'Address, C_New_Name'Address, Success);
end Rename_File;
+ -----------------------
+ -- Set_Close_On_Exec --
+ -----------------------
+
+ procedure Set_Close_On_Exec
+ (FD : File_Descriptor;
+ Close_On_Exec : Boolean;
+ Status : out Boolean)
+ is
+ function C_Set_Close_On_Exec
+ (FD : File_Descriptor; Close_On_Exec : System.CRTL.int)
+ return System.CRTL.int;
+ pragma Import (C, C_Set_Close_On_Exec, "__gnat_set_close_on_exec");
+ begin
+ Status := C_Set_Close_On_Exec (FD, Boolean'Pos (Close_On_Exec)) = 0;
+ end Set_Close_On_Exec;
+
--------------------
-- Set_Executable --
--------------------
@@ -2186,7 +2203,7 @@ package body GNAT.OS_Lib is
Dup2 (Saved_Error, Standerr);
end if;
- -- And close the saved standard output and error file descriptors.
+ -- And close the saved standard output and error file descriptors
Close (Saved_Output);
@@ -2234,7 +2251,7 @@ package body GNAT.OS_Lib is
is
procedure Spawn (Args : Argument_List);
- -- Call Spawn.
+ -- Call Spawn with given argument list
N_Args : Argument_List (Args'Range);
-- Normalized arguments