Subject: Re: ENXIO or ENODEV when r-opening a w-only device?
To: matthew green <mrg@eterna.com.au>
From: Garrett D'Amore <garrett_damore@tadpole.com>
List: tech-kern
Date: 01/04/2006 15:00:46
matthew green wrote:

>EPERM?
>  
>
My first thought was along these lines.  But this errno indicates that
the problem is one of permissions (e.g. a device that is read-only only
because of the file mode bits.)  But the problem of writing to a device
that simply cannot support write (read only media being a good example)
is different -- in this case *no* user has sufficient privileges.

ENXIO is used for FIFOs without a reader on the other end, or for
devices nodes without a supporting devices.

ENODEV seems like the best choice, as it properly indicates that the
operation isn't relevant to the device.

Isn't ENODEV what is returned when the underlying vnode lacks the proper
operation routines?  (I'm not too familiar with vnodes under NetBSD, but
I am pretty sure that this statement is true for at least Solaris, so
there is precedent at least there.)

-- 
Garrett D'Amore                          http://www.tadpolecomputer.com/
Sr. Staff Engineer          Extending the Power of 64-bit UNIX Computing
Tadpole Computer, Inc.                             Phone: (951) 325-2134