* 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.
This commit is contained in:
@ -21,12 +21,16 @@ class dtable
|
||||
{
|
||||
fhandler_base **fds;
|
||||
fhandler_base **fds_on_hold;
|
||||
fhandler_base **archetypes;
|
||||
unsigned narchetypes;
|
||||
unsigned farchetype;
|
||||
static const int initial_archetype_size = 8;
|
||||
int first_fd_for_open;
|
||||
int cnt_need_fixup_before;
|
||||
public:
|
||||
size_t size;
|
||||
|
||||
dtable () : first_fd_for_open(3), cnt_need_fixup_before(0) {}
|
||||
dtable () : archetypes (NULL), narchetypes (0), farchetype (0), first_fd_for_open(3), cnt_need_fixup_before(0) {}
|
||||
void init () {first_fd_for_open = 3;}
|
||||
|
||||
void dec_need_fixup_before ()
|
||||
@ -69,6 +73,9 @@ public:
|
||||
void set_file_pointers_for_exec ();
|
||||
bool in_vfork_cleanup () {return fds_on_hold == fds;}
|
||||
fhandler_fifo *find_fifo (ATOM);
|
||||
fhandler_base *find_archetype (device& dev);
|
||||
fhandler_base **add_archetype ();
|
||||
void delete_archetype (fhandler_base *);
|
||||
};
|
||||
|
||||
fhandler_base *build_fh_dev (const device&, const char * = NULL);
|
||||
|
Reference in New Issue
Block a user