aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/adaint.c
diff options
context:
space:
mode:
authorAaron W. LaFramboise <aaronavay62@aaronwl.com>2008-08-16 23:44:15 -0600
committerAaron W. LaFramboise <aaronwl@gcc.gnu.org>2008-08-16 23:44:15 -0600
commitc8bbc9ef2a33fcf34118362e6361760f179d0908 (patch)
tree50a0b1a629618123a3ebf29230f5bc6399c779ce /gcc/ada/adaint.c
parent2f1dcfba75d9da8e84c669c401b4e09d7c89f859 (diff)
downloadgcc-c8bbc9ef2a33fcf34118362e6361760f179d0908.zip
gcc-c8bbc9ef2a33fcf34118362e6361760f179d0908.tar.gz
gcc-c8bbc9ef2a33fcf34118362e6361760f179d0908.tar.bz2
adaint.c (_gnat_set_close_on_exec): Implement.
2008-08-17 Aaron W. LaFramboise <aaronavay62@aaronwl.com> * adaint.c (_gnat_set_close_on_exec) [_WIN32]: Implement. From-SVN: r139167
Diffstat (limited to 'gcc/ada/adaint.c')
-rw-r--r--gcc/ada/adaint.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index b7fdd08..48abb3e 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -3248,12 +3248,17 @@ __gnat_set_close_on_exec (int fd ATTRIBUTE_UNUSED,
else
flags &= ~FD_CLOEXEC;
return fcntl (fd, F_SETFD, flags | FD_CLOEXEC);
+#elif defined(_WIN32)
+ HANDLE h = (HANDLE) _get_osfhandle (fd);
+ if (h == (HANDLE) -1)
+ return -1;
+ if (close_on_exec_p)
+ return ! SetHandleInformation (h, HANDLE_FLAG_INHERIT, 0);
+ return ! SetHandleInformation (h, HANDLE_FLAG_INHERIT,
+ HANDLE_FLAG_INHERIT);
#else
+ /* TODO: Unimplemented. */
return -1;
- /* For the Windows case, we should use SetHandleInformation to remove
- the HANDLE_INHERIT property from fd. This is not implemented yet,
- but for our purposes (support of GNAT.Expect) this does not matter,
- as by default handles are *not* inherited. */
#endif
}