Mono.Unix.UnixMarshal.ThrowExceptionForErrorIf Method
Throws an exception that best matches errno if retval is -1.

Syntax

[System.CLSCompliant(false)]
public static void ThrowExceptionForErrorIf (int retval, Mono.Unix.Native.Errno errno)

Parameters

retval
A int containing the return value of a method from Mono.Unix.Native.Syscall.
errno
A Mono.Unix.Native.Errno specifying the exception to throw.

Exceptions

TypeReason
ArgumentException errno is Mono.Unix.Native.Errno.EBADF or Mono.Unix.Native.Errno.EINVAL.
ArgumentOutOfRangeException errno is Mono.Unix.Native.Errno.ERANGE.
InvalidOperationException errno is Mono.Unix.Native.Errno.EOPNOTSUPP or Mono.Unix.Native.Errno.EPERM.
InvalidProgramException errno is Mono.Unix.Native.Errno.ENOEXEC.
NullReferenceException errno is Mono.Unix.Native.Errno.EFAULT.
OverflowException errno is Mono.Unix.Native.Errno.EOVERFLOW.
UnauthorizedAccessException errno is Mono.Unix.Native.Errno.EACCES or Mono.Unix.Native.Errno.EISDIR.
System.IO.DirectoryNotFoundException errno is Mono.Unix.Native.Errno.ENOTDIR.
System.IO.FileNotFoundException errno is Mono.Unix.Native.Errno.ENOENT.
System.IO.IOException errno is one of: Mono.Unix.Native.Errno.EIO, Mono.Unix.Native.Errno.ENOSPC, Mono.Unix.Native.Errno.ENOTEMPTY, Mono.Unix.Native.Errno.ENXIO, Mono.Unix.Native.Errno.EROFS, Mono.Unix.Native.Errno.ESPIPE.
System.IO.PathTooLongException errno is Mono.Unix.Native.Errno.ENAMETOOLONG.
Mono.Unix.UnixIOException errno is not any of the above error values.

Remarks

If retval is -1, then this method is equivalent to calling UnixMarshal.ThrowExceptionForError (errno). Otherwise, nothing is done.

If the exception thrown is not a Mono.Unix.UnixIOException, then the exception's Exception.InnerException property will be set to a Mono.Unix.UnixIOException instance wrapping errno, if possible.

Note: ArgumentOutOfRangeException does not have its Exception.InnerException property set, as ArgumentOutOfRangeException does not provide a constructor that sets this property.

Requirements

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