OS
Usage
use OS;
or
import OS;
Submodules
Supports features matching operating system interfaces.
This module provides Chapel declarations for the constants, types, and functions defined by various operating systems’ programmatic interfaces. It is not complete for any operating system, but does define those things that have been needed so far in implementing other Chapel modules and user programs. It is expected to grow as needed. In all respects (naming, capitalization, types, semantics) the symbols defined here should match their corresponding operating system definitions to the extent Chapel can do so. For documentation on these symbols, please see the operating system manual pages.
- type errorCode
A type storing an error code or an error message. An
errorCode
can be compared using == or != to aCTypes.c_int
or to anothererrorCode
. AnerrorCode
can be cast to or from aCTypes.c_int
. It can be assigned the value of aCTypes.c_int
or anothererrorCode
. In addition,errorCode
can be checked directly in an if statement like so:var err: errorCode; if err then writeln("err contains an error, ie err != 0"); else writeln("err does not contain an error; err == 0");
The default intent for a formal of type
errorCode
is const in.The default value of the
errorCode
type is undefined.
- class SystemError : Error
SystemError
is a base class forErrors.Error
s generated fromerrorCode
. It provides factory methods to create different subtypes based on theerrorCode
that is passed.- proc init(err: errorCode, details: string = "")
Construct a
SystemError
with a specific error code and optional extra details.
- override proc message()
Provides a formatted string output for
SystemError
, generated from the internalerr
and thedetails
string.
- proc createSystemError(err: errorCode, details: string = "") : SystemError
Return the matching
SystemError
subtype for a givenerrorCode
, with an optional string containing extra details.- Arguments:
err – the errorCode to generate from
details – extra information to include with the error
- proc createSystemError(err: int, details: string = "")
Return the matching
SystemError
subtype for a given error number, with an optional string containing extra details.- Arguments:
err – the number to generate from
details – extra information to include with the error
- class BlockingIoError : SystemError
BlockingIoError
is the subclass ofSystemError
corresponding toEAGAIN
,EALREADY
,EWOULDBLOCK
, andEINPROGRESS
.
- class ChildProcessError : SystemError
ChildProcessError
is the subclass ofSystemError
corresponding toECHILD
.
- class ConnectionError : SystemError
ConnectionError
is the subclass ofSystemError
that serves as the base class for all system errors regarding connections.
- class BrokenPipeError : ConnectionError
BrokenPipeError
is the subclass ofConnectionError
corresponding toEPIPE
- class ConnectionAbortedError : ConnectionError
ConnectionAbortedError
is the subclass ofConnectionError
corresponding toECONNABORTED
.
- class ConnectionRefusedError : ConnectionError
ConnectionRefusedError
is the subclass ofConnectionError
corresponding toECONNREFUSED
.
- class ConnectionResetError : ConnectionError
ConnectionResetError
is the subclass ofConnectionError
corresponding toECONNRESET
.
- class FileExistsError : SystemError
FileExistsError
is the subclass ofSystemError
corresponding toEEXIST
.
- class FileNotFoundError : SystemError
FileNotFoundError
is the subclass ofSystemError
corresponding toENOENT
.
- class InterruptedError : SystemError
InterruptedError
is the subclass ofSystemError
corresponding toEINTR
.
- class IsADirectoryError : SystemError
IsADirectoryError
is the subclass ofSystemError
corresponding toEISDIR
.
- class NotADirectoryError : SystemError
NotADirectoryError
is the subclass ofSystemError
corresponding toENOTDIR
.
- class PermissionError : SystemError
PermissionError
is the subclass ofSystemError
corresponding toEACCES
andEPERM
.
- class ProcessLookupError : SystemError
ProcessLookupError
is the subclass ofSystemError
corresponding toESRCH
.
- class TimeoutError : SystemError
TimeoutError
is the subclass ofSystemError
corresponding toETIMEDOUT
.
- class IoError : SystemError
IoError
is the subclass ofSystemError
corresponding to EIO.
- class EofError : Error
EofError
is the the Chapel-specific error corresponding to encountering end-of-file.
- class UnexpectedEofError : Error
UnexpectedEofError
is the Chapel-specific error corresponding to encountering end-of-file before the requested amount of input could be read.This error can also occur on some writing operations when a
fileWriter
’s range has been specified, and the write exceeds the valid range.
- class BadFormatError : Error
BadFormatError
is the Chapel-specific error corresponding to incorrectly-formatted input.
- class InsufficientCapacityError : IoError
InsufficientCapacityError
is a subclass ofIoError
indicating that an IO operation required more storage than was provided
- proc errorToString(error: errorCode) : string
Convert a errorCode code to a human-readable string describing the error.
- Arguments:
error – the error code
- Returns:
a string describing the error