diff options
Diffstat (limited to 'winsup/cygwin')
-rw-r--r-- | winsup/cygwin/ChangeLog | 8 | ||||
-rw-r--r-- | winsup/cygwin/fhandler.cc | 8 | ||||
-rw-r--r-- | winsup/cygwin/wincap.cc | 11 | ||||
-rw-r--r-- | winsup/cygwin/wincap.h | 2 |
4 files changed, 27 insertions, 2 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 0fc6b0b7d..342b152c1 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,11 @@ +Thu Sep 20 9:55:00 2001 Corinna Vinschen <corinna@vinschen.de> + + * fhandler.cc (fhandler_base::set_inheritance): If available, + use SetHandleInformation() to set inheritance. + * wincap.cc: Set flag has_set_handle_information_on_console_handles + appropriately. + * wincap.h: Add flag has_set_handle_information_on_console_handles. + Wed Sep 19 12:24:09 2001 Christopher Faylor <cgf@cygnus.com> * lib/getopt.c (__progname): Don't declare if not compiling for cygwin. diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index 270c0d319..0f38e0207 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -1522,8 +1522,12 @@ fhandler_base::set_inheritance (HANDLE &h, int not_inheriting, const char *namep { HANDLE newh; - if (!DuplicateHandle (hMainProc, h, hMainProc, &newh, 0, !not_inheriting, - DUPLICATE_SAME_ACCESS)) + if (wincap.has_set_handle_information () && (!is_console () || + wincap.has_set_handle_information_on_console_handles ())) + (void) SetHandleInformation (h, HANDLE_FLAG_INHERIT, + not_inheriting ? 0 : HANDLE_FLAG_INHERIT); + else if (!DuplicateHandle (hMainProc, h, hMainProc, &newh, 0, !not_inheriting, + DUPLICATE_SAME_ACCESS)) debug_printf ("DuplicateHandle %E"); #ifndef DEBUGGING else diff --git a/winsup/cygwin/wincap.cc b/winsup/cygwin/wincap.cc index 117ed6603..4026167ad 100644 --- a/winsup/cygwin/wincap.cc +++ b/winsup/cygwin/wincap.cc @@ -29,6 +29,7 @@ static NO_COPY wincaps wincap_unknown = { has_eventlog:false, has_ip_helper_lib:false, has_set_handle_information:false, + has_set_handle_information_on_console_handles:false, supports_smp:false, map_view_of_file_ex_sucks:false, altgr_is_ctrl_alt:false, @@ -62,6 +63,7 @@ static NO_COPY wincaps wincap_95 = { has_eventlog:false, has_ip_helper_lib:false, has_set_handle_information:false, + has_set_handle_information_on_console_handles:false, supports_smp:false, map_view_of_file_ex_sucks:true, altgr_is_ctrl_alt:false, @@ -95,6 +97,7 @@ static NO_COPY wincaps wincap_95osr2 = { has_eventlog:false, has_ip_helper_lib:false, has_set_handle_information:false, + has_set_handle_information_on_console_handles:false, supports_smp:false, map_view_of_file_ex_sucks:true, altgr_is_ctrl_alt:false, @@ -128,6 +131,7 @@ static NO_COPY wincaps wincap_98 = { has_eventlog:false, has_ip_helper_lib:true, has_set_handle_information:false, + has_set_handle_information_on_console_handles:false, supports_smp:false, map_view_of_file_ex_sucks:true, altgr_is_ctrl_alt:false, @@ -161,6 +165,7 @@ static NO_COPY wincaps wincap_98se = { has_eventlog:false, has_ip_helper_lib:true, has_set_handle_information:false, + has_set_handle_information_on_console_handles:false, supports_smp:false, map_view_of_file_ex_sucks:true, altgr_is_ctrl_alt:false, @@ -194,6 +199,7 @@ static NO_COPY wincaps wincap_me = { has_eventlog:false, has_ip_helper_lib:true, has_set_handle_information:false, + has_set_handle_information_on_console_handles:false, supports_smp:false, map_view_of_file_ex_sucks:true, altgr_is_ctrl_alt:false, @@ -227,6 +233,7 @@ static NO_COPY wincaps wincap_nt3 = { has_eventlog:true, has_ip_helper_lib:false, has_set_handle_information:true, + has_set_handle_information_on_console_handles:false, supports_smp:false, map_view_of_file_ex_sucks:false, altgr_is_ctrl_alt:true, @@ -260,6 +267,7 @@ static NO_COPY wincaps wincap_nt4 = { has_eventlog:true, has_ip_helper_lib:false, has_set_handle_information:true, + has_set_handle_information_on_console_handles:false, supports_smp:true, map_view_of_file_ex_sucks:false, altgr_is_ctrl_alt:true, @@ -293,6 +301,7 @@ static NO_COPY wincaps wincap_nt4sp4 = { has_eventlog:true, has_ip_helper_lib:true, has_set_handle_information:true, + has_set_handle_information_on_console_handles:false, supports_smp:true, map_view_of_file_ex_sucks:false, altgr_is_ctrl_alt:true, @@ -326,6 +335,7 @@ static NO_COPY wincaps wincap_2000 = { has_eventlog:true, has_ip_helper_lib:true, has_set_handle_information:true, + has_set_handle_information_on_console_handles:true, supports_smp:true, map_view_of_file_ex_sucks:false, altgr_is_ctrl_alt:true, @@ -359,6 +369,7 @@ static NO_COPY wincaps wincap_xp = { has_eventlog:true, has_ip_helper_lib:true, has_set_handle_information:true, + has_set_handle_information_on_console_handles:true, supports_smp:true, map_view_of_file_ex_sucks:false, altgr_is_ctrl_alt:true, diff --git a/winsup/cygwin/wincap.h b/winsup/cygwin/wincap.h index 903c719e8..038947636 100644 --- a/winsup/cygwin/wincap.h +++ b/winsup/cygwin/wincap.h @@ -30,6 +30,7 @@ struct wincaps unsigned has_eventlog : 1; unsigned has_ip_helper_lib : 1; unsigned has_set_handle_information : 1; + unsigned has_set_handle_information_on_console_handles: 1; unsigned supports_smp : 1; unsigned map_view_of_file_ex_sucks : 1; unsigned altgr_is_ctrl_alt : 1; @@ -77,6 +78,7 @@ public: bool IMPLEMENT (has_eventlog) bool IMPLEMENT (has_ip_helper_lib) bool IMPLEMENT (has_set_handle_information) + bool IMPLEMENT (has_set_handle_information_on_console_handles) bool IMPLEMENT (supports_smp) bool IMPLEMENT (map_view_of_file_ex_sucks) bool IMPLEMENT (altgr_is_ctrl_alt) |