* cygerrno.h: Make multi-inclusion safe.
* fhandler_termios.cc (fhandler_termios::tcsetpgrp): Deal with EINTR. * dcrt0.cc (dll_crt0_0): Accommodate init_console_handler argument change. * winsup.h: Ditto. * fhandler_tty.cc (fhandler_tty_slave::open): Ditto. * exceptions.cc (init_console_handler): Ditto. Ignore console events if we're not attached to a terminal. * fhandler_tty.cc (fhandler_tty_slave::open): Ditto. * wincap.cc: Implement has_null_console_handler_routine throughout. * wincap.h: Ditto.
This commit is contained in:
parent
d573a471af
commit
5b3e1f7358
@ -1,3 +1,17 @@
|
|||||||
|
2005-06-29 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
|
* cygerrno.h: Make multi-inclusion safe.
|
||||||
|
* fhandler_termios.cc (fhandler_termios::tcsetpgrp): Deal with EINTR.
|
||||||
|
* dcrt0.cc (dll_crt0_0): Accommodate init_console_handler argument
|
||||||
|
change.
|
||||||
|
* winsup.h: Ditto.
|
||||||
|
* fhandler_tty.cc (fhandler_tty_slave::open): Ditto.
|
||||||
|
* exceptions.cc (init_console_handler): Ditto. Ignore console events
|
||||||
|
if we're not attached to a terminal.
|
||||||
|
* fhandler_tty.cc (fhandler_tty_slave::open): Ditto.
|
||||||
|
* wincap.cc: Implement has_null_console_handler_routine throughout.
|
||||||
|
* wincap.h: Ditto.
|
||||||
|
|
||||||
2005-06-29 Christopher Faylor <cgf@timesys.com>
|
2005-06-29 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
* autoload.cc (LoadDLLprime): Use a more descriptive name for autoload
|
* autoload.cc (LoadDLLprime): Use a more descriptive name for autoload
|
||||||
|
@ -8,6 +8,8 @@ This software is a copyrighted work licensed under the terms of the
|
|||||||
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
||||||
details. */
|
details. */
|
||||||
|
|
||||||
|
#ifndef _CYGERRNO_H
|
||||||
|
#define _CYGERRNO_H
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
void __stdcall seterrno_from_win_error (const char *file, int line, DWORD code) __attribute__ ((regparm(3)));
|
void __stdcall seterrno_from_win_error (const char *file, int line, DWORD code) __attribute__ ((regparm(3)));
|
||||||
@ -47,3 +49,4 @@ class save_errno
|
|||||||
|
|
||||||
extern const char *__sp_fn;
|
extern const char *__sp_fn;
|
||||||
extern int __sp_ln;
|
extern int __sp_ln;
|
||||||
|
#endif /*_CYGERRNO_H*/
|
||||||
|
@ -636,7 +636,7 @@ dll_crt0_0 ()
|
|||||||
wincap.init ();
|
wincap.init ();
|
||||||
initial_env ();
|
initial_env ();
|
||||||
|
|
||||||
init_console_handler ();
|
init_console_handler (TRUE);
|
||||||
init_global_security ();
|
init_global_security ();
|
||||||
if (!DuplicateHandle (GetCurrentProcess (), GetCurrentProcess (),
|
if (!DuplicateHandle (GetCurrentProcess (), GetCurrentProcess (),
|
||||||
GetCurrentProcess (), &hMainProc, 0, FALSE,
|
GetCurrentProcess (), &hMainProc, 0, FALSE,
|
||||||
|
@ -114,11 +114,24 @@ init_exceptions (exception_list *el)
|
|||||||
init_exception_handler (el, handle_exceptions);
|
init_exception_handler (el, handle_exceptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
BOOL WINAPI
|
||||||
init_console_handler ()
|
dummy_ctrl_c_handler (DWORD dwCtrlType)
|
||||||
{
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
init_console_handler (BOOL install_handler)
|
||||||
|
{
|
||||||
|
BOOL res;
|
||||||
(void) SetConsoleCtrlHandler (ctrl_c_handler, FALSE);
|
(void) SetConsoleCtrlHandler (ctrl_c_handler, FALSE);
|
||||||
if (!SetConsoleCtrlHandler (ctrl_c_handler, TRUE))
|
if (install_handler)
|
||||||
|
res = SetConsoleCtrlHandler (ctrl_c_handler, TRUE);
|
||||||
|
else if (wincap.has_null_console_handler_routine ())
|
||||||
|
res = SetConsoleCtrlHandler (NULL, TRUE);
|
||||||
|
else
|
||||||
|
res = SetConsoleCtrlHandler (dummy_ctrl_c_handler, TRUE);
|
||||||
|
if (!res)
|
||||||
system_printf ("SetConsoleCtrlHandler failed, %E");
|
system_printf ("SetConsoleCtrlHandler failed, %E");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ details. */
|
|||||||
#include "pinfo.h"
|
#include "pinfo.h"
|
||||||
#include "tty.h"
|
#include "tty.h"
|
||||||
#include "sys/cygwin.h"
|
#include "sys/cygwin.h"
|
||||||
|
#include "cygtls.h"
|
||||||
|
|
||||||
/* Common functions shared by tty/console */
|
/* Common functions shared by tty/console */
|
||||||
|
|
||||||
@ -72,8 +73,30 @@ fhandler_termios::tcsetpgrp (const pid_t pgid)
|
|||||||
set_errno (EPERM);
|
set_errno (EPERM);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tc->setpgid (pgid);
|
int res;
|
||||||
return 0;
|
while (1)
|
||||||
|
{
|
||||||
|
res = bg_check (-SIGTTOU);
|
||||||
|
|
||||||
|
switch (res)
|
||||||
|
{
|
||||||
|
case bg_ok:
|
||||||
|
tc->setpgid (pgid);
|
||||||
|
init_console_handler (!!is_console ());
|
||||||
|
res = 0;
|
||||||
|
break;
|
||||||
|
case bg_signalled:
|
||||||
|
if (_my_tls.call_signal_handler ())
|
||||||
|
continue;
|
||||||
|
set_errno (EINTR);
|
||||||
|
/* fall through intentionally */
|
||||||
|
default:
|
||||||
|
res = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -591,7 +591,7 @@ fhandler_tty_slave::open (int flags, mode_t)
|
|||||||
// stuff fails
|
// stuff fails
|
||||||
termios_printf ("%d = AllocConsole (), %E", b);
|
termios_printf ("%d = AllocConsole (), %E", b);
|
||||||
if (b)
|
if (b)
|
||||||
init_console_handler ();
|
init_console_handler (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Do this better someday
|
// FIXME: Do this better someday
|
||||||
|
@ -58,7 +58,8 @@ static NO_COPY wincaps wincap_unknown = {
|
|||||||
start_proc_suspended:true,
|
start_proc_suspended:true,
|
||||||
has_extended_priority_class:false,
|
has_extended_priority_class:false,
|
||||||
has_guid_volumes:false,
|
has_guid_volumes:false,
|
||||||
detect_win16_exe:true
|
detect_win16_exe:true,
|
||||||
|
has_null_console_handler_routine:false
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_95 = {
|
static NO_COPY wincaps wincap_95 = {
|
||||||
@ -108,7 +109,8 @@ static NO_COPY wincaps wincap_95 = {
|
|||||||
start_proc_suspended:true,
|
start_proc_suspended:true,
|
||||||
has_extended_priority_class:false,
|
has_extended_priority_class:false,
|
||||||
has_guid_volumes:false,
|
has_guid_volumes:false,
|
||||||
detect_win16_exe:true
|
detect_win16_exe:true,
|
||||||
|
has_null_console_handler_routine:false
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_95osr2 = {
|
static NO_COPY wincaps wincap_95osr2 = {
|
||||||
@ -158,7 +160,8 @@ static NO_COPY wincaps wincap_95osr2 = {
|
|||||||
start_proc_suspended:true,
|
start_proc_suspended:true,
|
||||||
has_extended_priority_class:false,
|
has_extended_priority_class:false,
|
||||||
has_guid_volumes:false,
|
has_guid_volumes:false,
|
||||||
detect_win16_exe:true
|
detect_win16_exe:true,
|
||||||
|
has_null_console_handler_routine:false
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_98 = {
|
static NO_COPY wincaps wincap_98 = {
|
||||||
@ -208,7 +211,8 @@ static NO_COPY wincaps wincap_98 = {
|
|||||||
start_proc_suspended:true,
|
start_proc_suspended:true,
|
||||||
has_extended_priority_class:false,
|
has_extended_priority_class:false,
|
||||||
has_guid_volumes:false,
|
has_guid_volumes:false,
|
||||||
detect_win16_exe:true
|
detect_win16_exe:true,
|
||||||
|
has_null_console_handler_routine:false
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_98se = {
|
static NO_COPY wincaps wincap_98se = {
|
||||||
@ -258,7 +262,8 @@ static NO_COPY wincaps wincap_98se = {
|
|||||||
start_proc_suspended:true,
|
start_proc_suspended:true,
|
||||||
has_extended_priority_class:false,
|
has_extended_priority_class:false,
|
||||||
has_guid_volumes:false,
|
has_guid_volumes:false,
|
||||||
detect_win16_exe:true
|
detect_win16_exe:true,
|
||||||
|
has_null_console_handler_routine:false
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_me = {
|
static NO_COPY wincaps wincap_me = {
|
||||||
@ -308,7 +313,8 @@ static NO_COPY wincaps wincap_me = {
|
|||||||
start_proc_suspended:true,
|
start_proc_suspended:true,
|
||||||
has_extended_priority_class:false,
|
has_extended_priority_class:false,
|
||||||
has_guid_volumes:false,
|
has_guid_volumes:false,
|
||||||
detect_win16_exe:true
|
detect_win16_exe:true,
|
||||||
|
has_null_console_handler_routine:false
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_nt3 = {
|
static NO_COPY wincaps wincap_nt3 = {
|
||||||
@ -358,7 +364,8 @@ static NO_COPY wincaps wincap_nt3 = {
|
|||||||
start_proc_suspended:false,
|
start_proc_suspended:false,
|
||||||
has_extended_priority_class:false,
|
has_extended_priority_class:false,
|
||||||
has_guid_volumes:false,
|
has_guid_volumes:false,
|
||||||
detect_win16_exe:false
|
detect_win16_exe:false,
|
||||||
|
has_null_console_handler_routine:true
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_nt4 = {
|
static NO_COPY wincaps wincap_nt4 = {
|
||||||
@ -408,7 +415,8 @@ static NO_COPY wincaps wincap_nt4 = {
|
|||||||
start_proc_suspended:false,
|
start_proc_suspended:false,
|
||||||
has_extended_priority_class:false,
|
has_extended_priority_class:false,
|
||||||
has_guid_volumes:false,
|
has_guid_volumes:false,
|
||||||
detect_win16_exe:false
|
detect_win16_exe:false,
|
||||||
|
has_null_console_handler_routine:true
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_nt4sp4 = {
|
static NO_COPY wincaps wincap_nt4sp4 = {
|
||||||
@ -458,7 +466,8 @@ static NO_COPY wincaps wincap_nt4sp4 = {
|
|||||||
start_proc_suspended:false,
|
start_proc_suspended:false,
|
||||||
has_extended_priority_class:false,
|
has_extended_priority_class:false,
|
||||||
has_guid_volumes:false,
|
has_guid_volumes:false,
|
||||||
detect_win16_exe:false
|
detect_win16_exe:false,
|
||||||
|
has_null_console_handler_routine:true
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_2000 = {
|
static NO_COPY wincaps wincap_2000 = {
|
||||||
@ -508,7 +517,8 @@ static NO_COPY wincaps wincap_2000 = {
|
|||||||
start_proc_suspended:false,
|
start_proc_suspended:false,
|
||||||
has_extended_priority_class:true,
|
has_extended_priority_class:true,
|
||||||
has_guid_volumes:true,
|
has_guid_volumes:true,
|
||||||
detect_win16_exe:false
|
detect_win16_exe:false,
|
||||||
|
has_null_console_handler_routine:true
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_xp = {
|
static NO_COPY wincaps wincap_xp = {
|
||||||
@ -558,7 +568,8 @@ static NO_COPY wincaps wincap_xp = {
|
|||||||
start_proc_suspended:false,
|
start_proc_suspended:false,
|
||||||
has_extended_priority_class:true,
|
has_extended_priority_class:true,
|
||||||
has_guid_volumes:true,
|
has_guid_volumes:true,
|
||||||
detect_win16_exe:false
|
detect_win16_exe:false,
|
||||||
|
has_null_console_handler_routine:true
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_2003 = {
|
static NO_COPY wincaps wincap_2003 = {
|
||||||
@ -608,7 +619,8 @@ static NO_COPY wincaps wincap_2003 = {
|
|||||||
start_proc_suspended:false,
|
start_proc_suspended:false,
|
||||||
has_extended_priority_class:true,
|
has_extended_priority_class:true,
|
||||||
has_guid_volumes:true,
|
has_guid_volumes:true,
|
||||||
detect_win16_exe:false
|
detect_win16_exe:false,
|
||||||
|
has_null_console_handler_routine:true
|
||||||
};
|
};
|
||||||
|
|
||||||
wincapc wincap;
|
wincapc wincap;
|
||||||
|
@ -60,6 +60,7 @@ struct wincaps
|
|||||||
unsigned has_extended_priority_class : 1;
|
unsigned has_extended_priority_class : 1;
|
||||||
unsigned has_guid_volumes : 1;
|
unsigned has_guid_volumes : 1;
|
||||||
unsigned detect_win16_exe : 1;
|
unsigned detect_win16_exe : 1;
|
||||||
|
unsigned has_null_console_handler_routine : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
class wincapc
|
class wincapc
|
||||||
@ -124,6 +125,7 @@ public:
|
|||||||
bool IMPLEMENT (has_extended_priority_class)
|
bool IMPLEMENT (has_extended_priority_class)
|
||||||
bool IMPLEMENT (has_guid_volumes)
|
bool IMPLEMENT (has_guid_volumes)
|
||||||
bool IMPLEMENT (detect_win16_exe)
|
bool IMPLEMENT (detect_win16_exe)
|
||||||
|
bool IMPLEMENT (has_null_console_handler_routine)
|
||||||
|
|
||||||
#undef IMPLEMENT
|
#undef IMPLEMENT
|
||||||
};
|
};
|
||||||
|
@ -263,7 +263,7 @@ void __stdcall time_as_timestruc_t (timestruc_t *);
|
|||||||
void __stdcall timeval_to_filetime (const struct timeval *, FILETIME *);
|
void __stdcall timeval_to_filetime (const struct timeval *, FILETIME *);
|
||||||
|
|
||||||
void __stdcall set_console_title (char *);
|
void __stdcall set_console_title (char *);
|
||||||
void init_console_handler ();
|
void init_console_handler (BOOL);
|
||||||
void init_global_security ();
|
void init_global_security ();
|
||||||
|
|
||||||
int __stdcall check_null_str (const char *name) __attribute__ ((regparm(1)));
|
int __stdcall check_null_str (const char *name) __attribute__ ((regparm(1)));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user