2004-05-12 Pierre Humblet <pierre.humblet@ieee.org>

* tty.h: Remove the %d or %x from all cygtty strings.
	(tty::open_output_mutex): Only declare.
	(tty::open_input_mutex): Ditto.
	(tty::open_mutex): New definition.
	* fhandlet_tty.cc (fhandler_tty_slave::open): Declare buf with
	size CYG_MAX_PATH and replace __small_printf calls by shared_name.
	* tty.cc (tty::create_inuse): Ditto.
	(tty::get_event): Ditto.
	(tty::common_init): Ditto.
	(tty::open_output_mutex): New method definition.
	(tty::open_input_mutex): Ditto.
	(tty::open_mutex): New method.
This commit is contained in:
Pierre Humblet
2004-05-12 01:44:11 +00:00
parent 5b4c8ae219
commit 8bdfa78a69
4 changed files with 61 additions and 36 deletions

View File

@ -466,14 +466,14 @@ fhandler_tty_slave::open (int flags, mode_t)
set_flags ((flags & ~O_TEXT) | O_BINARY);
/* Create synchronisation events */
char buf[40];
char buf[CYG_MAX_PATH];
/* output_done_event may or may not exist. It will exist if the tty
was opened by fhandler_tty_master::init, normally called at
startup if use_tty is non-zero. It will not exist if this is a
pty opened by fhandler_pty_master::open. In the former case, tty
output is handled by a separate thread which controls output. */
__small_sprintf (buf, OUTPUT_DONE_EVENT, get_unit ());
shared_name (buf, OUTPUT_DONE_EVENT, get_unit ());
output_done_event = OpenEvent (EVENT_ALL_ACCESS, TRUE, buf);
if (!(output_mutex = get_ttyp ()->open_output_mutex ()))
@ -488,7 +488,7 @@ fhandler_tty_slave::open (int flags, mode_t)
__seterrno ();
return 0;
}
__small_sprintf (buf, INPUT_AVAILABLE_EVENT, get_unit ());
shared_name (buf, INPUT_AVAILABLE_EVENT, get_unit ());
if (!(input_available_event = OpenEvent (EVENT_ALL_ACCESS, TRUE, buf)))
{
termios_printf ("open input event failed, %E");
@ -498,9 +498,9 @@ fhandler_tty_slave::open (int flags, mode_t)
/* The ioctl events may or may not exist. See output_done_event,
above. */
__small_sprintf (buf, IOCTL_REQUEST_EVENT, get_unit ());
shared_name (buf, IOCTL_REQUEST_EVENT, get_unit ());
ioctl_request_event = OpenEvent (EVENT_ALL_ACCESS, TRUE, buf);
__small_sprintf (buf, IOCTL_DONE_EVENT, get_unit ());
shared_name (buf, IOCTL_DONE_EVENT, get_unit ());
ioctl_done_event = OpenEvent (EVENT_ALL_ACCESS, TRUE, buf);
/* FIXME: Needs a method to eliminate tty races */