Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2012-03-31 21:38:00 +0400
committerChristopher Faylor <me@cgf.cx>2012-03-31 21:38:00 +0400
commit1c1294b4ce46055413bc7cea6450c96425b9c562 (patch)
treedd9c126fb8a2ef0246f611b4e7c391365a2defa7 /winsup/cygwin
parent54440304b397a5d3f4b19415c09a5939a9074c37 (diff)
(Interim checkin while we work on this)
* devices.cc: Regenerate. * devices.h (device::noexpose): New field. (device::dev_on_fs): Make a bit field. (get_major): Use proper type for declaration. (expose): New field. (ext_dev_storage): Delete declaration. (dev_storage_size): Ditto. (dev_storage): New declaration. (dev_storage_end): Ditto. * devices.in: Mark /dev/ptym*, /dev/com*, /dev/pipe, /dev/fifo, and "/dev" as "no expose". * fhandler.h (fhandler_dev::lastrealpos): Delete declaration. (fhandler_dev::devidx): Declare new field. * fhandler_disk_file.cc: Move fhandler_dev functions into fhandler_dev.cc. * fhandler_dev.cc: Add includes needed for functions moved from fhandler_disk_file.cc. (dev_storage_scan_start): Define place to start listing devices. (dev_storage_size): Define size of array to scan. (fhandler_dev::fhandler_dev): Move here from fhandler_disk_file.cc. (fhandler_dev::opendir): Ditto. (fhandler_dev::readdir): Just check devidx for non-NULL to determine when to go to disk for /dev content. Use dev_storage rather than ext_dev_storage. Iterate over dev_storage using devidx pointer. Use accessor functions rather than raw references to the device struct. Only increment dir->__d_position when we are actually going to be returning something. Add debug_printf for exit. (fhandler_dev::rewinddir): Set devidx as appropriate depending on whether there's a /dev on disk or not. * gendevices: Don't mark dev_storage static but do put it in the _RDATA section. * path.cc (path_conv::check): Use new "device::expose()" function to decide to forbid programs from referencing internal device types.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/ChangeLog36
-rw-r--r--winsup/cygwin/devices.cc169
-rw-r--r--winsup/cygwin/devices.h10
-rw-r--r--winsup/cygwin/devices.in11
-rw-r--r--winsup/cygwin/fhandler.h2
-rw-r--r--winsup/cygwin/fhandler_dev.cc306
-rw-r--r--winsup/cygwin/fhandler_disk_file.cc60
-rwxr-xr-xwinsup/cygwin/gendevices2
-rw-r--r--winsup/cygwin/path.cc6
9 files changed, 317 insertions, 285 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 84110b2e2..7aaca72c9 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,39 @@
+2012-03-30 Christopher Faylor <me.cygwin2012@cgf.cx>
+
+ * devices.cc: Regenerate.
+ * devices.h (device::noexpose): New field.
+ (device::dev_on_fs): Make a bit field.
+ (get_major): Use proper type for declaration.
+ (expose): New field.
+ (ext_dev_storage): Delete declaration.
+ (dev_storage_size): Ditto.
+ (dev_storage): New declaration.
+ (dev_storage_end): Ditto.
+ * devices.in: Mark /dev/ptym*, /dev/com*, /dev/pipe, /dev/fifo, and
+ "/dev" as "no expose".
+ * fhandler.h (fhandler_dev::lastrealpos): Delete declaration.
+ (fhandler_dev::devidx): Declare new field.
+ * fhandler_disk_file.cc: Move fhandler_dev functions into
+ fhandler_dev.cc.
+ * fhandler_dev.cc: Add includes needed for functions moved from
+ fhandler_disk_file.cc.
+ (dev_storage_scan_start): Define place to start listing devices.
+ (dev_storage_size): Define size of array to scan.
+ (fhandler_dev::fhandler_dev): Move here from fhandler_disk_file.cc.
+ (fhandler_dev::opendir): Ditto.
+ (fhandler_dev::readdir): Just check devidx for non-NULL to determine
+ when to go to disk for /dev content. Use dev_storage rather than
+ ext_dev_storage. Iterate over dev_storage using devidx pointer. Use
+ accessor functions rather than raw references to the device struct.
+ Only increment dir->__d_position when we are actually going to be
+ returning something. Add debug_printf for exit.
+ (fhandler_dev::rewinddir): Set devidx as appropriate depending on
+ whether there's a /dev on disk or not.
+ * gendevices: Don't mark dev_storage static but do put it in the _RDATA
+ section.
+ * path.cc (path_conv::check): Use new "device::expose()" function to
+ decide to forbid programs from referencing internal device types.
+
2012-03-30 Corinna Vinschen <corinna@vinschen.de>
* posix.sgml (std-notes): Change description of flock restrictions.
diff --git a/winsup/cygwin/devices.cc b/winsup/cygwin/devices.cc
index bfd4bcf89..372fdd178 100644
--- a/winsup/cygwin/devices.cc
+++ b/winsup/cygwin/devices.cc
@@ -64,26 +64,26 @@ const device dev_error_storage =
{"", {FH_ERROR}, ""};
#define BRACK(x) {devn_int: x}
-static const device dev_storage[] =
+const _RDATA device dev_storage[] =
{
{"/dev", BRACK(FH_DEV), "/dev"},
{"/dev/clipboard", BRACK(FH_CLIPBOARD), "/dev/clipboard"},
- {"/dev/com1", BRACK(FHDEV(DEV_SERIAL_MAJOR, 0)), "\\??\\COM1"},
- {"/dev/com2", BRACK(FHDEV(DEV_SERIAL_MAJOR, 1)), "\\??\\COM2"},
- {"/dev/com3", BRACK(FHDEV(DEV_SERIAL_MAJOR, 2)), "\\??\\COM3"},
- {"/dev/com4", BRACK(FHDEV(DEV_SERIAL_MAJOR, 3)), "\\??\\COM4"},
- {"/dev/com5", BRACK(FHDEV(DEV_SERIAL_MAJOR, 4)), "\\??\\COM5"},
- {"/dev/com6", BRACK(FHDEV(DEV_SERIAL_MAJOR, 5)), "\\??\\COM6"},
- {"/dev/com7", BRACK(FHDEV(DEV_SERIAL_MAJOR, 6)), "\\??\\COM7"},
- {"/dev/com8", BRACK(FHDEV(DEV_SERIAL_MAJOR, 7)), "\\??\\COM8"},
- {"/dev/com9", BRACK(FHDEV(DEV_SERIAL_MAJOR, 8)), "\\??\\COM9"},
- {"/dev/com10", BRACK(FHDEV(DEV_SERIAL_MAJOR, 9)), "\\??\\COM10"},
- {"/dev/com11", BRACK(FHDEV(DEV_SERIAL_MAJOR, 10)), "\\??\\COM11"},
- {"/dev/com12", BRACK(FHDEV(DEV_SERIAL_MAJOR, 11)), "\\??\\COM12"},
- {"/dev/com13", BRACK(FHDEV(DEV_SERIAL_MAJOR, 12)), "\\??\\COM13"},
- {"/dev/com14", BRACK(FHDEV(DEV_SERIAL_MAJOR, 13)), "\\??\\COM14"},
- {"/dev/com15", BRACK(FHDEV(DEV_SERIAL_MAJOR, 14)), "\\??\\COM15"},
- {"/dev/com16", BRACK(FHDEV(DEV_SERIAL_MAJOR, 15)), "\\??\\COM16"},
+ {"/dev/com1", BRACK(FHDEV(DEV_SERIAL_MAJOR, 0)), "\\??\\COM1", true},
+ {"/dev/com2", BRACK(FHDEV(DEV_SERIAL_MAJOR, 1)), "\\??\\COM2", true},
+ {"/dev/com3", BRACK(FHDEV(DEV_SERIAL_MAJOR, 2)), "\\??\\COM3", true},
+ {"/dev/com4", BRACK(FHDEV(DEV_SERIAL_MAJOR, 3)), "\\??\\COM4", true},
+ {"/dev/com5", BRACK(FHDEV(DEV_SERIAL_MAJOR, 4)), "\\??\\COM5", true},
+ {"/dev/com6", BRACK(FHDEV(DEV_SERIAL_MAJOR, 5)), "\\??\\COM6", true},
+ {"/dev/com7", BRACK(FHDEV(DEV_SERIAL_MAJOR, 6)), "\\??\\COM7", true},
+ {"/dev/com8", BRACK(FHDEV(DEV_SERIAL_MAJOR, 7)), "\\??\\COM8", true},
+ {"/dev/com9", BRACK(FHDEV(DEV_SERIAL_MAJOR, 8)), "\\??\\COM9", true},
+ {"/dev/com10", BRACK(FHDEV(DEV_SERIAL_MAJOR, 9)), "\\??\\COM10", true},
+ {"/dev/com11", BRACK(FHDEV(DEV_SERIAL_MAJOR, 10)), "\\??\\COM11", true},
+ {"/dev/com12", BRACK(FHDEV(DEV_SERIAL_MAJOR, 11)), "\\??\\COM12", true},
+ {"/dev/com13", BRACK(FHDEV(DEV_SERIAL_MAJOR, 12)), "\\??\\COM13", true},
+ {"/dev/com14", BRACK(FHDEV(DEV_SERIAL_MAJOR, 13)), "\\??\\COM14", true},
+ {"/dev/com15", BRACK(FHDEV(DEV_SERIAL_MAJOR, 14)), "\\??\\COM15", true},
+ {"/dev/com16", BRACK(FHDEV(DEV_SERIAL_MAJOR, 15)), "\\??\\COM16", true},
{"/dev/conin", BRACK(FH_CONIN), "/dev/conin"},
{"/dev/conout", BRACK(FH_CONOUT), "/dev/conout"},
{"/dev/cons0", BRACK(FHDEV(DEV_CONS_MAJOR, 0)), "/dev/cons0"},
@@ -168,7 +168,7 @@ static const device dev_storage[] =
{"/dev/fd13", BRACK(FHDEV(DEV_FLOPPY_MAJOR, 13)), "\\Device\\Floppy13"},
{"/dev/fd14", BRACK(FHDEV(DEV_FLOPPY_MAJOR, 14)), "\\Device\\Floppy14"},
{"/dev/fd15", BRACK(FHDEV(DEV_FLOPPY_MAJOR, 15)), "\\Device\\Floppy15"},
- {"/dev/fifo", BRACK(FH_FIFO), "/dev/fifo"},
+ {"/dev/fifo", BRACK(FH_FIFO), "/dev/fifo", true},
{"/dev/full", BRACK(FH_FULL), "/dev/full"},
{"/dev/kmem", BRACK(FH_KMEM), "/dev/mem"},
{"/dev/kmsg", BRACK(FH_KMSG), "\\Device\\MailSlot\\cygwin\\dev\\kmsg"},
@@ -302,7 +302,7 @@ static const device dev_storage[] =
{"/dev/nst126", BRACK(FHDEV(DEV_TAPE_MAJOR, 254)), "\\Device\\Tape126"},
{"/dev/nst127", BRACK(FHDEV(DEV_TAPE_MAJOR, 255)), "\\Device\\Tape127"},
{"/dev/null", BRACK(FH_NULL), "\\Device\\Null"},
- {"/dev/pipe", BRACK(FH_PIPE), "/dev/pipe"},
+ {"/dev/pipe", BRACK(FH_PIPE), "/dev/pipe", true},
{"/dev/port", BRACK(FH_PORT), "/dev/port"},
{"/dev/ptmx", BRACK(FH_PTMX), "/dev/ptmx"},
{"/dev/pty0", BRACK(FHDEV(DEV_PTYS_MAJOR, 0)), "/dev/pty0"},
@@ -369,70 +369,70 @@ static const device dev_storage[] =
{"/dev/pty61", BRACK(FHDEV(DEV_PTYS_MAJOR, 61)), "/dev/pty61"},
{"/dev/pty62", BRACK(FHDEV(DEV_PTYS_MAJOR, 62)), "/dev/pty62"},
{"/dev/pty63", BRACK(FHDEV(DEV_PTYS_MAJOR, 63)), "/dev/pty63"},
- {"/dev/ptym0", BRACK(FHDEV(DEV_PTYM_MAJOR, 0)), "/dev/ptym0"},
- {"/dev/ptym1", BRACK(FHDEV(DEV_PTYM_MAJOR, 1)), "/dev/ptym1"},
- {"/dev/ptym2", BRACK(FHDEV(DEV_PTYM_MAJOR, 2)), "/dev/ptym2"},
- {"/dev/ptym3", BRACK(FHDEV(DEV_PTYM_MAJOR, 3)), "/dev/ptym3"},
- {"/dev/ptym4", BRACK(FHDEV(DEV_PTYM_MAJOR, 4)), "/dev/ptym4"},
- {"/dev/ptym5", BRACK(FHDEV(DEV_PTYM_MAJOR, 5)), "/dev/ptym5"},
- {"/dev/ptym6", BRACK(FHDEV(DEV_PTYM_MAJOR, 6)), "/dev/ptym6"},
- {"/dev/ptym7", BRACK(FHDEV(DEV_PTYM_MAJOR, 7)), "/dev/ptym7"},
- {"/dev/ptym8", BRACK(FHDEV(DEV_PTYM_MAJOR, 8)), "/dev/ptym8"},
- {"/dev/ptym9", BRACK(FHDEV(DEV_PTYM_MAJOR, 9)), "/dev/ptym9"},
- {"/dev/ptym10", BRACK(FHDEV(DEV_PTYM_MAJOR, 10)), "/dev/ptym10"},
- {"/dev/ptym11", BRACK(FHDEV(DEV_PTYM_MAJOR, 11)), "/dev/ptym11"},
- {"/dev/ptym12", BRACK(FHDEV(DEV_PTYM_MAJOR, 12)), "/dev/ptym12"},
- {"/dev/ptym13", BRACK(FHDEV(DEV_PTYM_MAJOR, 13)), "/dev/ptym13"},
- {"/dev/ptym14", BRACK(FHDEV(DEV_PTYM_MAJOR, 14)), "/dev/ptym14"},
- {"/dev/ptym15", BRACK(FHDEV(DEV_PTYM_MAJOR, 15)), "/dev/ptym15"},
- {"/dev/ptym16", BRACK(FHDEV(DEV_PTYM_MAJOR, 16)), "/dev/ptym16"},
- {"/dev/ptym17", BRACK(FHDEV(DEV_PTYM_MAJOR, 17)), "/dev/ptym17"},
- {"/dev/ptym18", BRACK(FHDEV(DEV_PTYM_MAJOR, 18)), "/dev/ptym18"},
- {"/dev/ptym19", BRACK(FHDEV(DEV_PTYM_MAJOR, 19)), "/dev/ptym19"},
- {"/dev/ptym20", BRACK(FHDEV(DEV_PTYM_MAJOR, 20)), "/dev/ptym20"},
- {"/dev/ptym21", BRACK(FHDEV(DEV_PTYM_MAJOR, 21)), "/dev/ptym21"},
- {"/dev/ptym22", BRACK(FHDEV(DEV_PTYM_MAJOR, 22)), "/dev/ptym22"},
- {"/dev/ptym23", BRACK(FHDEV(DEV_PTYM_MAJOR, 23)), "/dev/ptym23"},
- {"/dev/ptym24", BRACK(FHDEV(DEV_PTYM_MAJOR, 24)), "/dev/ptym24"},
- {"/dev/ptym25", BRACK(FHDEV(DEV_PTYM_MAJOR, 25)), "/dev/ptym25"},
- {"/dev/ptym26", BRACK(FHDEV(DEV_PTYM_MAJOR, 26)), "/dev/ptym26"},
- {"/dev/ptym27", BRACK(FHDEV(DEV_PTYM_MAJOR, 27)), "/dev/ptym27"},
- {"/dev/ptym28", BRACK(FHDEV(DEV_PTYM_MAJOR, 28)), "/dev/ptym28"},
- {"/dev/ptym29", BRACK(FHDEV(DEV_PTYM_MAJOR, 29)), "/dev/ptym29"},
- {"/dev/ptym30", BRACK(FHDEV(DEV_PTYM_MAJOR, 30)), "/dev/ptym30"},
- {"/dev/ptym31", BRACK(FHDEV(DEV_PTYM_MAJOR, 31)), "/dev/ptym31"},
- {"/dev/ptym32", BRACK(FHDEV(DEV_PTYM_MAJOR, 32)), "/dev/ptym32"},
- {"/dev/ptym33", BRACK(FHDEV(DEV_PTYM_MAJOR, 33)), "/dev/ptym33"},
- {"/dev/ptym34", BRACK(FHDEV(DEV_PTYM_MAJOR, 34)), "/dev/ptym34"},
- {"/dev/ptym35", BRACK(FHDEV(DEV_PTYM_MAJOR, 35)), "/dev/ptym35"},
- {"/dev/ptym36", BRACK(FHDEV(DEV_PTYM_MAJOR, 36)), "/dev/ptym36"},
- {"/dev/ptym37", BRACK(FHDEV(DEV_PTYM_MAJOR, 37)), "/dev/ptym37"},
- {"/dev/ptym38", BRACK(FHDEV(DEV_PTYM_MAJOR, 38)), "/dev/ptym38"},
- {"/dev/ptym39", BRACK(FHDEV(DEV_PTYM_MAJOR, 39)), "/dev/ptym39"},
- {"/dev/ptym40", BRACK(FHDEV(DEV_PTYM_MAJOR, 40)), "/dev/ptym40"},
- {"/dev/ptym41", BRACK(FHDEV(DEV_PTYM_MAJOR, 41)), "/dev/ptym41"},
- {"/dev/ptym42", BRACK(FHDEV(DEV_PTYM_MAJOR, 42)), "/dev/ptym42"},
- {"/dev/ptym43", BRACK(FHDEV(DEV_PTYM_MAJOR, 43)), "/dev/ptym43"},
- {"/dev/ptym44", BRACK(FHDEV(DEV_PTYM_MAJOR, 44)), "/dev/ptym44"},
- {"/dev/ptym45", BRACK(FHDEV(DEV_PTYM_MAJOR, 45)), "/dev/ptym45"},
- {"/dev/ptym46", BRACK(FHDEV(DEV_PTYM_MAJOR, 46)), "/dev/ptym46"},
- {"/dev/ptym47", BRACK(FHDEV(DEV_PTYM_MAJOR, 47)), "/dev/ptym47"},
- {"/dev/ptym48", BRACK(FHDEV(DEV_PTYM_MAJOR, 48)), "/dev/ptym48"},
- {"/dev/ptym49", BRACK(FHDEV(DEV_PTYM_MAJOR, 49)), "/dev/ptym49"},
- {"/dev/ptym50", BRACK(FHDEV(DEV_PTYM_MAJOR, 50)), "/dev/ptym50"},
- {"/dev/ptym51", BRACK(FHDEV(DEV_PTYM_MAJOR, 51)), "/dev/ptym51"},
- {"/dev/ptym52", BRACK(FHDEV(DEV_PTYM_MAJOR, 52)), "/dev/ptym52"},
- {"/dev/ptym53", BRACK(FHDEV(DEV_PTYM_MAJOR, 53)), "/dev/ptym53"},
- {"/dev/ptym54", BRACK(FHDEV(DEV_PTYM_MAJOR, 54)), "/dev/ptym54"},
- {"/dev/ptym55", BRACK(FHDEV(DEV_PTYM_MAJOR, 55)), "/dev/ptym55"},
- {"/dev/ptym56", BRACK(FHDEV(DEV_PTYM_MAJOR, 56)), "/dev/ptym56"},
- {"/dev/ptym57", BRACK(FHDEV(DEV_PTYM_MAJOR, 57)), "/dev/ptym57"},
- {"/dev/ptym58", BRACK(FHDEV(DEV_PTYM_MAJOR, 58)), "/dev/ptym58"},
- {"/dev/ptym59", BRACK(FHDEV(DEV_PTYM_MAJOR, 59)), "/dev/ptym59"},
- {"/dev/ptym60", BRACK(FHDEV(DEV_PTYM_MAJOR, 60)), "/dev/ptym60"},
- {"/dev/ptym61", BRACK(FHDEV(DEV_PTYM_MAJOR, 61)), "/dev/ptym61"},
- {"/dev/ptym62", BRACK(FHDEV(DEV_PTYM_MAJOR, 62)), "/dev/ptym62"},
- {"/dev/ptym63", BRACK(FHDEV(DEV_PTYM_MAJOR, 63)), "/dev/ptym63"},
+ {"/dev/ptym0", BRACK(FHDEV(DEV_PTYM_MAJOR, 0)), "/dev/ptym0", true},
+ {"/dev/ptym1", BRACK(FHDEV(DEV_PTYM_MAJOR, 1)), "/dev/ptym1", true},
+ {"/dev/ptym2", BRACK(FHDEV(DEV_PTYM_MAJOR, 2)), "/dev/ptym2", true},
+ {"/dev/ptym3", BRACK(FHDEV(DEV_PTYM_MAJOR, 3)), "/dev/ptym3", true},
+ {"/dev/ptym4", BRACK(FHDEV(DEV_PTYM_MAJOR, 4)), "/dev/ptym4", true},
+ {"/dev/ptym5", BRACK(FHDEV(DEV_PTYM_MAJOR, 5)), "/dev/ptym5", true},
+ {"/dev/ptym6", BRACK(FHDEV(DEV_PTYM_MAJOR, 6)), "/dev/ptym6", true},
+ {"/dev/ptym7", BRACK(FHDEV(DEV_PTYM_MAJOR, 7)), "/dev/ptym7", true},
+ {"/dev/ptym8", BRACK(FHDEV(DEV_PTYM_MAJOR, 8)), "/dev/ptym8", true},
+ {"/dev/ptym9", BRACK(FHDEV(DEV_PTYM_MAJOR, 9)), "/dev/ptym9", true},
+ {"/dev/ptym10", BRACK(FHDEV(DEV_PTYM_MAJOR, 10)), "/dev/ptym10", true},
+ {"/dev/ptym11", BRACK(FHDEV(DEV_PTYM_MAJOR, 11)), "/dev/ptym11", true},
+ {"/dev/ptym12", BRACK(FHDEV(DEV_PTYM_MAJOR, 12)), "/dev/ptym12", true},
+ {"/dev/ptym13", BRACK(FHDEV(DEV_PTYM_MAJOR, 13)), "/dev/ptym13", true},
+ {"/dev/ptym14", BRACK(FHDEV(DEV_PTYM_MAJOR, 14)), "/dev/ptym14", true},
+ {"/dev/ptym15", BRACK(FHDEV(DEV_PTYM_MAJOR, 15)), "/dev/ptym15", true},
+ {"/dev/ptym16", BRACK(FHDEV(DEV_PTYM_MAJOR, 16)), "/dev/ptym16", true},
+ {"/dev/ptym17", BRACK(FHDEV(DEV_PTYM_MAJOR, 17)), "/dev/ptym17", true},
+ {"/dev/ptym18", BRACK(FHDEV(DEV_PTYM_MAJOR, 18)), "/dev/ptym18", true},
+ {"/dev/ptym19", BRACK(FHDEV(DEV_PTYM_MAJOR, 19)), "/dev/ptym19", true},
+ {"/dev/ptym20", BRACK(FHDEV(DEV_PTYM_MAJOR, 20)), "/dev/ptym20", true},
+ {"/dev/ptym21", BRACK(FHDEV(DEV_PTYM_MAJOR, 21)), "/dev/ptym21", true},
+ {"/dev/ptym22", BRACK(FHDEV(DEV_PTYM_MAJOR, 22)), "/dev/ptym22", true},
+ {"/dev/ptym23", BRACK(FHDEV(DEV_PTYM_MAJOR, 23)), "/dev/ptym23", true},
+ {"/dev/ptym24", BRACK(FHDEV(DEV_PTYM_MAJOR, 24)), "/dev/ptym24", true},
+ {"/dev/ptym25", BRACK(FHDEV(DEV_PTYM_MAJOR, 25)), "/dev/ptym25", true},
+ {"/dev/ptym26", BRACK(FHDEV(DEV_PTYM_MAJOR, 26)), "/dev/ptym26", true},
+ {"/dev/ptym27", BRACK(FHDEV(DEV_PTYM_MAJOR, 27)), "/dev/ptym27", true},
+ {"/dev/ptym28", BRACK(FHDEV(DEV_PTYM_MAJOR, 28)), "/dev/ptym28", true},
+ {"/dev/ptym29", BRACK(FHDEV(DEV_PTYM_MAJOR, 29)), "/dev/ptym29", true},
+ {"/dev/ptym30", BRACK(FHDEV(DEV_PTYM_MAJOR, 30)), "/dev/ptym30", true},
+ {"/dev/ptym31", BRACK(FHDEV(DEV_PTYM_MAJOR, 31)), "/dev/ptym31", true},
+ {"/dev/ptym32", BRACK(FHDEV(DEV_PTYM_MAJOR, 32)), "/dev/ptym32", true},
+ {"/dev/ptym33", BRACK(FHDEV(DEV_PTYM_MAJOR, 33)), "/dev/ptym33", true},
+ {"/dev/ptym34", BRACK(FHDEV(DEV_PTYM_MAJOR, 34)), "/dev/ptym34", true},
+ {"/dev/ptym35", BRACK(FHDEV(DEV_PTYM_MAJOR, 35)), "/dev/ptym35", true},
+ {"/dev/ptym36", BRACK(FHDEV(DEV_PTYM_MAJOR, 36)), "/dev/ptym36", true},
+ {"/dev/ptym37", BRACK(FHDEV(DEV_PTYM_MAJOR, 37)), "/dev/ptym37", true},
+ {"/dev/ptym38", BRACK(FHDEV(DEV_PTYM_MAJOR, 38)), "/dev/ptym38", true},
+ {"/dev/ptym39", BRACK(FHDEV(DEV_PTYM_MAJOR, 39)), "/dev/ptym39", true},
+ {"/dev/ptym40", BRACK(FHDEV(DEV_PTYM_MAJOR, 40)), "/dev/ptym40", true},
+ {"/dev/ptym41", BRACK(FHDEV(DEV_PTYM_MAJOR, 41)), "/dev/ptym41", true},
+ {"/dev/ptym42", BRACK(FHDEV(DEV_PTYM_MAJOR, 42)), "/dev/ptym42", true},
+ {"/dev/ptym43", BRACK(FHDEV(DEV_PTYM_MAJOR, 43)), "/dev/ptym43", true},
+ {"/dev/ptym44", BRACK(FHDEV(DEV_PTYM_MAJOR, 44)), "/dev/ptym44", true},
+ {"/dev/ptym45", BRACK(FHDEV(DEV_PTYM_MAJOR, 45)), "/dev/ptym45", true},
+ {"/dev/ptym46", BRACK(FHDEV(DEV_PTYM_MAJOR, 46)), "/dev/ptym46", true},
+ {"/dev/ptym47", BRACK(FHDEV(DEV_PTYM_MAJOR, 47)), "/dev/ptym47", true},
+ {"/dev/ptym48", BRACK(FHDEV(DEV_PTYM_MAJOR, 48)), "/dev/ptym48", true},
+ {"/dev/ptym49", BRACK(FHDEV(DEV_PTYM_MAJOR, 49)), "/dev/ptym49", true},
+ {"/dev/ptym50", BRACK(FHDEV(DEV_PTYM_MAJOR, 50)), "/dev/ptym50", true},
+ {"/dev/ptym51", BRACK(FHDEV(DEV_PTYM_MAJOR, 51)), "/dev/ptym51", true},
+ {"/dev/ptym52", BRACK(FHDEV(DEV_PTYM_MAJOR, 52)), "/dev/ptym52", true},
+ {"/dev/ptym53", BRACK(FHDEV(DEV_PTYM_MAJOR, 53)), "/dev/ptym53", true},
+ {"/dev/ptym54", BRACK(FHDEV(DEV_PTYM_MAJOR, 54)), "/dev/ptym54", true},
+ {"/dev/ptym55", BRACK(FHDEV(DEV_PTYM_MAJOR, 55)), "/dev/ptym55", true},
+ {"/dev/ptym56", BRACK(FHDEV(DEV_PTYM_MAJOR, 56)), "/dev/ptym56", true},
+ {"/dev/ptym57", BRACK(FHDEV(DEV_PTYM_MAJOR, 57)), "/dev/ptym57", true},
+ {"/dev/ptym58", BRACK(FHDEV(DEV_PTYM_MAJOR, 58)), "/dev/ptym58", true},
+ {"/dev/ptym59", BRACK(FHDEV(DEV_PTYM_MAJOR, 59)), "/dev/ptym59", true},
+ {"/dev/ptym60", BRACK(FHDEV(DEV_PTYM_MAJOR, 60)), "/dev/ptym60", true},
+ {"/dev/ptym61", BRACK(FHDEV(DEV_PTYM_MAJOR, 61)), "/dev/ptym61", true},
+ {"/dev/ptym62", BRACK(FHDEV(DEV_PTYM_MAJOR, 62)), "/dev/ptym62", true},
+ {"/dev/ptym63", BRACK(FHDEV(DEV_PTYM_MAJOR, 63)), "/dev/ptym63", true},
{"/dev/random", BRACK(FH_RANDOM), "/dev/random"},
{"/dev/scd0", BRACK(FHDEV(DEV_CDROM_MAJOR, 0)), "\\Device\\CdRom0"},
{"/dev/scd1", BRACK(FHDEV(DEV_CDROM_MAJOR, 1)), "\\Device\\CdRom1"},
@@ -46530,8 +46530,7 @@ return NULL;
#undef BRACK
-const device *ext_dev_storage = dev_storage;
-const size_t dev_storage_size = sizeof dev_storage / sizeof dev_storage[0];
+const device *dev_storage_end = dev_storage + (sizeof dev_storage / sizeof dev_storage[0]);
void
device::parse (const char *s)
diff --git a/winsup/cygwin/devices.h b/winsup/cygwin/devices.h
index 5b452ba1b..57bf2eb59 100644
--- a/winsup/cygwin/devices.h
+++ b/winsup/cygwin/devices.h
@@ -275,8 +275,9 @@ struct device
};
} d;
const char *native;
+ bool noexpose:1;
+ bool dev_on_fs:1;
_mode_t mode;
- bool dev_on_fs;
static const device *lookup (const char *, unsigned int = UINT32_MAX);
void parse (const char *);
void parse (_major_t major, _minor_t minor);
@@ -308,8 +309,9 @@ struct device
bool not_device (_dev_t n) const {return d.devn && n != d.devn; }
_minor_t get_minor () const {return d.minor;}
- _minor_t get_major () const {return d.major;}
+ _major_t get_major () const {return d.major;}
+ inline bool expose () const {return !noexpose;}
inline operator int& () {return d.devn_int;}
inline operator fh_devices () {return d.devn_fh_devices;}
inline operator bool () {return !!d.devn_int;}
@@ -320,8 +322,8 @@ struct device
inline bool is_fs_special () const {return dev_on_fs && d.devn != FH_FS;}
};
-extern const device *ext_dev_storage;
-extern const size_t dev_storage_size;
+extern const device dev_storage[];
+extern const device *dev_storage_end;
extern const device *console_dev;
extern const device *ptmx_dev;
diff --git a/winsup/cygwin/devices.in b/winsup/cygwin/devices.in
index 553478413..40d32b022 100644
--- a/winsup/cygwin/devices.in
+++ b/winsup/cygwin/devices.in
@@ -65,7 +65,7 @@ const device dev_error_storage =
%%
"/dev/tty", BRACK(FH_TTY), "/dev/tty"
"/dev/pty%(0-63)d", BRACK(FHDEV(DEV_PTYS_MAJOR, {$1})), "/dev/pty{$1}", ptys_dev
-"/dev/ptym%(0-63)d", BRACK(FHDEV(DEV_PTYM_MAJOR, {$1})), "/dev/ptym{$1}", ptym_dev
+"/dev/ptym%(0-63)d", BRACK(FHDEV(DEV_PTYM_MAJOR, {$1})), "/dev/ptym{$1}", true, ptym_dev
"/dev/cons%(0-63)d", BRACK(FHDEV(DEV_CONS_MAJOR, {$1})), "/dev/cons{$1}", cons_dev
"/dev/console", BRACK(FH_CONSOLE), "/dev/console", console_dev
"/dev/ptmx", BRACK(FH_PTMX), "/dev/ptmx"
@@ -82,10 +82,10 @@ const device dev_error_storage =
"/dev/kmem", BRACK(FH_KMEM), "/dev/mem"
"/dev/clipboard", BRACK(FH_CLIPBOARD), "/dev/clipboard"
"/dev/port", BRACK(FH_PORT), "/dev/port"
-"/dev/com%(1-16)d", BRACK(FHDEV(DEV_SERIAL_MAJOR, {$1 - 1})), "\\??\\COM{$1}"
+"/dev/com%(1-16)d", BRACK(FHDEV(DEV_SERIAL_MAJOR, {$1 - 1})), "\\??\\COM{$1}", true
"/dev/ttyS%(0-63)d", BRACK(FHDEV(DEV_SERIAL_MAJOR, {$1})), "\\??\\COM{$1 + 1}"
-"/dev/pipe", BRACK(FH_PIPE), "/dev/pipe"
-"/dev/fifo", BRACK(FH_FIFO), "/dev/fifo"
+"/dev/pipe", BRACK(FH_PIPE), "/dev/pipe", true
+"/dev/fifo", BRACK(FH_FIFO), "/dev/fifo", true
"/dev/st%(0-127)d", BRACK(FHDEV(DEV_TAPE_MAJOR, {$1})), "\\Device\\Tape{$1}"
"/dev/nst%(0-127)d", BRACK(FHDEV(DEV_TAPE_MAJOR, {$1 + 128})), "\\Device\\Tape{$1}"
"/dev/fd%(0-15)d", BRACK(FHDEV(DEV_FLOPPY_MAJOR, {$1})), "\\Device\\Floppy{$1}"
@@ -107,8 +107,7 @@ const device dev_error_storage =
%%
#undef BRACK
-const device *ext_dev_storage = dev_storage;
-const size_t dev_storage_size = sizeof dev_storage / sizeof dev_storage[0];
+const device *dev_storage_end = dev_storage + (sizeof dev_storage / sizeof dev_storage[0]);
void
device::parse (const char *s)
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index 4cdf81e86..81e33569a 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -1018,7 +1018,7 @@ class fhandler_disk_file: public fhandler_base
class fhandler_dev: public fhandler_disk_file
{
- int lastrealpos;
+ const struct device *devidx;
bool dir_exists;
public:
fhandler_dev ();
diff --git a/winsup/cygwin/fhandler_dev.cc b/winsup/cygwin/fhandler_dev.cc
index 27b1ef321..713e8c0fb 100644
--- a/winsup/cygwin/fhandler_dev.cc
+++ b/winsup/cygwin/fhandler_dev.cc
@@ -14,12 +14,16 @@ details. */
#include "fhandler.h"
#include "shared_info.h"
#include "ntdll.h"
+#include "dtable.h"
+#include "cygheap.h"
#include "devices.h"
#define _COMPILING_NEWLIB
#include <dirent.h>
#define dev_prefix_len (sizeof ("/dev"))
+#define dev_storage_scan_start (dev_storage + 1)
+#define dev_storage_size (dev_storage_end - dev_storage_scan_start)
static int
device_cmp (const void *a, const void *b)
@@ -28,13 +32,73 @@ device_cmp (const void *a, const void *b)
((const device *) b)->name + dev_prefix_len);
}
+fhandler_dev::fhandler_dev () :
+ fhandler_disk_file (), devidx (NULL), dir_exists (true)
+{
+}
+
+DIR *
+fhandler_dev::opendir (int fd)
+{
+ DIR *dir;
+ DIR *res = NULL;
+
+ dir = fhandler_disk_file::opendir (fd);
+ if (dir)
+ return dir;
+ if ((dir = (DIR *) malloc (sizeof (DIR))) == NULL)
+ set_errno (ENOMEM);
+ else if ((dir->__d_dirent =
+ (struct dirent *) malloc (sizeof (struct dirent))) == NULL)
+ {
+ set_errno (ENOMEM);
+ goto free_dir;
+ }
+ else
+ {
+ cygheap_fdnew cfd;
+ if (cfd < 0 && fd < 0)
+ goto free_dirent;
+
+ dir->__d_dirname = NULL;
+ dir->__d_dirent->__d_version = __DIRENT_VERSION;
+ dir->__d_cookie = __DIRENT_COOKIE;
+ dir->__handle = INVALID_HANDLE_VALUE;
+ dir->__d_position = 0;
+ dir->__flags = 0;
+ dir->__d_internal = 0;
+
+ if (fd >= 0)
+ dir->__d_fd = fd;
+ else
+ {
+ cfd = this;
+ dir->__d_fd = cfd;
+ cfd->nohandle (true);
+ }
+ set_close_on_exec (true);
+ dir->__fh = this;
+ devidx = dev_storage_scan_start;
+ res = dir;
+ }
+
+ syscall_printf ("%p = opendir (%s)", res, get_name ());
+ return res;
+
+free_dirent:
+ free (dir->__d_dirent);
+free_dir:
+ free (dir);
+ return res;
+}
+
int
fhandler_dev::readdir (DIR *dir, dirent *de)
{
int ret;
device dev;
- if (dir_exists && !lastrealpos)
+ if (!devidx)
{
while ((ret = fhandler_disk_file::readdir (dir, de)) == 0)
{
@@ -42,153 +106,139 @@ fhandler_dev::readdir (DIR *dir, dirent *de)
/dev already, for instance by using the old script from Igor
Peshansky. */
dev.name = de->d_name;
- if (!bsearch (&dev, ext_dev_storage, dev_storage_size, sizeof dev,
- device_cmp))
+ if (!bsearch (&dev, dev_storage_scan_start, dev_storage_size, sizeof dev,
+ device_cmp))
break;
}
if (ret == ENMFILE)
- lastrealpos = dir->__d_position;
+ devidx = dev_storage_scan_start;
+ else
+ goto out;
}
- if (!dir_exists || lastrealpos)
+
+ /* Now start processing our internal dev table. */
+ ret = ENMFILE;
+ while (devidx < dev_storage_end)
{
- ret = ENMFILE;
- for (size_t idx = dir->__d_position - lastrealpos + 1;
- idx < dev_storage_size;
- ++idx)
+ const device& thisdev = *devidx++;
+ if (!thisdev.expose ())
+ continue;
+ int devn = *const_cast<device *> (&thisdev);
+ /* Exclude devices which are only available for internal purposes
+ and devices which are not really existing at this time. */
+ switch (thisdev.get_major ())
{
- ++dir->__d_position;
- /* Exclude devices which are only available for internal purposes
- and devices which are not really existing at this time. */
- switch (ext_dev_storage[idx].d.major)
+ case DEV_PTYS_MAJOR:
+ /* Show only existing slave ptys. */
+ if (cygwin_shared->tty.connect (thisdev.get_minor ()) == -1)
+ continue;
+ break;
+ case DEV_CONS_MAJOR:
+ /* Show only the one console which is our controlling tty
+ right now. */
+ if (!iscons_dev (myself->ctty)
+ || myself->ctty != devn)
+ continue;
+ break;
+ case DEV_TTY_MAJOR:
+ /* Show con{in,out,sole} only if we're running in a console. */
+ switch (devn)
{
- case DEV_VIRTFS_MAJOR:
- /* Drop /dev/fifo and /dev/pipe since they are internal only. */
- switch (ext_dev_storage[idx].d.devn)
- {
- case FH_FIFO:
- case FH_PIPE:
- continue;
- }
- break;
- case DEV_PTYM_MAJOR:
- /* Only /dev/ptmx is user-visible. */
- if (strcmp (ext_dev_storage[idx].name + dev_prefix_len, "ptmx"))
+ case FH_CONIN:
+ case FH_CONOUT:
+ case FH_CONSOLE:
+ if (!iscons_dev (myself->ctty))
continue;
- break;
- case DEV_PTYS_MAJOR:
- /* Show only existing slave ptys. */
- if (cygwin_shared->tty.connect (ext_dev_storage[idx].d.minor)
- == -1)
- continue;
- break;
- case DEV_CONS_MAJOR:
- /* Show only the one console which is our controlling tty
- right now. */
- if (!iscons_dev (myself->ctty)
- || myself->ctty != ext_dev_storage[idx].d.devn_int)
- continue;
- break;
- case DEV_TTY_MAJOR:
- /* Show con{in,out,sole} only if we're running in a console. */
- switch (ext_dev_storage[idx].d.devn)
- {
- case FH_CONIN:
- case FH_CONOUT:
- case FH_CONSOLE:
- if (!iscons_dev (myself->ctty))
- continue;
- }
- break;
- case DEV_SERIAL_MAJOR:
- /* Ignore comX devices, only print ttySx. */
- if (ext_dev_storage[idx].name[dev_prefix_len] == 'c')
- continue;
- /*FALLTHRU*/
- case DEV_FLOPPY_MAJOR:
- case DEV_TAPE_MAJOR:
- case DEV_CDROM_MAJOR:
- case DEV_SD_MAJOR:
- case DEV_SD1_MAJOR:
- case DEV_SD2_MAJOR:
- case DEV_SD3_MAJOR:
- case DEV_SD4_MAJOR:
- case DEV_SD5_MAJOR:
- case DEV_SD6_MAJOR:
- case DEV_SD7_MAJOR:
- /* Check existence of POSIX devices backed by real NT devices. */
+ }
+ break;
+ case DEV_SERIAL_MAJOR:
+ case DEV_FLOPPY_MAJOR:
+ case DEV_TAPE_MAJOR:
+ case DEV_CDROM_MAJOR:
+ case DEV_SD_MAJOR:
+ case DEV_SD1_MAJOR:
+ case DEV_SD2_MAJOR:
+ case DEV_SD3_MAJOR:
+ case DEV_SD4_MAJOR:
+ case DEV_SD5_MAJOR:
+ case DEV_SD6_MAJOR:
+ case DEV_SD7_MAJOR:
+ /* Check existence of POSIX devices backed by real NT devices. */
+ {
+ WCHAR wpath[MAX_PATH];
+ UNICODE_STRING upath;
+ OBJECT_ATTRIBUTES attr;
+ HANDLE h;
+ NTSTATUS status;
+
+ sys_mbstowcs (wpath, MAX_PATH, thisdev.native);
+ RtlInitUnicodeString (&upath, wpath);
+ InitializeObjectAttributes (&attr, &upath,
+ OBJ_CASE_INSENSITIVE, NULL, NULL);
+ /* Except for the serial IO devices, the native paths are
+ direct device paths, not symlinks, so every status code
+ except for "NOT_FOUND" means the device exists. */
+ status = NtOpenSymbolicLinkObject (&h, SYMBOLIC_LINK_QUERY,
+ &attr);
+ switch (status)
{
- WCHAR wpath[MAX_PATH];
- UNICODE_STRING upath;
- OBJECT_ATTRIBUTES attr;
- HANDLE h;
- NTSTATUS status;
-
- sys_mbstowcs (wpath, MAX_PATH, ext_dev_storage[idx].native);
- RtlInitUnicodeString (&upath, wpath);
- InitializeObjectAttributes (&attr, &upath,
- OBJ_CASE_INSENSITIVE, NULL, NULL);
- /* Except for the serial IO devices, the native paths are
- direct device paths, not symlinks, so every status code
- except for "NOT_FOUND" means the device exists. */
- status = NtOpenSymbolicLinkObject (&h, SYMBOLIC_LINK_QUERY,
- &attr);
- switch (status)
- {
- case STATUS_OBJECT_NAME_NOT_FOUND:
- case STATUS_OBJECT_PATH_NOT_FOUND:
- continue;
- case STATUS_SUCCESS:
- NtClose (h);
- break;
- default:
- break;
- }
+ case STATUS_OBJECT_NAME_NOT_FOUND:
+ case STATUS_OBJECT_PATH_NOT_FOUND:
+ continue;
+ case STATUS_SUCCESS:
+ NtClose (h);
+ break;
+ default:
+ break;
}
- break;
- }
- strcpy (de->d_name, ext_dev_storage[idx].name + dev_prefix_len);
- de->d_ino = hash_path_name (0, ext_dev_storage[idx].native);
- switch (ext_dev_storage[idx].d.major)
+ }
+ break;
+ }
+ ++dir->__d_position;
+ strcpy (de->d_name, thisdev.name + dev_prefix_len);
+ de->d_ino = hash_path_name (0, thisdev.native);
+ switch (thisdev.get_major ())
+ {
+ case DEV_FLOPPY_MAJOR:
+ case DEV_TAPE_MAJOR:
+ case DEV_CDROM_MAJOR:
+ case DEV_SD_MAJOR:
+ case DEV_SD1_MAJOR:
+ case DEV_SD2_MAJOR:
+ case DEV_SD3_MAJOR:
+ case DEV_SD4_MAJOR:
+ case DEV_SD5_MAJOR:
+ case DEV_SD6_MAJOR:
+ case DEV_SD7_MAJOR:
+ de->d_type = DT_BLK;
+ break;
+ case DEV_TTY_MAJOR:
+ switch (devn)
{
- case DEV_FLOPPY_MAJOR:
- case DEV_TAPE_MAJOR:
- case DEV_CDROM_MAJOR:
- case DEV_SD_MAJOR:
- case DEV_SD1_MAJOR:
- case DEV_SD2_MAJOR:
- case DEV_SD3_MAJOR:
- case DEV_SD4_MAJOR:
- case DEV_SD5_MAJOR:
- case DEV_SD6_MAJOR:
- case DEV_SD7_MAJOR:
- de->d_type = DT_BLK;
- break;
- case DEV_TTY_MAJOR:
- switch (ext_dev_storage[idx].d.devn)
- {
- case FH_CONIN:
- case FH_CONOUT:
- case FH_CONSOLE:
- dev.parse (myself->ctty);
- de->d_ino = hash_path_name (0, dev.native);
- break;
- }
- /*FALLTHRU*/
- default:
- de->d_type = DT_CHR;
+ case FH_CONIN:
+ case FH_CONOUT:
+ case FH_CONSOLE:
+ dev.parse (myself->ctty);
+ de->d_ino = hash_path_name (0, dev.native);
break;
}
- ret = 0;
- break;
+ /*FALLTHRU*/
+ default:
+ de->d_type = DT_CHR;
+ break;
}
+ ret = 0;
+ break;
}
+
+out:
+ debug_printf ("returning %d", ret);
return ret;
}
void
fhandler_dev::rewinddir (DIR *dir)
{
- lastrealpos = 0;
+ devidx = dir_exists ? NULL : dev_storage_scan_start;
fhandler_disk_file::rewinddir (dir);
}
-
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index 3f54ebefa..98e50914c 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -2365,66 +2365,6 @@ fhandler_disk_file::closedir (DIR *dir)
return res;
}
-fhandler_dev::fhandler_dev () :
- fhandler_disk_file (), lastrealpos (0), dir_exists (true)
-{
-}
-
-DIR *
-fhandler_dev::opendir (int fd)
-{
- DIR *dir;
- DIR *res = NULL;
-
- dir = fhandler_disk_file::opendir (fd);
- if (dir)
- return dir;
- if ((dir = (DIR *) malloc (sizeof (DIR))) == NULL)
- set_errno (ENOMEM);
- else if ((dir->__d_dirent =
- (struct dirent *) malloc (sizeof (struct dirent))) == NULL)
- {
- set_errno (ENOMEM);
- goto free_dir;
- }
- else
- {
- cygheap_fdnew cfd;
- if (cfd < 0 && fd < 0)
- goto free_dirent;
-
- dir->__d_dirname = NULL;
- dir->__d_dirent->__d_version = __DIRENT_VERSION;
- dir->__d_cookie = __DIRENT_COOKIE;
- dir->__handle = INVALID_HANDLE_VALUE;
- dir->__d_position = 0;
- dir->__flags = 0;
- dir->__d_internal = 0;
-
- if (fd >= 0)
- dir->__d_fd = fd;
- else
- {
- cfd = this;
- dir->__d_fd = cfd;
- cfd->nohandle (true);
- }
- set_close_on_exec (true);
- dir->__fh = this;
- dir_exists = false;
- res = dir;
- }
-
- syscall_printf ("%p = opendir (%s)", res, get_name ());
- return res;
-
-free_dirent:
- free (dir->__d_dirent);
-free_dir:
- free (dir);
- return res;
-}
-
fhandler_cygdrive::fhandler_cygdrive () :
fhandler_disk_file (), ndrives (0), pdrive (NULL)
{
diff --git a/winsup/cygwin/gendevices b/winsup/cygwin/gendevices
index df21796d0..9794b2917 100755
--- a/winsup/cygwin/gendevices
+++ b/winsup/cygwin/gendevices
@@ -54,7 +54,7 @@ chop $storage[$#storage];
chop $storage[$#storage];
$storage[$#storage] .= "\n";
splice(@lines, $storage_ix, 1,
- "static const device dev_storage[] =\n", "{\n",
+ "const _RDATA device dev_storage[] =\n", "{\n",
@storage, "};\n\n",
sort {$a cmp $b} values %pointers);
open(SHILKA, '>', $shilka);
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index b7f84caaa..fa0a0e370 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -718,6 +718,12 @@ path_conv::check (const char *src, unsigned opt,
sym.pflags |= pflags_or;
+ if (!dev.expose ())
+ {
+ error = ENXIO;
+ return;
+ }
+
if (dev.get_major () == DEV_CYGDRIVE_MAJOR)
{
if (!component)