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
errorCodecan be compared using == or != to aCTypes.c_intor to anothererrorCode. AnerrorCodecan be cast to or from aCTypes.c_int. It can be assigned the value of aCTypes.c_intor anothererrorCode. In addition,errorCodecan 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
errorCodeis const in.The default value of the
errorCodetype is undefined.
- class SystemError : Error
SystemErroris a base class forErrors.Errors generated fromerrorCode. It provides factory methods to create different subtypes based on theerrorCodethat is passed.- proc init(err: errorCode, details: string = "")
Construct a
SystemErrorwith a specific error code and optional extra details.
- override proc message()
Provides a formatted string output for
SystemError, generated from the internalerrand thedetailsstring.
- proc createSystemError(err: errorCode, details: string = "") : SystemError
Return the matching
SystemErrorsubtype 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
SystemErrorsubtype 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
BlockingIoErroris the subclass ofSystemErrorcorresponding toEAGAIN,EALREADY,EWOULDBLOCK, andEINPROGRESS.
- class ChildProcessError : SystemError
ChildProcessErroris the subclass ofSystemErrorcorresponding toECHILD.
- class ConnectionError : SystemError
ConnectionErroris the subclass ofSystemErrorthat serves as the base class for all system errors regarding connections.
- class BrokenPipeError : ConnectionError
BrokenPipeErroris the subclass ofConnectionErrorcorresponding toEPIPE
- class ConnectionAbortedError : ConnectionError
ConnectionAbortedErroris the subclass ofConnectionErrorcorresponding toECONNABORTED.
- class ConnectionRefusedError : ConnectionError
ConnectionRefusedErroris the subclass ofConnectionErrorcorresponding toECONNREFUSED.
- class ConnectionResetError : ConnectionError
ConnectionResetErroris the subclass ofConnectionErrorcorresponding toECONNRESET.
- class FileExistsError : SystemError
FileExistsErroris the subclass ofSystemErrorcorresponding toEEXIST.
- class FileNotFoundError : SystemError
FileNotFoundErroris the subclass ofSystemErrorcorresponding toENOENT.
- class InterruptedError : SystemError
InterruptedErroris the subclass ofSystemErrorcorresponding toEINTR.
- class IsADirectoryError : SystemError
IsADirectoryErroris the subclass ofSystemErrorcorresponding toEISDIR.
- class NotADirectoryError : SystemError
NotADirectoryErroris the subclass ofSystemErrorcorresponding toENOTDIR.
- class PermissionError : SystemError
PermissionErroris the subclass ofSystemErrorcorresponding toEACCESandEPERM.
- class ProcessLookupError : SystemError
ProcessLookupErroris the subclass ofSystemErrorcorresponding toESRCH.
- class TimeoutError : SystemError
TimeoutErroris the subclass ofSystemErrorcorresponding toETIMEDOUT.
- class IoError : SystemError
IoErroris the subclass ofSystemErrorcorresponding to EIO.
- class EofError : Error
EofErroris the the Chapel-specific error corresponding to encountering end-of-file.
- class UnexpectedEofError : Error
UnexpectedEofErroris 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
BadFormatErroris the Chapel-specific error corresponding to incorrectly-formatted input.
- class InsufficientCapacityError : IoError
InsufficientCapacityErroris a subclass ofIoErrorindicating 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