summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/devices.h
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2011-06-12 20:15:26 +0000
committerChristopher Faylor <me@cgf.cx>2011-06-12 20:15:26 +0000
commitc3a9063f838124aa2a00600ad040dacd53a96cb5 (patch)
tree2a69a2cbb828f8fcd7aa32a0fbba5eec05be61dc /winsup/cygwin/devices.h
parent38e356f0e4277cd9804fcbcef1c3300154e19f90 (diff)
downloadcygnal-c3a9063f838124aa2a00600ad040dacd53a96cb5.tar.gz
cygnal-c3a9063f838124aa2a00600ad040dacd53a96cb5.tar.bz2
cygnal-c3a9063f838124aa2a00600ad040dacd53a96cb5.zip
Rename FH_BAD to FH_NADA throughout.
* devices.h (FH_ERROR): New value. (iscons_dev): Extend to detect all the console device types. * devices.in: Set aside storage for FH_ERROR. * dtable.cc (dtable::init_std_file_from_handle): Use iscons_dev to detect when device is a console. (fh_alloc): Pass device to console constructor. (build_fh_pc): Short circuit when we detect that the constructor saw an error. * fhandler.h (fhandler_console::fhandler_console): Accept fh_devices parameter. (get_tty_stuff): Change to void. * fhandler_console (fhandler_console::set_unit): Set device to FH_ERROR on attempt to access anything other than the current console. (fhandler_console::get_tty_stuff): Change to void return. (fhandler_console::open): Return EPERM on FH_ERROR device type. (fhandler_console::fhandler_console): Set the device type appropriately before calling get_tty_stuff and rely on that function to reset it if necessary.
Diffstat (limited to 'winsup/cygwin/devices.h')
-rw-r--r--winsup/cygwin/devices.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/winsup/cygwin/devices.h b/winsup/cygwin/devices.h
index b03364494..f1e620b59 100644
--- a/winsup/cygwin/devices.h
+++ b/winsup/cygwin/devices.h
@@ -247,7 +247,8 @@ enum fh_devices
FH_STREAM = FHDEV (DEV_TCP_MAJOR, 121),
FH_DGRAM = FHDEV (DEV_TCP_MAJOR, 122),
- FH_BAD = FHDEV (0, 0)
+ FH_NADA = FHDEV (0, 0),
+ FH_ERROR = FHDEV (255, 255) /* Set by fh constructor when error detected */
};
struct device
@@ -348,7 +349,11 @@ extern const device dev_fs_storage;
#define isvirtual_dev(devn) \
(isproc_dev (devn) || devn == FH_CYGDRIVE || devn == FH_NETDRIVE)
-#define iscons_dev(n) (device::major (n) == DEV_CONS_MAJOR)
+#define iscons_dev(n) \
+ ((device::major ((int) (n)) == DEV_CONS_MAJOR) \
+ || (((int) n) == FH_CONSOLE) \
+ || (((int) n) == FH_CONIN) \
+ || (((int) n) == FH_CONOUT))
#define istty_slave_dev(n) (device::major (n) == DEV_TTYS_MAJOR)
#endif /*_DEVICES_H*/