Mono Class Library: Mono.Unix.UnixFileInfo Overview | Members

Mono.Unix.UnixFileInfo.OpenRead Method

Opens UnixFileSystemInfo.FullName for reading.

public UnixStream OpenRead ()

Returns

A Mono.Unix.UnixStream that provides read access to UnixFileSystemInfo.FullName.

Exceptions

TypeReason
ArgumentException

An attempt was made to open a descriptor with an illegal combination of Mono.Unix.Native.OpenFlags.O_RDONLY, Mono.Unix.Native.OpenFlags.O_WRONLY, and Mono.Unix.Native.OpenFlags.O_RDWR. [Mono.Unix.Native.Errno.EINVAL]

-or-

Mono.Unix.Native.OpenFlags.O_CREAT was specified in flags. Mono.Unix.Native.OpenFlags.O_CREAT requires a file mode for file creation; use UnixFileInfo.Open() instead.

InvalidOperationException

Mono.Unix.Native.OpenFlags.O_SHLOCK or Mono.Unix.Native.OpenFlags.O_EXLOCK is specified but the underlying file system does not support locking. [Mono.Unix.Native.Errno.EOPNOTSUPP]

-or-

UnixFileSystemInfo.FullName is a special file mounted through a file system that does not support access to it (e.g. NFS). [Mono.Unix.Native.Errno.EOPNOTSUPP]

-or-

An attempt was made to open a socket. [Mono.Unix.Native.Errno.EOPNOTSUPP]

UnauthorizedAccessException

Search permission is denied for a component of the path UnixFileSystemInfo.FullName. [Mono.Unix.Native.Errno.EACCESS]

-or-

The required permissions (for reading and/or writing) are denied for the given flags. [Mono.Unix.Native.Errno.EACCESS]

-or-

UnixFileSystemInfo.FullName does not exist, and UnixFileInfo.Directory does not permit writing. [Mono.Unix.Native.Errno.EACCESS]

-or-

UnixFileSystemInfo.FullName is a directory. [Mono.Unix.Native.Errno.EISDIR]

System.IO.DirectoryNotFoundException A component of the path prefix of UnixFileSystemInfo.FullName is not a directory. [Mono.Unix.Native.Errno.ENOTDIR]
System.IO.FileNotFoundException

A component of UnixFileSystemInfo.FullName that must exist does not exist. [Mono.Unix.Native.Errno.ENOENT]

-or-

UnixFileSystemInfo.FullName does not exist and Mono.Unix.Native.OpenFlags.O_CREAT is not set. [Mono.Unix.Native.Errno.ENOENT]

System.IO.IOException

UnixFileSystemInfo.FullName resides on a read-only file system. [Mono.Unix.Native.Errno.EROFS]

-or-

UnixFileSystemInfo.FullName is a character device or block device, and the device associated with this file does not exist. [Mono.Unix.Native.Errno.ENXIO]

-or-

UnixFileSystemInfo.FullName is a fifo, no process has it open for reading, and the arguments specify it is to be opened for writing. [Mono.Unix.Native.Errno.ENXIO]

-or-

The directory UnixFileInfo.Directory cannot be extended because there is no space left on the file system containing the directory. [Mono.Unix.Native.Errno.ENOSPC]

-or-

There are no free inodes on the file system on which the file is being created. [Mono.Unix.Native.Errno.ENOSPC]

-or-

An I/O error occurred while making the directory entry or allocating the inode. [Mono.Unix.Native.Errno.EIO]

System.IO.PathTooLongExceptionUnixFileSystemInfo.FullName was too long. [Mono.Unix.Native.Errno.ENAMETOOLONG]
Mono.Unix.UnixIOException

Too many symbolic links were encountered in translating UnixFileSystemInfo.FullName. [Mono.Unix.Native.Errno.ELOOP]

-or-

The process has already reached its limit for open file descriptors. [Mono.Unix.Native.Errno.EMFILE]

-or-

The system file table is full. [Mono.Unix.Native.Errno.ENFILE]

-or-

Mono.Unix.Native.OpenFlags.O_NOFOLLOW was specified and the target is a symbolic link. [Mono.Unix.Native.Errno.EMLINK]

-or-

Mono.Unix.Native.OpenFlags.O_NONBLOCK and one of Mono.Unix.Native.OpenFlags.O_SHLOCK or Mono.Unix.Native.OpenFlags.O_EXLOCK is specified and the file is locked. [Mono.Unix.Native.Errno.EWOULDBLOCK]

-or-

The user's quota of inodes on the file system containing UnixFileInfo.Directory has been exhausted. [Mono.Unix.Native.Errno.EDQUOT]

-or-

UnixFileInfo.Directory cannot be extended because the user's quota of disk blocks on the file system containing this directory has been exhausted. [Mono.Unix.Native.Errno.EDQUOT]

-or-

UnixFileSystemInfo.FullName is a pure procedure (shared text) file that is being executed and Mono.Unix.Native.Syscall.open requests write access. [Mono.Unix.Native.Errno.ETXTBSY]

-or-

Mono.Unix.Native.OpenFlags.O_CREAT and Mono.Unix.Native.OpenFlags.O_EXCL were specified and UnixFileSystemInfo.FullName exists. [Mono.Unix.Native.Errno.EEXIST]

Remarks

This is equivalent to UnixFileInfo.Open() (System.IO.FileMode.Open, System.IO.FileAccess.Read).

Requirements

Namespace: Mono.Unix
Assembly: Mono.Posix (in Mono.Posix.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0