+2006-06-03 Christopher Faylor <cgf@timesys.com>
+
+ * cygheap.cc (init_cygheap::close_ctty): Remove obsolete code.
+ * dcrt0.cc (child_info_spawn::handle_spawn): Signal ready after we've
+ run fixup_after_exec.
+ * dtable.cc (dtable::fixup_after_exec): Add debugging output.
+ * fhandler_tty.cc (fhandler_pty_master::doecho): Use class version of
+ to_master.
+ (fhandler_tty_common::close): Remove obsolete code.
+ (fhandler_tty_slave::fixup_after_exec): Don't close, since this is done
+ in dtable's fixup_after_exec. (revisit later?)
+ (fhandler_pty_master::fixup_after_exec): Ditto.
+
2006-06-02 Christopher Faylor <cgf@timesys.com>
* cygtls.h (CYGTLS_PADSIZE): Bump up or suffer a regrettable collision
init_cygheap::close_ctty ()
{
debug_printf ("closing cygheap->ctty %p", cygheap->ctty);
-#ifdef NEWVFORK
- int usecount = cygheap->ctty->usecount;
-#endif
cygheap->ctty->close ();
-#ifndef NEWVFORK
cygheap->ctty = NULL;
-#else // FIXME: This code ain't right
- if (cygheap->ctty_on_hold == cygheap->ctty)
- cygheap->ctty_on_hold = NULL;
- if (usecount == 1)
- {
- cygheap->ctty = NULL;
- debug_printf ("setting cygheap->ctty to NULL");
- }
-#endif
}
#define nextpage(x) ((char *) (((DWORD) ((char *) x + granmask)) & ~granmask))
fhandler_pty_master::doecho (const void *str, DWORD len)
{
acquire_output_mutex (INFINITE);
- if (!WriteFile (get_ttyp ()->to_master, str, len, &len, NULL))
- termios_printf ("Write to %p failed, %E", get_ttyp ()->to_master);
+ if (!WriteFile (to_master, str, len, &len, NULL))
+ termios_printf ("Write to %p failed, %E", to_master);
// WaitForSingleObject (output_done_event, INFINITE);
release_output_mutex ();
}
release_output_mutex ();
}
- /* Duplicate tty handles. */
-
if (!get_ttyp ()->from_master || !get_ttyp ()->to_master)
{
termios_printf ("tty handles have been closed");
}
termios_printf ("duplicated from_master %p->%p from tty_owner",
- get_ttyp ()->from_master, from_master_local);
+ get_ttyp ()->from_master, from_master_local);
termios_printf ("duplicated to_master %p->%p from tty_owner",
- get_ttyp ()->to_master, to_master_local);
+ get_ttyp ()->to_master, to_master_local);
set_io_handle (from_master_local);
set_output_handle (to_master_local);
if (!ForceCloseHandle1 (get_output_handle (), to_pty))
termios_printf ("CloseHandle (get_output_handle ()<%p>), %E", get_output_handle ());
-#if 0 // CGF - DELETME
- /* Send EOF to slaves if master side is closed */
- if (!get_ttyp ()->master_alive ())
- {
- termios_printf ("no more masters left. sending EOF");
- SetEvent (input_available_event);
- }
-#endif
-
if (!ForceCloseHandle (input_available_event))
termios_printf ("CloseHandle (input_available_event<%p>), %E", input_available_event);
void
fhandler_tty_slave::fixup_after_exec ()
{
- if (close_on_exec ())
- close ();
- else
+ if (!close_on_exec ())
fixup_after_fork (NULL);
}
close_maybe (input_available_event);
close_maybe (output_mutex);
close_maybe (input_mutex);
+ close_maybe (from_master);
+ close_maybe (to_master);
termios_printf ("tty%d open failed - failed to create %s", errstr);
return false;
}
void
fhandler_pty_master::fixup_after_exec ()
{
- if (close_on_exec ())
- close ();
- else
+ if (!close_on_exec ())
fixup_after_fork (spawn_info->parent);
}