* fhandler.h (fhandler_tty_slave::close): Declare new function.
(fhandler_tty_slave::dup): Declare new function. (fhandler_tty_slave::fixup_after_function): Declare new function. * fhandler_tty.cc (fhandler_tty_slave_open): Only increment fhandler_console::open_fhs when associated with a pty. (fhandler_tty_slave::close): Define new function. Decrement fhandler_console::open_fhs when associated with a pty. (fhandler_tty_slave::dup): Define new function. Increment fhandler_console::open_fhs when associated with a pty. (fhandler_tty_slave::fixup_after_fork): Define new function. Increment fhandler_console::open_fhs when associated with a pty.
This commit is contained in:
		| @@ -1,3 +1,17 @@ | |||||||
|  | 2003-03-03  Christopher Faylor  <cgf@redhat.com> | ||||||
|  |  | ||||||
|  | 	* fhandler.h (fhandler_tty_slave::close): Declare new function. | ||||||
|  | 	(fhandler_tty_slave::dup): Declare new function. | ||||||
|  | 	(fhandler_tty_slave::fixup_after_function): Declare new function. | ||||||
|  | 	* fhandler_tty.cc (fhandler_tty_slave_open): Only increment | ||||||
|  | 	fhandler_console::open_fhs when associated with a pty. | ||||||
|  | 	(fhandler_tty_slave::close): Define new function.  Decrement | ||||||
|  | 	fhandler_console::open_fhs when associated with a pty. | ||||||
|  | 	(fhandler_tty_slave::dup): Define new function.  Increment | ||||||
|  | 	fhandler_console::open_fhs when associated with a pty. | ||||||
|  | 	(fhandler_tty_slave::fixup_after_fork): Define new function.  Increment | ||||||
|  | 	fhandler_console::open_fhs when associated with a pty. | ||||||
|  |  | ||||||
| 2003-03-03  Christopher Faylor  <cgf@redhat.com> | 2003-03-03  Christopher Faylor  <cgf@redhat.com> | ||||||
|  |  | ||||||
| 	* fhandler_tty.cc (fhandler_pty_slave::open): Grudgingly increment | 	* fhandler_tty.cc (fhandler_pty_slave::open): Grudgingly increment | ||||||
|   | |||||||
| @@ -907,6 +907,9 @@ class fhandler_tty_slave: public fhandler_tty_common | |||||||
|   int tcgetattr (struct termios *t); |   int tcgetattr (struct termios *t); | ||||||
|   int tcflush (int); |   int tcflush (int); | ||||||
|   int ioctl (unsigned int cmd, void *); |   int ioctl (unsigned int cmd, void *); | ||||||
|  |   int close (); | ||||||
|  |   int dup (fhandler_base *child); | ||||||
|  |   void fixup_after_fork (HANDLE parent); | ||||||
|  |  | ||||||
|   __off64_t lseek (__off64_t, int) { return 0; } |   __off64_t lseek (__off64_t, int) { return 0; } | ||||||
|   select_record *select_read (select_record *s); |   select_record *select_read (select_record *s); | ||||||
|   | |||||||
| @@ -552,12 +552,27 @@ fhandler_tty_slave::open (path_conv *, int flags, mode_t) | |||||||
|   set_output_handle (to_master_local); |   set_output_handle (to_master_local); | ||||||
|  |  | ||||||
|   set_open_status (); |   set_open_status (); | ||||||
|  |   if (!output_done_event) | ||||||
|  |     { | ||||||
|       fhandler_console::open_fhs++; |       fhandler_console::open_fhs++; | ||||||
|  |       termios_printf ("incremented open_fhs %d", fhandler_console::open_fhs); | ||||||
|  |     } | ||||||
|   termios_printf ("tty%d opened", ttynum); |   termios_printf ("tty%d opened", ttynum); | ||||||
|  |  | ||||||
|   return 1; |   return 1; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | int | ||||||
|  | fhandler_tty_slave::close () | ||||||
|  | { | ||||||
|  |   if (!output_done_event) | ||||||
|  |     { | ||||||
|  |       fhandler_console::open_fhs--; | ||||||
|  |       termios_printf ("decremeted open_fhs %d", fhandler_console::open_fhs); | ||||||
|  |     } | ||||||
|  |   return fhandler_tty_common::close (); | ||||||
|  | } | ||||||
|  |  | ||||||
| int | int | ||||||
| fhandler_tty_slave::cygserver_attach_tty (LPHANDLE from_master_ptr, | fhandler_tty_slave::cygserver_attach_tty (LPHANDLE from_master_ptr, | ||||||
| 					  LPHANDLE to_master_ptr) | 					  LPHANDLE to_master_ptr) | ||||||
| @@ -814,6 +829,17 @@ fhandler_tty_slave::read (void *ptr, size_t& len) | |||||||
|   return; |   return; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | int | ||||||
|  | fhandler_tty_slave::dup (fhandler_base *child) | ||||||
|  | { | ||||||
|  |   if (!output_done_event) | ||||||
|  |     { | ||||||
|  |       fhandler_console::open_fhs++; | ||||||
|  |       termios_printf ("incremented open_fhs %d", fhandler_console::open_fhs); | ||||||
|  |     } | ||||||
|  |   return fhandler_tty_common::dup (child); | ||||||
|  | } | ||||||
|  |  | ||||||
| int | int | ||||||
| fhandler_tty_common::dup (fhandler_base *child) | fhandler_tty_common::dup (fhandler_base *child) | ||||||
| { | { | ||||||
| @@ -1058,7 +1084,6 @@ fhandler_tty_common::close () | |||||||
|     termios_printf ("CloseHandle (get_output_handle ()<%p>), %E", get_output_handle ()); |     termios_printf ("CloseHandle (get_output_handle ()<%p>), %E", get_output_handle ()); | ||||||
|  |  | ||||||
|   inuse = NULL; |   inuse = NULL; | ||||||
|   fhandler_console::open_fhs++; |  | ||||||
|   termios_printf ("tty%d <%p,%p> closed", ttynum, get_handle (), get_output_handle ()); |   termios_printf ("tty%d <%p,%p> closed", ttynum, get_handle (), get_output_handle ()); | ||||||
|   return 0; |   return 0; | ||||||
| } | } | ||||||
| @@ -1202,6 +1227,17 @@ fhandler_tty_common::set_close_on_exec (int val) | |||||||
|   set_inheritance (output_handle, val); |   set_inheritance (output_handle, val); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | void | ||||||
|  | fhandler_tty_slave::fixup_after_fork (HANDLE parent) | ||||||
|  | { | ||||||
|  |   if (!output_done_event) | ||||||
|  |     { | ||||||
|  |       fhandler_console::open_fhs++; | ||||||
|  |       termios_printf ("incremented open_fhs %d", fhandler_console::open_fhs); | ||||||
|  |     } | ||||||
|  |   fhandler_tty_common::fixup_after_fork (parent); | ||||||
|  | } | ||||||
|  |  | ||||||
| void | void | ||||||
| fhandler_tty_common::fixup_after_fork (HANDLE parent) | fhandler_tty_common::fixup_after_fork (HANDLE parent) | ||||||
| { | { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user