[bulk] - R: /dev/ttys* under cygwin problem

Daniel Barclay daniel@fgm.com
Fri Sep 24 18:30:00 GMT 2010

Eric Blake wrote:
> On 09/22/2010 03:02 PM, Daniel Barclay wrote:
>> Again, why does Cygwin's (virtual) file system _not_ include those
>> devices (when listing /dev)? (Why doesn't it do it more like Linux's
>> /proc, etc., which gives a consistent view and which tells you what's
>> available without your having to look elsewhere?)
> ...Also, unlike Linux,
> where the kernel knows what devices are present, a cygwin implementation
> would have to make a lot of syscalls querying whether each potential
> device is available.

Oh--so Cygwin would have to query Windows for the current set of
devices (which can change over time (right?)) each time the /dev
directory was listed (since it doesn't maintain the net device list
itself as a kernel would)?)?

> One other drawback - ... part of the implementation battle is
> figuring out how to merge an existing directory containing user-added
> symlinks or device names, in parallel with the virtual devices supported
> by the virtual FS magic compiled into cygwin.

Okay, yeah, I see how that could be tricky.

Wait a minute--doesn't Cygwin have to do that anyway?  If the user
adds a symlink or device with the same name as that of a virtual
device provided by Cygwin, and then refers to that pathname
(/dev/something), haven't the Cygwin designers already had to decide
what happens (whether the user gets the virtual device or, say,
gets the target of the symlink)?  If so, does listing the /dev
directory really add some additional consideration?

>> Actually, is your last sentence above actually true? Looking at the
>> device-creation script you pointed me to, I wonder: How do you (e.g.,
>> a script) determine which devices of a given type exist (e.g., sda1,
>> sda2, sda3, ...)? (Do you have to try to open each possible device and
>> check whether there's an error?)
> The script creates every known name, whether or not it actually exists
> as a device at the current moment, which is in itself a bit misleading.
> But it has to, because of devices which can be added and removed on the
> fly, whereas the script creating the placeholder files is only run once.

Yes, I got that part.  What I was wondering was what would be the
recommended way to determine which devices really existed.  Would it
be trying to open the device and checking for some "no such device"


Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

More information about the Cygwin mailing list