* 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.
This commit is contained in:
Corinna Vinschen 2001-09-20 08:02:01 +00:00
parent 7141383a86
commit f4e6b76a05
4 changed files with 27 additions and 2 deletions

View File

@ -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.

View File

@ -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

View File

@ -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,

View File

@ -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)