diff options
author | Christopher Faylor <me@cgf.cx> | 2011-10-20 18:02:54 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2011-10-20 18:02:54 +0400 |
commit | 38d732a152ff27601b385c00e6574111461b65c4 (patch) | |
tree | ce60ae6b1ad6b8ca6e1d71d10cddaffebbf62ab2 /winsup/cygwin/dtable.cc | |
parent | aa982024d14f9d6c4afe8ada89e5a46585623102 (diff) |
Throughout change TTY_* to PTY_*, tty_* to pty_*, and ttym_* to ptmx_*.
* devices.cc: Regenerate.
* dtable.cc: (fh_alloc): Preserve /dev/tty name when that's what we opened.
(build_fh_pc): Preserve any existing name.
* fhandler.cc (fhandler_base::open_with_arch): Ditto.
* fhandler_tty.cc (fhandler_pty_master::fhandler_pty_master): Force the name to
/dev/ptmx while preserving other pty master device information.
* path.h (cfree_maybe): New macro.
(path_conv::operator =): Free any allocated strings in target.
(path_conv::free_strings): Delete unused function.
* sigproc.cc (proc_terminate): Remove previous accommodation for execed
processes since it didn't have the desired effect. Change comment to a FIXME.
* spawn.cc (chExeced): Mark NO_COPY.
(exe_suffixes): Ditto.
Diffstat (limited to 'winsup/cygwin/dtable.cc')
-rw-r--r-- | winsup/cygwin/dtable.cc | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc index ff42b744d..67e9d8ca8 100644 --- a/winsup/cygwin/dtable.cc +++ b/winsup/cygwin/dtable.cc @@ -351,7 +351,7 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle) /* Console windows are not kernel objects, so the access mask returned by NtQueryInformationFile is meaningless. CMD always hands down stdin handles as R/O handles, but our tty slave sides are R/W. */ - if (dev == FH_TTY || iscons_dev (dev) || dev.get_major () == DEV_TTYS_MAJOR) + if (dev == FH_TTY || iscons_dev (dev) || dev.get_major () == DEV_PTYS_MAJOR) access |= GENERIC_READ | GENERIC_WRITE; else if (NT_SUCCESS (NtQueryInformationFile (handle, &io, &fai, sizeof fai, @@ -444,10 +444,10 @@ fh_alloc (path_conv& pc) switch (pc.dev.get_major ()) { - case DEV_TTYS_MAJOR: + case DEV_PTYS_MAJOR: fh = cnew (fhandler_pty_slave, pc.dev.get_minor ()); break; - case DEV_TTYM_MAJOR: + case DEV_PTYM_MAJOR: fh = cnew (fhandler_pty_master, pc.dev.get_minor ()); break; case DEV_CYGDRIVE_MAJOR: @@ -559,10 +559,14 @@ fh_alloc (path_conv& pc) else if (myself->ctty <= 0 && !myself->set_ctty (fhandler_termios::last, 0)) /* no tty assigned */; - else if (iscons_dev (myself->ctty)) - fh = cnew (fhandler_console, pc.dev); else - fh = cnew (fhandler_pty_slave, myself->ctty); + { + if (iscons_dev (myself->ctty)) + fh = cnew (fhandler_console, pc.dev); + else + fh = cnew (fhandler_pty_slave, myself->ctty); + fh->set_name ("/dev/tty"); + } break; case FH_KMSG: fh = cnew (fhandler_mailslot); @@ -600,6 +604,8 @@ build_fh_pc (path_conv& pc, bool set_name) set_errno (ENXIO); goto out; } + else if (fh->get_name ()) + /* already got one */; else if (fh->dev () != FH_NADA) fh->set_name (fh->dev ().name); else if (set_name) |