From 8e10c4311f9612951c82da5e844d51d985552d65 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Thu, 11 Dec 2003 06:12:41 +0000 Subject: * cygheap.h (cygheap_types): Add HEAP_ARCHETYPES. (init_cheap::ctty): Change to pointer. * dtable.h (dtable::find_archetype): Declare new function. (dtable::add_archetype): Declare new function. (dtable::delete_archetype): Declare new function. (dtable::narchetypes): Declare. (dtable::farchetypes): Declare. (dtable::initial_archetype_size): Declare. (dtable::dtable): Initialize new fields. (dtable::initial_archetype_size): Declare. * dtable.cc (dtable::find_archetype): Define new function. (dtable::add_archetype): Define new function. (dtable::delete_archetype): Define new function. (dtable::initial_archetype_size): Define. * fhandler.h (fhandler_base::archetype): Declare. (fhandler_base::usecount): Declare. * fhandler.cc (fhandler_base::fhandler_base): Initialize new fields. * fhandler_console.cc (fhandler_console::get_tty_stuff): Pass NULL to third argument of set_ctty. * fhandler_tty.cc (fhandler_tty_slave::open): Accommodate new archetype method to create only one instance of a tty. (fhandler_tty_slave::close): Don't close handles unless archetype usecount is zero. When that happens, close archetype too. (fhandler_tty_slave::dup): Just copy archetype. Set use count appropriately. Set ctty, if appropriate. (fhandler_tty_common::dup): Remove slave considerations. (fhandler_tty_common::set_close_on_exec): Remove cygheap->ctty considerations. * pinfo.cc (_pinfo::set_ctty): Accommodate new archetype methods. * pinfo.h (_pinfo::set_ctty): Make third argument explicit. * syscalls.cc (close_all_files): Decrement controlling tty use count before closing all handles to allow controlling tty to be closed. Remove previous controlling tty considerations. --- winsup/cygwin/fhandler.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'winsup/cygwin/fhandler.h') diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index b90e3bfb6..4ab7f0264 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -121,8 +121,11 @@ class fhandler_base DWORD fs_flags; HANDLE read_state; path_conv pc; + class fhandler_base *archetype; public: + int usecount; + void set_name (path_conv &pc); int error () const {return pc.error;} void set_error (int error) {pc.error = error;} @@ -130,6 +133,7 @@ class fhandler_base int pc_binmode () const {return pc.binmode ();} device& dev () {return pc.dev;} operator DWORD& () {return (DWORD) pc;} + virtual size_t size () const {return sizeof (*this);} virtual fhandler_base& operator =(fhandler_base &x); fhandler_base (); @@ -138,7 +142,7 @@ class fhandler_base /* Non-virtual simple accessor functions. */ void set_io_handle (HANDLE x) { io_handle = x; } - DWORD get_device () { return dev ().devn; } + DWORD& get_device () { return dev ().devn; } DWORD get_major () { return dev ().major; } DWORD get_minor () { return dev ().minor; } virtual int get_unit () { return dev ().minor; } -- cgit v1.2.3