From 1ffe3e67b1f055a8a81a0e6cefad78f0df795aa6 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sat, 22 Mar 2008 21:04:16 +0000 Subject: * dtable.cc: Define various device-related string constants as wide character constants. (dtable::init_std_file_from_handle): Reorganize pipe handling to try to catch special tty case. (build_fh_name_worker): Declare for common use. (build_fh_name): Define char version. (build_fh_name): Define (currently unused) UNICODE_STRING version. (decode_tty): Detect if pipe is actually a cygwin tty, returning the tty name in the buffer. (handle_to_fn): Reorganize to use wide characters. * dtable.h (build_fh_name): Declare (currently unused) UNICODE_STRING version. * fhandler_tty.cc (fhandler_pty_master::setup): Use fhandler_pipe::create_selectable to create a pipe with a given name. * pipe.cc (pipe_handler): Make returned handle inheritable. (fhandler_pipe::create_selectable): Take an optional name. Use a standard cygwin introducer for the name. * path.cc (path_conv::check): Make first argument const. * path.h (path_conv::check): Ditto for declaration. (path_conv::path_conv): Ditto for UNICODE_STRING version. --- winsup/cygwin/fhandler_tty.cc | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'winsup/cygwin/fhandler_tty.cc') diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index 44a811ab3..26620b7cd 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -1352,6 +1352,7 @@ fhandler_tty_master::init_console () bool fhandler_pty_master::setup (bool ispty) { + int res; tty& t = *cygwin_shared->tty[get_unit ()]; tcinit (&t, true); /* Set termios information. Force initialization. */ @@ -1362,13 +1363,24 @@ fhandler_pty_master::setup (bool ispty) /* Create communication pipes */ /* FIXME: should this be sec_none_nih? */ - if (!CreatePipe (&from_master, &get_output_handle (), &sec_all, 128 * 1024)) + + /* Create communication pipes */ + + char pipename[sizeof("ttyNNNN-from-master")]; + __small_sprintf (pipename, "tty%d-from-master", get_unit ()); + res = fhandler_pipe::create_selectable (&sec_all_nih, from_master, + get_output_handle (), 128 * 1024, + pipename); + if (res) { errstr = "input pipe"; goto err; } - if (!CreatePipe (&get_io_handle (), &to_master, &sec_all, 128 * 1024)) + __small_sprintf (pipename, "tty%d-to-master", get_unit ()); + res = fhandler_pipe::create_selectable (&sec_all_nih, get_io_handle (), + to_master, 128 * 1024, pipename); + if (res) { errstr = "output pipe"; goto err; @@ -1380,7 +1392,7 @@ fhandler_pty_master::setup (bool ispty) need_nl = 0; - /* We do not open allow the others to open us (for handle duplication) + /* We do not allow others to open us (for handle duplication) but rely on cygheap->inherited_ctty for descendant processes. In the future the cygserver may allow access by others. */ -- cgit v1.2.3