OS¶
Usage
use OS;
or
import OS;
Submodules
The OS
module provides definitions 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¶
- 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.- var err: errorCode¶
- var details: string¶
- proc init(err: errorCode, details: string = "")¶
- override proc message()¶
Provides a formatted string output for
SystemError
, generated from the internalerr
and thedetails
string.
- proc type fromSyserr(err: errorCode, details: string = "")¶
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
Warning
‘SystemError.fromSyserr’ is deprecated. Please use ‘createSystemError’ instead.
- proc type fromSyserr(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
Warning
‘SystemError.fromSyserr’ is deprecated. Please use ‘createSystemError’ instead.
- proc createSystemError(err: errorCode, details: string = "")¶
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
.- proc init(details: string = "", err: errorCode = EWOULDBLOCK: errorCode)¶
- class ChildProcessError: SystemError¶
ChildProcessError
is the subclass ofSystemError
corresponding toECHILD
.- proc init(details: string = "", err: errorCode = ECHILD: errorCode)¶
- class ConnectionError: SystemError¶
ConnectionError
is the subclass ofSystemError
that serves as the base class for all system errors regarding connections.- proc init(err: errorCode, details: string = "")¶
- class BrokenPipeError: ConnectionError¶
BrokenPipeError
is the subclass ofConnectionError
corresponding toEPIPE
andSysBasic.ESHUTDOWN
.- proc init(details: string = "", err: errorCode = EPIPE: errorCode)¶
- class ConnectionAbortedError: ConnectionError¶
ConnectionAbortedError
is the subclass ofConnectionError
corresponding toECONNABORTED
.- proc init(details: string = "", err: errorCode = ECONNABORTED: errorCode)¶
- class ConnectionRefusedError: ConnectionError¶
ConnectionRefusedError
is the subclass ofConnectionError
corresponding toECONNREFUSED
.- proc init(details: string = "", err: errorCode = ECONNREFUSED: errorCode)¶
- class ConnectionResetError: ConnectionError¶
ConnectionResetError
is the subclass ofConnectionError
corresponding toECONNRESET
.- proc init(details: string = "", err: errorCode = ECONNRESET: errorCode)¶
- class FileExistsError: SystemError¶
FileExistsError
is the subclass ofSystemError
corresponding toEEXIST
.- proc init(details: string = "", err: errorCode = EEXIST: errorCode)¶
- class FileNotFoundError: SystemError¶
FileNotFoundError
is the subclass ofSystemError
corresponding toENOENT
.- proc init(details: string = "", err: errorCode = ENOENT: errorCode)¶
- class InterruptedError: SystemError¶
InterruptedError
is the subclass ofSystemError
corresponding toEINTR
.- proc init(details: string = "", err: errorCode = EINTR: errorCode)¶
- class IsADirectoryError: SystemError¶
IsADirectoryError
is the subclass ofSystemError
corresponding toEISDIR
.- proc init(details: string = "", err: errorCode = EISDIR: errorCode)¶
- class NotADirectoryError: SystemError¶
NotADirectoryError
is the subclass ofSystemError
corresponding toENOTDIR
.- proc init(details: string = "", err: errorCode = ENOTDIR: errorCode)¶
- class PermissionError: SystemError¶
PermissionError
is the subclass ofSystemError
corresponding toEACCES
andEPERM
.- proc init(details: string = "", err: errorCode = EPERM: errorCode)¶
- class ProcessLookupError: SystemError¶
ProcessLookupError
is the subclass ofSystemError
corresponding toESRCH
.- proc init(details: string = "", err: errorCode = ESRCH: errorCode)¶
- class TimeoutError: SystemError¶
TimeoutError
is the subclass ofSystemError
corresponding toETIMEDOUT
.- proc init(details: string = "", err: errorCode = ETIMEDOUT: errorCode)¶
- class IoError: SystemError¶
IoError
is the subclass ofSystemError
that serves as the base class for all errors regarding inputs and their formatting. They are typically not directly generated by the OS, but they are used and emitted by the IO module.- proc init(err: errorCode, details: string = "")¶
- class EofError: IoError¶
EofError
is the subclass ofIoError
corresponding toSysBasic.EEOF
.- proc init(details: string = "", err: errorCode = EEOF: errorCode)¶
- class UnexpectedEofError: IoError¶
UnexpectedEofError
is the subclass ofIoError
corresponding toSysBasic.ESHORT
.- proc init(details: string = "", err: errorCode = ESHORT: errorCode)¶
- class BadFormatError: IoError¶
BadFormatError
is the subclass ofIoError
corresponding toSysBasic.EFORMAT
.- proc init(details: string = "", err: errorCode = EFORMAT: errorCode)¶
- proc ioerror(error: errorCode, msg: string, path: string, offset: int(64)) throws¶
Create and throw a
SystemError
if an error occurred, formatting a useful message based on the provided arguments. Do nothing if the error argument does not indicate an error occurred.- Arguments
error – the error code
msg – extra information to include in the thrown error
path – optionally, a path to include in the thrown error
offset – optionally, an offset to include in the thrown error
- Throws
SystemError – A subtype is thrown when the error argument indicates an error occurred
- proc ioerror(errstr: string, msg: string, path: string, offset: int(64)) throws
Create and throw an
IoError
and include a formatted message based on the provided arguments.- Arguments
errstr – the error string
msg – extra information to print after the error description
path – a path to print out that is related to the error
offset – an offset to print out that is related to the error
- Throws
IoError – always throws an IoError
- 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