summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2006-06-03 06:35:10 +0000
committerChristopher Faylor <me@cgf.cx>2006-06-03 06:35:10 +0000
commit578e142a2be9dcca7f64c54e6ae8cecd01e6ac71 (patch)
tree502eec3c3b0813817d77c24beca92c90f25e23ff /winsup/cygwin
parent6210ee96ec5e436ad937e064f527b9a53276e4bf (diff)
downloadcygnal-578e142a2be9dcca7f64c54e6ae8cecd01e6ac71.tar.gz
cygnal-578e142a2be9dcca7f64c54e6ae8cecd01e6ac71.tar.bz2
cygnal-578e142a2be9dcca7f64c54e6ae8cecd01e6ac71.zip
* 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.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/ChangeLog13
-rw-r--r--winsup/cygwin/cygheap.cc13
-rw-r--r--winsup/cygwin/dcrt0.cc2
-rw-r--r--winsup/cygwin/dtable.cc5
-rw-r--r--winsup/cygwin/fhandler_tty.cc29
5 files changed, 26 insertions, 36 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index d2292784f..68a07be91 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,16 @@
+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
diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc
index 9f44c8a30..9b98b346a 100644
--- a/winsup/cygwin/cygheap.cc
+++ b/winsup/cygwin/cygheap.cc
@@ -102,21 +102,8 @@ void
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))
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index 59f451a62..0228c3275 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -685,13 +685,13 @@ child_info_spawn::handle_spawn ()
FALSE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE))
h = NULL;
set_myself (h);
- ready (true);
__argc = moreinfo->argc;
__argv = moreinfo->argv;
envp = moreinfo->envp;
envc = moreinfo->envc;
if (!dynamically_loaded)
cygheap->fdtab.fixup_after_exec ();
+ ready (true);
/* Need to do this after debug_fixup_after_fork_exec or DEBUGGING handling of
handles might get confused. */
diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc
index 85136ac61..fbec8c9e6 100644
--- a/winsup/cygwin/dtable.cc
+++ b/winsup/cygwin/dtable.cc
@@ -693,7 +693,10 @@ dtable::fixup_after_exec ()
if (fh->close_on_exec ())
{
if (fh->archetype)
- fh->close ();
+ {
+ debug_printf ("closing fd %d since it is an archetype", i);
+ fh->close ();
+ }
release (i);
}
else if (i == 0)
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index 46ee8bc2f..bca148647 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -164,8 +164,8 @@ void
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 ();
}
@@ -520,8 +520,6 @@ fhandler_tty_slave::open (int flags, mode_t)
release_output_mutex ();
}
- /* Duplicate tty handles. */
-
if (!get_ttyp ()->from_master || !get_ttyp ()->to_master)
{
termios_printf ("tty handles have been closed");
@@ -582,9 +580,9 @@ fhandler_tty_slave::open (int flags, mode_t)
}
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);
@@ -1145,15 +1143,6 @@ fhandler_tty_common::close ()
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);
@@ -1307,9 +1296,7 @@ fhandler_tty_slave::fixup_after_fork (HANDLE parent)
void
fhandler_tty_slave::fixup_after_exec ()
{
- if (close_on_exec ())
- close ();
- else
+ if (!close_on_exec ())
fixup_after_fork (NULL);
}
@@ -1438,6 +1425,8 @@ err:
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;
}
@@ -1469,8 +1458,6 @@ fhandler_pty_master::fixup_after_fork (HANDLE parent)
void
fhandler_pty_master::fixup_after_exec ()
{
- if (close_on_exec ())
- close ();
- else
+ if (!close_on_exec ())
fixup_after_fork (spawn_info->parent);
}