lkml.org 
[lkml]   [2000]   [Nov]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: access() says EROFS even for device files if /dev is mounted RO
On Mon, Nov 27, 2000 at 10:47:06PM +0100, Rogier Wolff wrote:
> Andries Brouwer wrote:
> > > access("/dev/tty2", R_OK|W_OK) = -1 EROFS (Read-only file system)
>
> > You misunderstand the function of access(). The standard says
> >
> > [EROFS] write access shall fail if write access is requested
> > for a file on a read-only file system
>
> The intent of the "access" call is to tell you if you will be able to
> open the given pathname for the requested permissions. That this is
> inherently racey is not the fault of the access system call.
>
> The INTENT of this paragraph from the standard is to specify when to
> return the error value EROFS. The "for a -=file=-" part to me
> indicates that a valid interpretation is that this does not apply to
> device nodes.

You optimist!
A standard is not a text that should be read with the attitude
"they write this but I know that they really meant that".
A standard is precise.

In particular it defines the concepts used. For file it says:

File
An object that can be written to, or read from, or both.
A file has certain attributes, including access permissions and type.
File types include regular file, character special file, block special
file, FIFO special file, symbolic link, socket, and directory.
Other types of files may be supported by the implementation.

Andries
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:47    [W:0.889 / U:23.504 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site