Errors v0.1.0

Source
The error numbers, and telling a raw result from an error.

EPERM

pub const EPERM: int64 = 1;

EPERM: the operation is not permitted to this caller.

Source

ENOENT

pub const ENOENT: int64 = 2;

ENOENT: no such file or directory.

Source

ESRCH

pub const ESRCH: int64 = 3;

ESRCH: no such process.

Source

EINTR

pub const EINTR: int64 = 4;

EINTR: the call was interrupted by a signal before it did anything.

Source

EIO

pub const EIO: int64 = 5;

EIO: a low-level input or output error.

Source

ENXIO

pub const ENXIO: int64 = 6;

ENXIO: no such device or address.

Source

EBADF

pub const EBADF: int64 = 9;

EBADF: the file descriptor is not open, or is not open for what was asked.

Source

EAGAIN

pub const EAGAIN: int64 = 11;

EAGAIN: the operation would block, and the descriptor was set not to. Spelled EWOULDBLOCK in some interfaces; on Linux the two are one value.

Source

ENOMEM

pub const ENOMEM: int64 = 12;

ENOMEM: not enough memory to satisfy the request.

Source

EACCES

pub const EACCES: int64 = 13;

EACCES: permission denied.

Source

EFAULT

pub const EFAULT: int64 = 14;

EFAULT: an address the call was given is outside the caller's address space.

Source

EBUSY

pub const EBUSY: int64 = 16;

EBUSY: the resource is in use.

Source

EEXIST

pub const EEXIST: int64 = 17;

EEXIST: the file already exists.

Source

EXDEV

pub const EXDEV: int64 = 18;

EXDEV: the two paths are on different file systems.

Source

ENOTDIR

pub const ENOTDIR: int64 = 20;

ENOTDIR: a path component that had to be a directory is not one.

Source

EISDIR

pub const EISDIR: int64 = 21;

EISDIR: the target is a directory and the operation is not one a directory accepts.

Source

EINVAL

pub const EINVAL: int64 = 22;

EINVAL: an argument is not valid.

Source

EMFILE

pub const EMFILE: int64 = 24;

EMFILE: this process has too many descriptors open.

Source

ENOSPC

pub const ENOSPC: int64 = 28;

ENOSPC: the device has no room left.

Source

ESPIPE

pub const ESPIPE: int64 = 29;

ESPIPE: the descriptor is a pipe or socket and cannot be seeked.

Source

EROFS

pub const EROFS: int64 = 30;

EROFS: the file system is mounted read-only.

Source

EPIPE

pub const EPIPE: int64 = 32;

EPIPE: the reading end of the pipe is closed.

Source

ENAMETOOLONG

pub const ENAMETOOLONG: int64 = 36;

ENAMETOOLONG: the path or a component of it is too long.

Source

ENOSYS

pub const ENOSYS: int64 = 38;

ENOSYS: the kernel does not implement this call. What an architecture that lacks a call reports, which is how a caller falls back to another.

Source

ELOOP

pub const ELOOP: int64 = 40;

ELOOP: too many symbolic links were followed resolving the path.

Source

EOVERFLOW

pub const EOVERFLOW: int64 = 75;

EOVERFLOW: a value is too large for the type the call reports it in.

Source

ETIMEDOUT

pub const ETIMEDOUT: int64 = 110;

ETIMEDOUT: the operation timed out.

Source

MaximumErrno

pub const MaximumErrno: int64 = 4095;

The largest error number the kernel's reserved range holds. A raw result below -MaximumErrno is a value, not an error.

Source

IsError

pub func IsError(result: int64) -> bool

Whether a raw system-call result is one of the kernel's reserved error values. result is read by value. True for -4095 through -1, and false for everything else, including every valid mapping address a memory call returns. Cannot fail. Runs in constant time and allocates nothing.

Source

Parameters

NameTypeDescription
resultint64the raw result to test

Returns: whether it is one of the reserved error values

Errno

pub func Errno(result: int64) -> int64

The error number a raw system-call result carries, or zero when it carries none. result is read by value; the number is returned by copy, positive, as a man page names it. A successful result gives zero, which is not an error number and never collides with one. Cannot fail. Runs in constant time and allocates nothing.

Source

Parameters

NameTypeDescription
resultint64the raw result to read

Returns: the error number, positive, or zero when the result carries none