Oberon || Library || Module Index || Search Engine || Definition || Module

Ulm's Oberon Library:


SysErrors - handling of system call errors


CONST textlen = 512;
CONST ncodes = 152; (* number of error codes *)

TYPE Name = ARRAY 20 OF CHAR; TYPE Event = POINTER TO EventRec; TYPE EventRec = RECORD (Events.EventRec) errno: INTEGER; syscall: INTEGER; (* number of system call *) text: ARRAY textlen OF CHAR; END;

VAR message: ARRAY ncodes OF Events.Message; VAR name: ARRAY ncodes OF Name; VAR syserrors: Events.EventType; VAR syserror: ARRAY ncodes OF Events.EventType;

PROCEDURE Raise(errors: RelatedEvents.Object; errno, syscall: INTEGER; text: ARRAY OF CHAR);


SysErrors offers a standardized error handling for failed system calls. The error numbers and texts are generated from /usr/include/sys/errno.h: message contains the comment and name the short name (the prepocessor symbol in errno.h). E.g.
#define	ENOENT	2	/* No such file or directory		*/
is converted to
CONST noent = 2;
and name[noent] equals "ENOENT" and message[noent] contains "No such file or directory".

Raise raises the system event syserror[errno] and syserrors. The first event allows error-specific handling, the second event is for general system error handling. errno must not exceed ncodes-1. Further, the syserrors event is passed to RelatedEvents if errors does not equal NIL. All system error events are ignored by default.


description of system call errors
event handling
handling of related events




The constant names for the error codes depend on the current UNIX version and thus change very often.

There should be system-call specific events, e.g. an event for failed open system calls.

Edited by: borchert, last change: 2000/11/16, revision: 1.8, converted to HTML: 2000/11/17

Oberon || Library || Module Index || Search Engine || Definition || Module