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


Ulm's Oberon Library:
SysResources


NAME

SysResources - control maximum system resource consumption

SYNOPSIS

(* type of resource *)
CONST cpu = 0;     (* maximum amount of cpu time *)
CONST fsize = 1;   (* largest size of a single file that may be created*)
CONST data = 2;    (* maximum size of the data segment *)
CONST stack = 3;   (* maximum size of the stack segment *)
CONST core = 4;    (* maximal core file size *)
CONST nofile = 5;  (* maximal number of open file descriptors *)
CONST vmem = 6;    (* maximum mapped memory *)
TYPE Resource = INTEGER; (* cpu..vmem *)
TYPE Limit =
      RECORD
         current: INTEGER; (* current soft limit *)
         max: INTEGER;     (* hard limit *)
      END;
CONST infinity = MAX(INTEGER);


PROCEDURE GetLimit(resource: Resource; VAR limit: Limit); PROCEDURE SetLimit(resource: Resource; limit: Limit; errors: RelatedEvents.Object) : BOOLEAN;

DESCRIPTION

GetLimit and SetLimit allow to retrieve and modify a set of system per process resource limits. These resources and their associated limits are explained in detail in getrlimit(2). Signals are sent to the offending process when soft limits are exceeded while hard limits cause some kind of failure (or even termination in case of cpu). Limits are inherited to child processes.

DIAGNOSTICS

SetLimit returns FALSE in error case (e.g. if a non-superuser tries to raise the hard limit). The errors parameter is passed to SysErrors.Raise.

SEE ALSO

getrlimit(2)
GetLimit and SetLimit
Events
event handling
SysErrors
handling of failed system calls
SysSignals
UNIX signals

Edited by: borchert, last change: 2001/04/20, revision: 1.5, converted to HTML: 2001/04/20

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