Commit c8bbc9ef by Aaron W. LaFramboise Committed by Aaron W. LaFramboise

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
parent 2f1dcfba
2008-08-17 Aaron W. LaFramboise <aaronavay62@aaronwl.com>
* adaint.c (_gnat_set_close_on_exec) [_WIN32]: Implement.
2008-08-16 Eric Botcazou <ebotcazou@adacore.com> 2008-08-16 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/trans.c (call_to_gnu): Use the Sloc of the call * gcc-interface/trans.c (call_to_gnu): Use the Sloc of the call
...@@ -3248,12 +3248,17 @@ __gnat_set_close_on_exec (int fd ATTRIBUTE_UNUSED, ...@@ -3248,12 +3248,17 @@ __gnat_set_close_on_exec (int fd ATTRIBUTE_UNUSED,
else else
flags &= ~FD_CLOEXEC; flags &= ~FD_CLOEXEC;
return fcntl (fd, F_SETFD, 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 #else
/* TODO: Unimplemented. */
return -1; 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 #endif
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment