* cygheap.cc (init_cygheap::manage_console_count): Delete.
* cygheap.h (init_cygheap::manage_console_count): Ditto. (init_cygheap::console_count): Ditto. * fhandler.h (fhandler_console::has_a): Ditto. (fhandler_console::free_console): Declare new function. * fhandler_console.cc (fhandler_console::free_console): Define new function. (fhandler_console::open_setup): Delete call to manage_console_count. (fhandler_console::close): Ditto. Replace with call to free_console(). * fhandler_tty.cc (fhandler_pty_slave::open): Delete call to manage_console_count. (fhandler_pty_slave::cleanup): Ditto. (fhandler_pty_slave::close): Call fhandler_console::free_console() if this is our controlling tty. * pinfo.cc (_pinfo::set_ctty): Skip function if tty in question == our ctty. Delete call to manage_console_count. * syscalls.cc (close_all_files): Avoid locking and avoid setting errno when iterating over fds.
This commit is contained in:
parent
a72ada654e
commit
3e9c8f2e81
|
@ -1,3 +1,25 @@
|
||||||
|
2012-02-07 Christopher Faylor <me.cygwin2012@cgf.cx>
|
||||||
|
|
||||||
|
* cygheap.cc (init_cygheap::manage_console_count): Delete.
|
||||||
|
* cygheap.h (init_cygheap::manage_console_count): Ditto.
|
||||||
|
(init_cygheap::console_count): Ditto.
|
||||||
|
* fhandler.h (fhandler_console::has_a): Ditto.
|
||||||
|
(fhandler_console::free_console): Declare new function.
|
||||||
|
* fhandler_console.cc (fhandler_console::free_console): Define new
|
||||||
|
function.
|
||||||
|
(fhandler_console::open_setup): Delete call to manage_console_count.
|
||||||
|
(fhandler_console::close): Ditto. Replace with call to free_console().
|
||||||
|
* fhandler_tty.cc (fhandler_pty_slave::open): Delete call to
|
||||||
|
manage_console_count.
|
||||||
|
(fhandler_pty_slave::cleanup): Ditto.
|
||||||
|
(fhandler_pty_slave::close): Call fhandler_console::free_console() if
|
||||||
|
this is our controlling tty.
|
||||||
|
* pinfo.cc (_pinfo::set_ctty): Skip function if tty in question == our
|
||||||
|
ctty. Delete call to manage_console_count.
|
||||||
|
|
||||||
|
* syscalls.cc (close_all_files): Avoid locking and avoid setting errno
|
||||||
|
when iterating over fds.
|
||||||
|
|
||||||
2012-02-07 Christopher Faylor <me.cygwin2012@cgf.cx>
|
2012-02-07 Christopher Faylor <me.cygwin2012@cgf.cx>
|
||||||
|
|
||||||
* include/cygwin/version.h: Bump CYGWIN_VERSION_DLL_MINOR to 11.
|
* include/cygwin/version.h: Bump CYGWIN_VERSION_DLL_MINOR to 11.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* cygheap.cc: Cygwin heap manager.
|
/* cygheap.cc: Cygwin heap manager.
|
||||||
|
|
||||||
Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
|
Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
|
||||||
2010, 2011 Red Hat, Inc.
|
2010, 2011, 2012 Red Hat, Inc.
|
||||||
|
|
||||||
This file is part of Cygwin.
|
This file is part of Cygwin.
|
||||||
|
|
||||||
|
@ -89,23 +89,6 @@ cygheap_fixup_in_child (bool execed)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
init_cygheap::manage_console_count (const char *something, int amount, bool avoid_freeing_console)
|
|
||||||
{
|
|
||||||
if (console_count == 0 && amount > 0)
|
|
||||||
init_console_handler (true);
|
|
||||||
console_count += amount;
|
|
||||||
debug_printf ("%s: console_count %d, amount %d, %s, avoid_freeing_console %d",
|
|
||||||
something, console_count, amount, myctty (), avoid_freeing_console);
|
|
||||||
if (!avoid_freeing_console && amount <= 0 && !console_count && myself->ctty == -1)
|
|
||||||
{
|
|
||||||
BOOL res = FreeConsole ();
|
|
||||||
debug_printf ("freed console, res %d", res);
|
|
||||||
init_console_handler (false);
|
|
||||||
}
|
|
||||||
return console_count;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
init_cygheap::close_ctty ()
|
init_cygheap::close_ctty ()
|
||||||
{
|
{
|
||||||
|
|
|
@ -303,9 +303,6 @@ struct init_cygheap: public mini_cygheap
|
||||||
} inode_list; /* Global inode pointer for adv. locking. */
|
} inode_list; /* Global inode pointer for adv. locking. */
|
||||||
hook_chain hooks;
|
hook_chain hooks;
|
||||||
void close_ctty ();
|
void close_ctty ();
|
||||||
int manage_console_count (const char *, int, bool = false) __attribute__ ((regparm (3)));
|
|
||||||
private:
|
|
||||||
int console_count;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1357,7 +1357,7 @@ private:
|
||||||
void setup ();
|
void setup ();
|
||||||
bool set_unit ();
|
bool set_unit ();
|
||||||
static bool need_invisible ();
|
static bool need_invisible ();
|
||||||
static bool has_a () {return !invisible_console;}
|
static void free_console ();
|
||||||
|
|
||||||
fhandler_console (void *) {}
|
fhandler_console (void *) {}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* fhandler_console.cc
|
/* fhandler_console.cc
|
||||||
|
|
||||||
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
||||||
2006, 2008, 2009, 2010, 2011 Red Hat, Inc.
|
2006, 2008, 2009, 2010, 2011, 2012 Red Hat, Inc.
|
||||||
|
|
||||||
This file is part of Cygwin.
|
This file is part of Cygwin.
|
||||||
|
|
||||||
|
@ -827,7 +827,6 @@ fhandler_console::open (int flags, mode_t)
|
||||||
void
|
void
|
||||||
fhandler_console::open_setup (int flags)
|
fhandler_console::open_setup (int flags)
|
||||||
{
|
{
|
||||||
cygheap->manage_console_count ("fhandler_console::open", 1);
|
|
||||||
set_flags ((flags & ~O_TEXT) | O_BINARY);
|
set_flags ((flags & ~O_TEXT) | O_BINARY);
|
||||||
myself->set_ctty (this, flags);
|
myself->set_ctty (this, flags);
|
||||||
}
|
}
|
||||||
|
@ -838,7 +837,7 @@ fhandler_console::close ()
|
||||||
CloseHandle (get_io_handle ());
|
CloseHandle (get_io_handle ());
|
||||||
CloseHandle (get_output_handle ());
|
CloseHandle (get_output_handle ());
|
||||||
if (!have_execed)
|
if (!have_execed)
|
||||||
cygheap->manage_console_count ("fhandler_console::close", -1);
|
free_console ();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2348,6 +2347,14 @@ fhandler_console::create_invisible_console_workaround ()
|
||||||
return invisible_console = true;
|
return invisible_console = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
fhandler_console::free_console ()
|
||||||
|
{
|
||||||
|
BOOL res = FreeConsole ();
|
||||||
|
debug_printf ("freed console, res %d", res);
|
||||||
|
init_console_handler (false);
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
fhandler_console::need_invisible ()
|
fhandler_console::need_invisible ()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* fhandler_tty.cc
|
/* fhandler_tty.cc
|
||||||
|
|
||||||
Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
||||||
2006, 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
|
2006, 2007, 2008, 2009, 2010, 2011, 2012 Red Hat, Inc.
|
||||||
|
|
||||||
This file is part of Cygwin.
|
This file is part of Cygwin.
|
||||||
|
|
||||||
|
@ -516,9 +516,8 @@ fhandler_pty_slave::open (int flags, mode_t)
|
||||||
set_io_handle (from_master_local);
|
set_io_handle (from_master_local);
|
||||||
set_output_handle (to_master_local);
|
set_output_handle (to_master_local);
|
||||||
|
|
||||||
set_open_status ();
|
|
||||||
if (cygheap->manage_console_count ("fhandler_pty_slave::open", 1) == 1)
|
|
||||||
fhandler_console::need_invisible ();
|
fhandler_console::need_invisible ();
|
||||||
|
set_open_status ();
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
|
@ -540,7 +539,6 @@ fhandler_pty_slave::open_setup (int flags)
|
||||||
{
|
{
|
||||||
set_flags ((flags & ~O_TEXT) | O_BINARY);
|
set_flags ((flags & ~O_TEXT) | O_BINARY);
|
||||||
myself->set_ctty (this, flags);
|
myself->set_ctty (this, flags);
|
||||||
cygheap->manage_console_count ("fhandler_pty_slave::open_setup", 1);
|
|
||||||
report_tty_counts (this, "opened", "");
|
report_tty_counts (this, "opened", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -552,7 +550,6 @@ fhandler_pty_slave::cleanup ()
|
||||||
Since close_all_files is not called until after the cygwin process has
|
Since close_all_files is not called until after the cygwin process has
|
||||||
synced or before a non-cygwin process has exited, it should be safe to
|
synced or before a non-cygwin process has exited, it should be safe to
|
||||||
just close this normally. cgf 2006-05-20 */
|
just close this normally. cgf 2006-05-20 */
|
||||||
cygheap->manage_console_count ("fhandler_pty_slave::close", -1);
|
|
||||||
report_tty_counts (this, "closed", "");
|
report_tty_counts (this, "closed", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -564,6 +561,8 @@ fhandler_pty_slave::close ()
|
||||||
termios_printf ("CloseHandle (inuse), %E");
|
termios_printf ("CloseHandle (inuse), %E");
|
||||||
if (!ForceCloseHandle (input_available_event))
|
if (!ForceCloseHandle (input_available_event))
|
||||||
termios_printf ("CloseHandle (input_available_event<%p>), %E", input_available_event);
|
termios_printf ("CloseHandle (input_available_event<%p>), %E", input_available_event);
|
||||||
|
if ((unsigned) myself->ctty == FHDEV (DEV_PTYS_MAJOR, get_unit ()))
|
||||||
|
fhandler_console::free_console (); /* assumes that we are the last pty closer */
|
||||||
return fhandler_pty_common::close ();
|
return fhandler_pty_common::close ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -900,7 +899,6 @@ int
|
||||||
fhandler_pty_slave::dup (fhandler_base *child, int flags)
|
fhandler_pty_slave::dup (fhandler_base *child, int flags)
|
||||||
{
|
{
|
||||||
myself->set_ctty (this, flags);
|
myself->set_ctty (this, flags);
|
||||||
cygheap->manage_console_count ("fhandler_pty_slave::dup", 1);
|
|
||||||
report_tty_counts (child, "duped slave", "");
|
report_tty_counts (child, "duped slave", "");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -435,7 +435,7 @@ _pinfo::set_ctty (fhandler_termios *fh, int flags)
|
||||||
{
|
{
|
||||||
tty_min& tc = *fh->tc ();
|
tty_min& tc = *fh->tc ();
|
||||||
debug_printf ("old %s, ctty device number %p, tc.ntty device number %p flags & O_NOCTTY %p", __ctty (), ctty, tc.ntty, flags & O_NOCTTY);
|
debug_printf ("old %s, ctty device number %p, tc.ntty device number %p flags & O_NOCTTY %p", __ctty (), ctty, tc.ntty, flags & O_NOCTTY);
|
||||||
if (fh && &tc && (ctty <= 0 || ctty == tc.ntty) && !(flags & O_NOCTTY))
|
if (fh && &tc && (ctty <= 0 || ctty != tc.ntty) && !(flags & O_NOCTTY))
|
||||||
{
|
{
|
||||||
ctty = tc.ntty;
|
ctty = tc.ntty;
|
||||||
if (cygheap->ctty != fh->archetype)
|
if (cygheap->ctty != fh->archetype)
|
||||||
|
@ -454,7 +454,6 @@ _pinfo::set_ctty (fhandler_termios *fh, int flags)
|
||||||
{
|
{
|
||||||
fh->archetype_usecount (1);
|
fh->archetype_usecount (1);
|
||||||
/* guard ctty fh */
|
/* guard ctty fh */
|
||||||
cygheap->manage_console_count ("_pinfo::set_ctty", 1);
|
|
||||||
report_tty_counts (cygheap->ctty, "ctty", "");
|
report_tty_counts (cygheap->ctty, "ctty", "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
What's new:
|
||||||
|
-----------
|
||||||
|
|
||||||
|
|
||||||
|
What changed:
|
||||||
|
-------------
|
||||||
|
|
||||||
|
- Fixed problem where background Cygwin processes kept the windows
|
||||||
|
console window from exiting.
|
|
@ -94,7 +94,7 @@ close_all_files (bool norelease)
|
||||||
|
|
||||||
for (int i = 0; i < (int) cygheap->fdtab.size; i++)
|
for (int i = 0; i < (int) cygheap->fdtab.size; i++)
|
||||||
{
|
{
|
||||||
cygheap_fdget cfd (i);
|
cygheap_fdget cfd (i, false, false);
|
||||||
if (cfd >= 0)
|
if (cfd >= 0)
|
||||||
{
|
{
|
||||||
debug_only_printf ("closing fd %d", i);
|
debug_only_printf ("closing fd %d", i);
|
||||||
|
@ -1016,7 +1016,6 @@ setsid (void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
myself->ctty = -1;
|
myself->ctty = -1;
|
||||||
cygheap->manage_console_count ("setsid", 0);
|
|
||||||
myself->sid = getpid ();
|
myself->sid = getpid ();
|
||||||
myself->pgid = getpid ();
|
myself->pgid = getpid ();
|
||||||
if (cygheap->ctty)
|
if (cygheap->ctty)
|
||||||
|
|
Loading…
Reference in New Issue