Cygwin: pty: Convert CamelCase names to snake_case names.
This commit is contained in:
parent
7bdcc6ab68
commit
8041a0cadd
|
@ -155,10 +155,10 @@ dtable::stdio_init ()
|
||||||
if (fh && fh->get_major () == DEV_PTYS_MAJOR)
|
if (fh && fh->get_major () == DEV_PTYS_MAJOR)
|
||||||
{
|
{
|
||||||
fhandler_pty_slave *ptys = (fhandler_pty_slave *) fh;
|
fhandler_pty_slave *ptys = (fhandler_pty_slave *) fh;
|
||||||
if (ptys->getPseudoConsole ())
|
if (ptys->get_pseudo_console ())
|
||||||
{
|
{
|
||||||
bool attached = !!fhandler_console::get_console_process_id
|
bool attached = !!fhandler_console::get_console_process_id
|
||||||
(ptys->getHelperProcessId (), true);
|
(ptys->get_helper_process_id (), true);
|
||||||
if (attached)
|
if (attached)
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
|
@ -167,7 +167,7 @@ dtable::stdio_init ()
|
||||||
by some reason. This happens if the executable is
|
by some reason. This happens if the executable is
|
||||||
a windows GUI binary, such as mintty. */
|
a windows GUI binary, such as mintty. */
|
||||||
FreeConsole ();
|
FreeConsole ();
|
||||||
if (AttachConsole (ptys->getHelperProcessId ()))
|
if (AttachConsole (ptys->get_helper_process_id ()))
|
||||||
{
|
{
|
||||||
ptys->fixup_after_attach (false, fd);
|
ptys->fixup_after_attach (false, fd);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -2107,13 +2107,13 @@ class fhandler_pty_common: public fhandler_termios
|
||||||
{
|
{
|
||||||
return get_ttyp ()->attach_pcon_in_fork;
|
return get_ttyp ()->attach_pcon_in_fork;
|
||||||
}
|
}
|
||||||
DWORD getHelperProcessId (void)
|
DWORD get_helper_process_id (void)
|
||||||
{
|
{
|
||||||
return get_ttyp ()->HelperProcessId;
|
return get_ttyp ()->helper_process_id;
|
||||||
}
|
}
|
||||||
HPCON getPseudoConsole (void)
|
HPCON get_pseudo_console (void)
|
||||||
{
|
{
|
||||||
return get_ttyp ()->hPseudoConsole;
|
return get_ttyp ()->h_pseudo_console;
|
||||||
}
|
}
|
||||||
bool to_be_read_from_pcon (void);
|
bool to_be_read_from_pcon (void);
|
||||||
|
|
||||||
|
|
|
@ -1099,7 +1099,7 @@ fhandler_console::close ()
|
||||||
{
|
{
|
||||||
fhandler_pty_common *t =
|
fhandler_pty_common *t =
|
||||||
(fhandler_pty_common *) (fhandler_base *) cfd;
|
(fhandler_pty_common *) (fhandler_base *) cfd;
|
||||||
if (get_console_process_id (t->getHelperProcessId (), true))
|
if (get_console_process_id (t->get_helper_process_id (), true))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ set_switch_to_pcon (void)
|
||||||
{
|
{
|
||||||
fhandler_base *fh = cfd;
|
fhandler_base *fh = cfd;
|
||||||
fhandler_pty_slave *ptys = (fhandler_pty_slave *) fh;
|
fhandler_pty_slave *ptys = (fhandler_pty_slave *) fh;
|
||||||
if (ptys->getPseudoConsole ())
|
if (ptys->get_pseudo_console ())
|
||||||
ptys->set_switch_to_pcon (fd);
|
ptys->set_switch_to_pcon (fd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,19 +107,19 @@ force_attach_to_pcon (HANDLE h)
|
||||||
{
|
{
|
||||||
fhandler_base *fh = cfd;
|
fhandler_base *fh = cfd;
|
||||||
fhandler_pty_slave *ptys = (fhandler_pty_slave *) fh;
|
fhandler_pty_slave *ptys = (fhandler_pty_slave *) fh;
|
||||||
if (!ptys->getPseudoConsole ())
|
if (!ptys->get_pseudo_console ())
|
||||||
continue;
|
continue;
|
||||||
if (n != 0
|
if (n != 0
|
||||||
|| h == ptys->get_handle ()
|
|| h == ptys->get_handle ()
|
||||||
|| h == ptys->get_output_handle ())
|
|| h == ptys->get_output_handle ())
|
||||||
{
|
{
|
||||||
if (fhandler_console::get_console_process_id
|
if (fhandler_console::get_console_process_id
|
||||||
(ptys->getHelperProcessId (), true))
|
(ptys->get_helper_process_id (), true))
|
||||||
attach_done = true;
|
attach_done = true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FreeConsole ();
|
FreeConsole ();
|
||||||
if (AttachConsole (ptys->getHelperProcessId ()))
|
if (AttachConsole (ptys->get_helper_process_id ()))
|
||||||
{
|
{
|
||||||
pcon_attached_to = ptys->get_minor ();
|
pcon_attached_to = ptys->get_minor ();
|
||||||
attach_done = true;
|
attach_done = true;
|
||||||
|
@ -711,7 +711,7 @@ fhandler_pty_slave::~fhandler_pty_slave ()
|
||||||
if (!get_ttyp ())
|
if (!get_ttyp ())
|
||||||
/* Why comes here? Who clears _tc? */
|
/* Why comes here? Who clears _tc? */
|
||||||
return;
|
return;
|
||||||
if (getPseudoConsole ())
|
if (get_pseudo_console ())
|
||||||
{
|
{
|
||||||
int used = 0;
|
int used = 0;
|
||||||
int attached = 0;
|
int attached = 0;
|
||||||
|
@ -919,7 +919,7 @@ fhandler_pty_slave::open (int flags, mode_t)
|
||||||
set_output_handle (to_master_local);
|
set_output_handle (to_master_local);
|
||||||
set_output_handle_cyg (to_master_cyg_local);
|
set_output_handle_cyg (to_master_cyg_local);
|
||||||
|
|
||||||
if (!getPseudoConsole ())
|
if (!get_pseudo_console ())
|
||||||
{
|
{
|
||||||
fhandler_console::need_invisible ();
|
fhandler_console::need_invisible ();
|
||||||
pcon_attached_to = -1;
|
pcon_attached_to = -1;
|
||||||
|
@ -931,7 +931,7 @@ fhandler_pty_slave::open (int flags, mode_t)
|
||||||
pcon_attached_to = -1;
|
pcon_attached_to = -1;
|
||||||
}
|
}
|
||||||
else if (fhandler_console::get_console_process_id
|
else if (fhandler_console::get_console_process_id
|
||||||
(getHelperProcessId (), true))
|
(get_helper_process_id (), true))
|
||||||
/* Attached to pcon of this pty */
|
/* Attached to pcon of this pty */
|
||||||
{
|
{
|
||||||
pcon_attached_to = get_minor ();
|
pcon_attached_to = get_minor ();
|
||||||
|
@ -990,7 +990,7 @@ fhandler_pty_slave::close ()
|
||||||
if (!ForceCloseHandle (get_handle_cyg ()))
|
if (!ForceCloseHandle (get_handle_cyg ()))
|
||||||
termios_printf ("CloseHandle (get_handle_cyg ()<%p>), %E",
|
termios_printf ("CloseHandle (get_handle_cyg ()<%p>), %E",
|
||||||
get_handle_cyg ());
|
get_handle_cyg ());
|
||||||
if (!getPseudoConsole () &&
|
if (!get_pseudo_console () &&
|
||||||
(unsigned) myself->ctty == FHDEV (DEV_PTYS_MAJOR, get_minor ()))
|
(unsigned) myself->ctty == FHDEV (DEV_PTYS_MAJOR, get_minor ()))
|
||||||
fhandler_console::free_console (); /* assumes that we are the last pty closer */
|
fhandler_console::free_console (); /* assumes that we are the last pty closer */
|
||||||
fhandler_pty_common::close ();
|
fhandler_pty_common::close ();
|
||||||
|
@ -1063,10 +1063,10 @@ fhandler_pty_slave::try_reattach_pcon (void)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
FreeConsole ();
|
FreeConsole ();
|
||||||
if (!AttachConsole (getHelperProcessId ()))
|
if (!AttachConsole (get_helper_process_id ()))
|
||||||
{
|
{
|
||||||
system_printf ("pty%d: AttachConsole(helper=%d) failed. 0x%08lx",
|
system_printf ("pty%d: AttachConsole(helper=%d) failed. 0x%08lx",
|
||||||
get_minor (), getHelperProcessId (), GetLastError ());
|
get_minor (), get_helper_process_id (), GetLastError ());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -1170,14 +1170,14 @@ void
|
||||||
fhandler_pty_slave::push_to_pcon_screenbuffer (const char *ptr, size_t len)
|
fhandler_pty_slave::push_to_pcon_screenbuffer (const char *ptr, size_t len)
|
||||||
{
|
{
|
||||||
bool attached =
|
bool attached =
|
||||||
!!fhandler_console::get_console_process_id (getHelperProcessId (), true);
|
!!fhandler_console::get_console_process_id (get_helper_process_id (), true);
|
||||||
if (!attached && pcon_attached_to == get_minor ())
|
if (!attached && pcon_attached_to == get_minor ())
|
||||||
{
|
{
|
||||||
for (DWORD t0 = GetTickCount (); GetTickCount () - t0 < 100; )
|
for (DWORD t0 = GetTickCount (); GetTickCount () - t0 < 100; )
|
||||||
{
|
{
|
||||||
Sleep (1);
|
Sleep (1);
|
||||||
attached = fhandler_console::get_console_process_id
|
attached = fhandler_console::get_console_process_id
|
||||||
(getHelperProcessId (), true);
|
(get_helper_process_id (), true);
|
||||||
if (attached)
|
if (attached)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1383,7 +1383,7 @@ fhandler_pty_slave::write (const void *ptr, size_t len)
|
||||||
restore_reattach_pcon ();
|
restore_reattach_pcon ();
|
||||||
|
|
||||||
/* Push slave output to pseudo console screen buffer */
|
/* Push slave output to pseudo console screen buffer */
|
||||||
if (getPseudoConsole ())
|
if (get_pseudo_console ())
|
||||||
{
|
{
|
||||||
acquire_output_mutex (INFINITE);
|
acquire_output_mutex (INFINITE);
|
||||||
push_to_pcon_screenbuffer ((char *)ptr, len);
|
push_to_pcon_screenbuffer ((char *)ptr, len);
|
||||||
|
@ -1701,7 +1701,7 @@ out:
|
||||||
termios_printf ("%d = read(%p, %lu)", totalread, ptr, len);
|
termios_printf ("%d = read(%p, %lu)", totalread, ptr, len);
|
||||||
len = (size_t) totalread;
|
len = (size_t) totalread;
|
||||||
/* Push slave read as echo to pseudo console screen buffer. */
|
/* Push slave read as echo to pseudo console screen buffer. */
|
||||||
if (getPseudoConsole () && ptr0 && (get_ttyp ()->ti.c_lflag & ECHO))
|
if (get_pseudo_console () && ptr0 && (get_ttyp ()->ti.c_lflag & ECHO))
|
||||||
{
|
{
|
||||||
acquire_output_mutex (INFINITE);
|
acquire_output_mutex (INFINITE);
|
||||||
push_to_pcon_screenbuffer (ptr0, len);
|
push_to_pcon_screenbuffer (ptr0, len);
|
||||||
|
@ -1847,7 +1847,7 @@ fhandler_pty_slave::ioctl (unsigned int cmd, void *arg)
|
||||||
get_ttyp ()->winsize = get_ttyp ()->arg.winsize;
|
get_ttyp ()->winsize = get_ttyp ()->arg.winsize;
|
||||||
break;
|
break;
|
||||||
case TIOCSWINSZ:
|
case TIOCSWINSZ:
|
||||||
if (getPseudoConsole ())
|
if (get_pseudo_console ())
|
||||||
{
|
{
|
||||||
/* If not attached to this pseudo console,
|
/* If not attached to this pseudo console,
|
||||||
try to attach temporarily. */
|
try to attach temporarily. */
|
||||||
|
@ -2230,21 +2230,21 @@ fhandler_pty_master::close ()
|
||||||
termios_printf ("CloseHandle (output_mutex<%p>), %E", output_mutex);
|
termios_printf ("CloseHandle (output_mutex<%p>), %E", output_mutex);
|
||||||
if (!NT_SUCCESS (status))
|
if (!NT_SUCCESS (status))
|
||||||
debug_printf ("NtQueryObject: %y", status);
|
debug_printf ("NtQueryObject: %y", status);
|
||||||
else if (obi.HandleCount == (getPseudoConsole () ? 2 : 1))
|
else if (obi.HandleCount == (get_pseudo_console () ? 2 : 1))
|
||||||
/* Helper process has inherited one. */
|
/* Helper process has inherited one. */
|
||||||
{
|
{
|
||||||
termios_printf ("Closing last master of pty%d", get_minor ());
|
termios_printf ("Closing last master of pty%d", get_minor ());
|
||||||
/* Close Pseudo Console */
|
/* Close Pseudo Console */
|
||||||
if (getPseudoConsole ())
|
if (get_pseudo_console ())
|
||||||
{
|
{
|
||||||
/* Terminate helper process */
|
/* Terminate helper process */
|
||||||
SetEvent (get_ttyp ()->hHelperGoodbye);
|
SetEvent (get_ttyp ()->h_helper_goodbye);
|
||||||
WaitForSingleObject (get_ttyp ()->hHelperProcess, INFINITE);
|
WaitForSingleObject (get_ttyp ()->h_helper_process, INFINITE);
|
||||||
/* FIXME: Pseudo console can be accessed via its handle
|
/* FIXME: Pseudo console can be accessed via its handle
|
||||||
only in the process which created it. What else can we do? */
|
only in the process which created it. What else can we do? */
|
||||||
if (master_pid_tmp == myself->pid)
|
if (master_pid_tmp == myself->pid)
|
||||||
/* Release pseudo console */
|
/* Release pseudo console */
|
||||||
ClosePseudoConsole (getPseudoConsole ());
|
ClosePseudoConsole (get_pseudo_console ());
|
||||||
get_ttyp ()->switch_to_pcon_in = false;
|
get_ttyp ()->switch_to_pcon_in = false;
|
||||||
get_ttyp ()->switch_to_pcon_out = false;
|
get_ttyp ()->switch_to_pcon_out = false;
|
||||||
}
|
}
|
||||||
|
@ -2403,12 +2403,12 @@ fhandler_pty_master::ioctl (unsigned int cmd, void *arg)
|
||||||
case TIOCSWINSZ:
|
case TIOCSWINSZ:
|
||||||
/* FIXME: Pseudo console can be accessed via its handle
|
/* FIXME: Pseudo console can be accessed via its handle
|
||||||
only in the process which created it. What else can we do? */
|
only in the process which created it. What else can we do? */
|
||||||
if (getPseudoConsole () && get_ttyp ()->master_pid == myself->pid)
|
if (get_pseudo_console () && get_ttyp ()->master_pid == myself->pid)
|
||||||
{
|
{
|
||||||
COORD size;
|
COORD size;
|
||||||
size.X = ((struct winsize *) arg)->ws_col;
|
size.X = ((struct winsize *) arg)->ws_col;
|
||||||
size.Y = ((struct winsize *) arg)->ws_row;
|
size.Y = ((struct winsize *) arg)->ws_row;
|
||||||
ResizePseudoConsole (getPseudoConsole (), size);
|
ResizePseudoConsole (get_pseudo_console (), size);
|
||||||
}
|
}
|
||||||
if (get_ttyp ()->winsize.ws_row != ((struct winsize *) arg)->ws_row
|
if (get_ttyp ()->winsize.ws_row != ((struct winsize *) arg)->ws_row
|
||||||
|| get_ttyp ()->winsize.ws_col != ((struct winsize *) arg)->ws_col)
|
|| get_ttyp ()->winsize.ws_col != ((struct winsize *) arg)->ws_col)
|
||||||
|
@ -2675,9 +2675,9 @@ fhandler_pty_slave::fixup_after_attach (bool native_maybe, int fd_set)
|
||||||
{
|
{
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
fd = fd_set;
|
fd = fd_set;
|
||||||
if (getPseudoConsole ())
|
if (get_pseudo_console ())
|
||||||
{
|
{
|
||||||
if (fhandler_console::get_console_process_id (getHelperProcessId (),
|
if (fhandler_console::get_console_process_id (get_helper_process_id (),
|
||||||
true))
|
true))
|
||||||
{
|
{
|
||||||
if (pcon_attached_to != get_minor ())
|
if (pcon_attached_to != get_minor ())
|
||||||
|
@ -2769,7 +2769,7 @@ fhandler_pty_slave::fixup_after_exec ()
|
||||||
|
|
||||||
if (!close_on_exec ())
|
if (!close_on_exec ())
|
||||||
fixup_after_fork (NULL);
|
fixup_after_fork (NULL);
|
||||||
else if (getPseudoConsole ())
|
else if (get_pseudo_console ())
|
||||||
{
|
{
|
||||||
int used = 0;
|
int used = 0;
|
||||||
int attached = 0;
|
int attached = 0;
|
||||||
|
@ -2802,7 +2802,7 @@ fhandler_pty_slave::fixup_after_exec ()
|
||||||
|
|
||||||
#if USE_API_HOOK
|
#if USE_API_HOOK
|
||||||
/* Hook Console API */
|
/* Hook Console API */
|
||||||
if (getPseudoConsole ())
|
if (get_pseudo_console ())
|
||||||
{
|
{
|
||||||
#define DO_HOOK(module, name) \
|
#define DO_HOOK(module, name) \
|
||||||
if (!name##_Orig) \
|
if (!name##_Orig) \
|
||||||
|
@ -3004,7 +3004,7 @@ fhandler_pty_master::pty_master_fwd_thread ()
|
||||||
}
|
}
|
||||||
ssize_t wlen = rlen;
|
ssize_t wlen = rlen;
|
||||||
char *ptr = outbuf;
|
char *ptr = outbuf;
|
||||||
if (getPseudoConsole ())
|
if (get_pseudo_console ())
|
||||||
{
|
{
|
||||||
/* Avoid duplicating slave output which is already sent to
|
/* Avoid duplicating slave output which is already sent to
|
||||||
to_master_cyg */
|
to_master_cyg */
|
||||||
|
@ -3152,7 +3152,7 @@ fhandler_pty_master::setup_pseudoconsole ()
|
||||||
CreatePipe (&from_master, &to_slave, &sec_none, 0);
|
CreatePipe (&from_master, &to_slave, &sec_none, 0);
|
||||||
SetLastError (ERROR_SUCCESS);
|
SetLastError (ERROR_SUCCESS);
|
||||||
HRESULT res = CreatePseudoConsole (size, from_master, to_master,
|
HRESULT res = CreatePseudoConsole (size, from_master, to_master,
|
||||||
0, &get_ttyp ()->hPseudoConsole);
|
0, &get_ttyp ()->h_pseudo_console);
|
||||||
if (res != S_OK || GetLastError () == ERROR_PROC_NOT_FOUND)
|
if (res != S_OK || GetLastError () == ERROR_PROC_NOT_FOUND)
|
||||||
{
|
{
|
||||||
if (res != S_OK)
|
if (res != S_OK)
|
||||||
|
@ -3162,7 +3162,7 @@ fhandler_pty_master::setup_pseudoconsole ()
|
||||||
CloseHandle (to_slave);
|
CloseHandle (to_slave);
|
||||||
from_master = from_master_cyg;
|
from_master = from_master_cyg;
|
||||||
to_slave = NULL;
|
to_slave = NULL;
|
||||||
get_ttyp ()->hPseudoConsole = NULL;
|
get_ttyp ()->h_pseudo_console = NULL;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3186,8 +3186,8 @@ fhandler_pty_master::setup_pseudoconsole ()
|
||||||
UpdateProcThreadAttribute (si_helper.lpAttributeList,
|
UpdateProcThreadAttribute (si_helper.lpAttributeList,
|
||||||
0,
|
0,
|
||||||
PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE,
|
PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE,
|
||||||
get_ttyp ()->hPseudoConsole,
|
get_ttyp ()->h_pseudo_console,
|
||||||
sizeof (get_ttyp ()->hPseudoConsole),
|
sizeof (get_ttyp ()->h_pseudo_console),
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
HANDLE hello = CreateEvent (&sec_none, true, false, NULL);
|
HANDLE hello = CreateEvent (&sec_none, true, false, NULL);
|
||||||
HANDLE goodbye = CreateEvent (&sec_none, true, false, NULL);
|
HANDLE goodbye = CreateEvent (&sec_none, true, false, NULL);
|
||||||
|
@ -3228,9 +3228,9 @@ fhandler_pty_master::setup_pseudoconsole ()
|
||||||
DeleteProcThreadAttributeList (si_helper.lpAttributeList);
|
DeleteProcThreadAttributeList (si_helper.lpAttributeList);
|
||||||
HeapFree (GetProcessHeap (), 0, si_helper.lpAttributeList);
|
HeapFree (GetProcessHeap (), 0, si_helper.lpAttributeList);
|
||||||
/* Setting information of stuffs regarding pseudo console */
|
/* Setting information of stuffs regarding pseudo console */
|
||||||
get_ttyp ()->hHelperGoodbye = goodbye;
|
get_ttyp ()->h_helper_goodbye = goodbye;
|
||||||
get_ttyp ()->hHelperProcess = pi_helper.hProcess;
|
get_ttyp ()->h_helper_process = pi_helper.hProcess;
|
||||||
get_ttyp ()->HelperProcessId = pi_helper.dwProcessId;
|
get_ttyp ()->helper_process_id = pi_helper.dwProcessId;
|
||||||
CloseHandle (from_master);
|
CloseHandle (from_master);
|
||||||
CloseHandle (to_master);
|
CloseHandle (to_master);
|
||||||
from_master = hpConIn;
|
from_master = hpConIn;
|
||||||
|
|
|
@ -140,12 +140,12 @@ frok::child (volatile char * volatile here)
|
||||||
{
|
{
|
||||||
fhandler_base *fh = cfd;
|
fhandler_base *fh = cfd;
|
||||||
fhandler_pty_master *ptym = (fhandler_pty_master *) fh;
|
fhandler_pty_master *ptym = (fhandler_pty_master *) fh;
|
||||||
if (ptym->getPseudoConsole ())
|
if (ptym->get_pseudo_console ())
|
||||||
{
|
{
|
||||||
debug_printf ("found a PTY master %d: helper_PID=%d",
|
debug_printf ("found a PTY master %d: helper_PID=%d",
|
||||||
ptym->get_minor (), ptym->getHelperProcessId ());
|
ptym->get_minor (), ptym->get_helper_process_id ());
|
||||||
if (fhandler_console::get_console_process_id (
|
if (fhandler_console::get_console_process_id (
|
||||||
ptym->getHelperProcessId (), true))
|
ptym->get_helper_process_id (), true))
|
||||||
/* Already attached */
|
/* Already attached */
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
|
@ -153,7 +153,7 @@ frok::child (volatile char * volatile here)
|
||||||
if (ptym->attach_pcon_in_fork ())
|
if (ptym->attach_pcon_in_fork ())
|
||||||
{
|
{
|
||||||
FreeConsole ();
|
FreeConsole ();
|
||||||
if (!AttachConsole (ptym->getHelperProcessId ()))
|
if (!AttachConsole (ptym->get_helper_process_id ()))
|
||||||
/* Error */;
|
/* Error */;
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -259,7 +259,7 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
|
||||||
{
|
{
|
||||||
bool rc;
|
bool rc;
|
||||||
int res = -1;
|
int res = -1;
|
||||||
DWORD pidRestore = 0;
|
DWORD pid_restore = 0;
|
||||||
bool attach_to_console = false;
|
bool attach_to_console = false;
|
||||||
pid_t ctty_pgid = 0;
|
pid_t ctty_pgid = 0;
|
||||||
|
|
||||||
|
@ -581,7 +581,7 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
|
||||||
sa = &sec_none_nih;
|
sa = &sec_none_nih;
|
||||||
|
|
||||||
/* Attach to pseudo console if pty salve is used */
|
/* Attach to pseudo console if pty salve is used */
|
||||||
pidRestore = fhandler_console::get_console_process_id
|
pid_restore = fhandler_console::get_console_process_id
|
||||||
(GetCurrentProcessId (), false);
|
(GetCurrentProcessId (), false);
|
||||||
for (int i = 0; i < 3; i ++)
|
for (int i = 0; i < 3; i ++)
|
||||||
{
|
{
|
||||||
|
@ -591,19 +591,19 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
|
||||||
if (fh && fh->get_major () == DEV_PTYS_MAJOR)
|
if (fh && fh->get_major () == DEV_PTYS_MAJOR)
|
||||||
{
|
{
|
||||||
fhandler_pty_slave *ptys = (fhandler_pty_slave *) fh;
|
fhandler_pty_slave *ptys = (fhandler_pty_slave *) fh;
|
||||||
if (ptys->getPseudoConsole ())
|
if (ptys->get_pseudo_console ())
|
||||||
{
|
{
|
||||||
DWORD dwHelperProcessId = ptys->getHelperProcessId ();
|
DWORD helper_process_id = ptys->get_helper_process_id ();
|
||||||
debug_printf ("found a PTY slave %d: helper_PID=%d",
|
debug_printf ("found a PTY slave %d: helper_PID=%d",
|
||||||
fh->get_minor (), dwHelperProcessId);
|
fh->get_minor (), helper_process_id);
|
||||||
if (fhandler_console::get_console_process_id
|
if (fhandler_console::get_console_process_id
|
||||||
(dwHelperProcessId, true))
|
(helper_process_id, true))
|
||||||
/* Already attached */
|
/* Already attached */
|
||||||
attach_to_console = true;
|
attach_to_console = true;
|
||||||
else if (!attach_to_console)
|
else if (!attach_to_console)
|
||||||
{
|
{
|
||||||
FreeConsole ();
|
FreeConsole ();
|
||||||
if (AttachConsole (dwHelperProcessId))
|
if (AttachConsole (helper_process_id))
|
||||||
attach_to_console = true;
|
attach_to_console = true;
|
||||||
}
|
}
|
||||||
ptys->fixup_after_attach (!iscygwin (), fd);
|
ptys->fixup_after_attach (!iscygwin (), fd);
|
||||||
|
@ -922,10 +922,10 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
|
||||||
if (envblock)
|
if (envblock)
|
||||||
free (envblock);
|
free (envblock);
|
||||||
|
|
||||||
if (attach_to_console && pidRestore)
|
if (attach_to_console && pid_restore)
|
||||||
{
|
{
|
||||||
FreeConsole ();
|
FreeConsole ();
|
||||||
AttachConsole (pidRestore);
|
AttachConsole (pid_restore);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int) res;
|
return (int) res;
|
||||||
|
|
|
@ -235,7 +235,7 @@ tty::init ()
|
||||||
master_pid = 0;
|
master_pid = 0;
|
||||||
is_console = false;
|
is_console = false;
|
||||||
attach_pcon_in_fork = false;
|
attach_pcon_in_fork = false;
|
||||||
hPseudoConsole = NULL;
|
h_pseudo_console = NULL;
|
||||||
column = 0;
|
column = 0;
|
||||||
switch_to_pcon_in = false;
|
switch_to_pcon_in = false;
|
||||||
switch_to_pcon_out = false;
|
switch_to_pcon_out = false;
|
||||||
|
|
|
@ -93,10 +93,10 @@ private:
|
||||||
HANDLE _from_master_cyg;
|
HANDLE _from_master_cyg;
|
||||||
HANDLE _to_master;
|
HANDLE _to_master;
|
||||||
HANDLE _to_master_cyg;
|
HANDLE _to_master_cyg;
|
||||||
HPCON hPseudoConsole;
|
HPCON h_pseudo_console;
|
||||||
HANDLE hHelperProcess;
|
HANDLE h_helper_process;
|
||||||
DWORD HelperProcessId;
|
DWORD helper_process_id;
|
||||||
HANDLE hHelperGoodbye;
|
HANDLE h_helper_goodbye;
|
||||||
bool attach_pcon_in_fork;
|
bool attach_pcon_in_fork;
|
||||||
bool switch_to_pcon_in;
|
bool switch_to_pcon_in;
|
||||||
bool switch_to_pcon_out;
|
bool switch_to_pcon_out;
|
||||||
|
|
Loading…
Reference in New Issue