SysBasic

Usage

use SysBasic;

or

import SysBasic;

Types for low-level system error integration.

This module defines the error types syserr and qio_err_t.

When should one use syserr and when should one use qio_err_t? qio_err_t is a system error code (a c_int by a nicer name to indicate its purpose). syserr is an enhanced error that might also include an error message. All user-facing Chapel library code, or user Chapel code, should generally use syserr. When wrapping functions or declaring them in C, use qio_err_t to indicate that a function is returning an error code.

A note about the error code documentation in this file. Error descriptions for system errors are included here for convenience only. Other documentation, such as system man pages or the POSIX specification are the authority on system error codes.

type syserr

A type storing an error code or an error message. A syserr can be compared using == or != to an qio_err_t (ie integer error code) or to another syserr. A syserr can be cast to or from an qio_err_t. It can be assigned the value of an qio_err_t or another syserr. In addition, syserr can be checked directly in an if statement like so:

var err: syserr;
if err then do writeln("err contains an error, ie err != ENOERR");
if !err then do writeln("err does not contain an error; err == ENOERR");

When a syserr formal has default intent, the actual is copied to the formal upon a function call and the formal cannot be assigned within the function.

The default value of the syserr type is undefined.

Warning

‘SysBasic.syserr’ has been deprecated; please use ‘OS.errorCode’ instead.

type qio_err_t = c_int

An integral error code. This is really just a c_int, but code is clearer if you use qio_err_t to indicate arguments, variables, and return types that are system error codes.

Warning

‘qio_err_t’ has been deprecated; please use a ‘CTypes.c_int’ instead.

type fd_t = c_int

A system file descriptor. This is really just a c_int, but code is clearer if you use fd_t to indicate arguments, variables, and return types that are system file descriptors.

proc ENOERR

The error code indicating that no error occurred (Chapel specific)

proc EEOF

An error code indicating the end of file has been reached (Chapel specific)

proc ESHORT

An error code indicating that the end of file or the end of the input was reached before the requested amount of data could be read. (Chapel specific)

proc EFORMAT

An error code indicating a format error; for example when reading a quoted string literal, this would be returned if we never encountered the opening quote. (Chapel specific)

const EBADE: c_int

Invalid exchange (linux only)

const EBADFD: c_int

File descriptor in bad state (linux only)

const EBADR: c_int

Invalid request descriptor (linux only)

const EBADRQC: c_int

Invalid request code (linux only)

const EBADSLT: c_int

Invalid slot (linux only)

const ECHRNG: c_int

Channel number out of range (linux only)

const ECOMM: c_int

Communication error on send (linux only)

const EHOSTDOWN: c_int

Host is down. A socket operation failed because the destination host was down. (linux, FreeBSD)

const EISNAM: c_int

Is a named type file (linux only)

const EKEYEXPIRED: c_int

Key has expired (linux only)

const EKEYREJECTED: c_int

Key was rejected by service (linux only)

const EKEYREVOKED: c_int

Key has been revoked (linux only)

const EL2HLT: c_int

Level 2 halted (linux only)

const EL2NSYNC: c_int

Level 2 not synchronized (linux only)

const EL3HLT: c_int

Level 3 halted (linux only)

const EL3RST: c_int

Level 3 halted (linux only)

const ELIBACC: c_int

Cannot access a needed shared library (linux only)

const ELIBBAD: c_int

Accessing a corrupted shared library (linux only)

const ELIBMAX: c_int

Attempting to link in too many shared libraries (linux only)

const ELIBSCN: c_int

lib section in a.out corrupted (linux only)

const ELIBEXEC: c_int

Cannot exec a shared library directly (linux only)

const EMEDIUMTYPE: c_int

Wrong medium type (linux only)

const ENODATA: c_int

No message is available on the STREAM head read queue (POSIX.1)

const ENOKEY: c_int

Required key not available (linux only)

const ENOMEDIUM: c_int

No medium found (linux only)

const ENONET: c_int

Machine is not on the network (linux only)

const ENOPKG: c_int

Package not installed (linux only)

const ENOSR: c_int

No STREAM resources (POSIX.1 XSI STREAMS option)

const ENOSTR: c_int

Not a STREAM (POSIX.1 XSI STREAMS option)

const ENOTBLK: c_int

Block device required. A block device operation was attempted on a non-block device or file. (linux, FreeBSD)

const ENOTUNIQ: c_int

Name not unique on network (linux only)

const EPFNOSUPPORT: c_int

Protocol family not supported. The protocol family has not been configured into the system or no implementation for it exists. (linux, FreeBSD)

const EREMCHG: c_int

Remote address changed (linux only)

const EREMOTE: c_int

Object is remote (linux only)

const EREMOTEIO: c_int

Remote I/O error (linux only)

const ERESTART: c_int

Interrupted system call should be restarted (linux only)

const ESHUTDOWN: c_int

Can’t send after socket shutdown. A request to send data was disallowed because the socket had already been shut down with a previous shutdown system call.

const ESOCKTNOSUPPORT: c_int

Socket type not supported. The support for the socket type has not been configured into the system or no implementation for it exists. (linux, FreeBSD)

const ESTRPIPE: c_int

Streams pipe error (linux only)

const ETIME: c_int

Timer expired (POSIX.1 XSI STREAMS option)

const EUCLEAN: c_int

Structure needs cleaning (linux only)

const EUNATCH: c_int

Protocol driver not attached (linux only)

const EUSERS: c_int

Too many users. The quota system ran out of table entries. (linux, FreeBSD)

const EXFULL: c_int

Exchange full (linux only)