From: aaronwl Date: Sun, 17 Aug 2008 05:44:15 +0000 (+0000) Subject: 2008-08-17 Aaron W. LaFramboise X-Git-Url: http://git.sourceforge.jp/view?a=commitdiff_plain;h=07f3488782c96746ec876636f81996ace6c1691f;hp=710f8f32df09c1f0bdda41ee880a68d1aba13f83;p=pf3gnuchains%2Fgcc-fork.git 2008-08-17 Aaron W. LaFramboise * adaint.c (_gnat_set_close_on_exec) [_WIN32]: Implement. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@139167 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index a5169b7a359..8aa238fc285 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,7 @@ +2008-08-17 Aaron W. LaFramboise + + * adaint.c (_gnat_set_close_on_exec) [_WIN32]: Implement. + 2008-08-16 Eric Botcazou * gcc-interface/trans.c (call_to_gnu): Use the Sloc of the call diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c index b7fdd08d252..48abb3e5049 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 }