Subject: Re: ENXIO or ENODEV when r-opening a w-only device?
To: None <tech-kern@NetBSD.org>
From: Chapman Flack <nblists@anastigmatix.net>
List: tech-kern
Date: 01/04/2006 20:13:27
Steven M. Bellovin wrote:
> What do you get if you open a device on a read-only file system for 

Umm, EROFS. But again, that has kind of a specific meaning that
isn't what I mean.

> writing?  A CD-Ro for writing?  I'd return the same error.

I put a cd into cd0, and open("/dev/rcd0a",O_WRONLY) succeeded. :/
Then write(2) returned ... EINVAL.   EINVAL?  I had my money on
ENXIO. :)

man 2 write:

     [EINVAL]   The pointer associated with d was negative.

     [EINVAL]   The total length of the I/O is more than can be
                expressed by the ssize_t return value.

SUS:

The write() and pwrite() functions may fail if:

[EINVAL]
    The STREAM or multiplexer referenced by fildes is linked
    (directly or indirectly) downstream from a multiplexer.

The more I think about this, the less I seem to understand. I
think I expected the question to be easier, more settled-like. :)

-Chap