Change use of BOOL, TRUE, FALSE to bool, true, false, as appropriate,
throughout. * tty.cc (tty::common_init): Remove call to SetKernelObjectSecurity and edit some comments. * cygheap.h (init_cygheap::ctty): Add new element. * devices.in (device::parse): Remove special handling for /dev/tty. * devices.cc: Regenerate. * dtable.cc (build_fh_pc): Don't reset /dev/tty device. Let the device opener do that. * fhandler_termios.cc (tty_min::set_ctty): Redefine to _pinfo class. * fhandler_tty.cc (fhandler_tty_common::set_close_on_exec): Avoid setting noninherit flag for ctty. * tty.h: Move BOOLs to bools. (tty_min::set_ctty): Redeclare to _pinfo class. * pinfo.cc (_pinfo::set_ctty): Define new function based on tty_min::set_ctty. Change first argument from tty number to tty_min class. * pinfo.h (_pinfo::set_ctty): Declare. * fhandler_console.cc (fhandler_console::get_tty_stuff): Reflect move of set_ctty to _pinfo class. * fhandler_tty.cc (fhandler_tty_slave::open): Treat FH_TTY specially. Use saved cygheap value if it exists. Otherwise convert to real device and save on first time open. (fhandler_tty_common::dup): Potentially set controlling tty if duping a slave tty. * syscalls.cc (setsid): Close controlling tty in cygheap. * tty.cc: Change some BOOLs to bools.
This commit is contained in:
@ -294,19 +294,19 @@ tty_list::allocate_tty (int with_console)
|
||||
return freetty;
|
||||
}
|
||||
|
||||
BOOL
|
||||
bool
|
||||
tty::slave_alive ()
|
||||
{
|
||||
return alive (TTY_SLAVE_ALIVE);
|
||||
}
|
||||
|
||||
BOOL
|
||||
bool
|
||||
tty::master_alive ()
|
||||
{
|
||||
return alive (TTY_MASTER_ALIVE);
|
||||
}
|
||||
|
||||
BOOL
|
||||
bool
|
||||
tty::alive (const char *fmt)
|
||||
{
|
||||
HANDLE ev;
|
||||
@ -362,25 +362,25 @@ tty::get_event (const char *fmt, BOOL manual_reset)
|
||||
return hev;
|
||||
}
|
||||
|
||||
int
|
||||
bool
|
||||
tty::make_pipes (fhandler_pty_master *ptym)
|
||||
{
|
||||
/* Create communication pipes */
|
||||
|
||||
/* FIXME: should this be sec_none_nih? */
|
||||
if (CreatePipe (&from_master, &to_slave, &sec_all, 128 * 1024) == FALSE)
|
||||
if (!CreatePipe (&from_master, &to_slave, &sec_all, 128 * 1024))
|
||||
{
|
||||
termios_printf ("can't create input pipe");
|
||||
set_errno (ENOENT);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ProtectHandle1INH (to_slave, to_pty);
|
||||
if (CreatePipe (&from_slave, &to_master, &sec_all, 128 * 1024) == FALSE)
|
||||
if (!CreatePipe (&from_slave, &to_master, &sec_all, 128 * 1024))
|
||||
{
|
||||
termios_printf ("can't create output pipe");
|
||||
set_errno (ENOENT);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
// ProtectHandle1INH (from_slave, from_pty);
|
||||
termios_printf ("tty%d from_slave %p, to_slave %p", ntty, from_slave,
|
||||
@ -391,44 +391,34 @@ tty::make_pipes (fhandler_pty_master *ptym)
|
||||
termios_printf ("can't set to_slave to non-blocking mode");
|
||||
ptym->set_io_handle (from_slave);
|
||||
ptym->set_output_handle (to_slave);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL
|
||||
bool
|
||||
tty::common_init (fhandler_pty_master *ptym)
|
||||
{
|
||||
/* Set termios information. Force initialization. */
|
||||
ptym->tcinit (this, TRUE);
|
||||
ptym->tcinit (this, true);
|
||||
|
||||
if (!make_pipes (ptym))
|
||||
return FALSE;
|
||||
return false;
|
||||
ptym->need_nl = 0;
|
||||
|
||||
/* Save our pid */
|
||||
|
||||
master_pid = GetCurrentProcessId ();
|
||||
|
||||
/* Allow the others to open us (for handle duplication) */
|
||||
/* We do not open allow the others to open us (for handle duplication)
|
||||
but rely on cygheap->inherited_ctty for descendant processes.
|
||||
In the future the cygserver may allow access by others. */
|
||||
|
||||
/* FIXME: we shold NOT set the security wide open when the
|
||||
daemon is running
|
||||
*/
|
||||
#ifdef USE_SERVER
|
||||
if (wincap.has_security ())
|
||||
{
|
||||
#ifdef USE_SERVER
|
||||
if (cygserver_running == CYGSERVER_UNKNOWN)
|
||||
cygserver_init ();
|
||||
#endif
|
||||
|
||||
if (
|
||||
#ifdef USE_SERVER
|
||||
cygserver_running != CYGSERVER_OK &&
|
||||
#endif
|
||||
!SetKernelObjectSecurity (hMainProc,
|
||||
DACL_SECURITY_INFORMATION,
|
||||
get_null_sd ()))
|
||||
system_printf ("Can't set process security, %E");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Create synchronisation events */
|
||||
|
||||
@ -440,15 +430,15 @@ tty::common_init (fhandler_pty_master *ptym)
|
||||
else
|
||||
{
|
||||
if (!(ptym->output_done_event = get_event (OUTPUT_DONE_EVENT)))
|
||||
return FALSE;
|
||||
return false;
|
||||
if (!(ptym->ioctl_done_event = get_event (IOCTL_DONE_EVENT)))
|
||||
return FALSE;
|
||||
return false;
|
||||
if (!(ptym->ioctl_request_event = get_event (IOCTL_REQUEST_EVENT)))
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(ptym->input_available_event = get_event (INPUT_AVAILABLE_EVENT, TRUE)))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
char buf[40];
|
||||
__small_sprintf (buf, OUTPUT_MUTEX, ntty);
|
||||
@ -456,7 +446,7 @@ tty::common_init (fhandler_pty_master *ptym)
|
||||
{
|
||||
termios_printf ("can't create %s", buf);
|
||||
set_errno (ENOENT);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
__small_sprintf (buf, INPUT_MUTEX, ntty);
|
||||
@ -464,7 +454,7 @@ tty::common_init (fhandler_pty_master *ptym)
|
||||
{
|
||||
termios_printf ("can't create %s", buf);
|
||||
set_errno (ENOENT);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
ProtectHandle1INH (ptym->output_mutex, output_mutex);
|
||||
@ -473,5 +463,5 @@ tty::common_init (fhandler_pty_master *ptym)
|
||||
winsize.ws_row = 25;
|
||||
|
||||
termios_printf ("tty%d opened", ntty);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user