1984-07-12 15:18:13 +00:00
|
|
|
.\" $Header$
|
1991-10-01 12:18:39 +00:00
|
|
|
.TH LIBMON 7 "$Revision$"
|
1984-07-12 14:14:54 +00:00
|
|
|
.ad
|
|
|
|
.SH NAME
|
|
|
|
libmon \- library of system call routines with EM calling sequence
|
|
|
|
.SH DESCRIPTION
|
|
|
|
The modules in this library contain the UNIX system calls with EM calling sequence.
|
|
|
|
This library is written in EM assembly language and can be used
|
1986-01-20 20:39:09 +00:00
|
|
|
for interpreted programs, and \fIa.out\fP programs.
|
1984-07-12 14:14:54 +00:00
|
|
|
If these routines are used in Pascal programs, then the calling sequence
|
|
|
|
requires some attention.
|
|
|
|
Some hints may be useful:
|
|
|
|
.IP -
|
1991-11-22 11:10:09 +00:00
|
|
|
The c-option {$c+} allows declaration of zero-terminated string
|
1984-07-12 14:14:54 +00:00
|
|
|
constants in Pascal like "/etc/passwd".
|
1986-01-20 20:39:09 +00:00
|
|
|
Moreover, the identifier \fIstring\fP is then defined as type identifier for
|
1984-07-12 14:14:54 +00:00
|
|
|
a pointer to these zero-terminated strings.
|
|
|
|
.IP -
|
1991-11-22 11:10:09 +00:00
|
|
|
The d-option {$d+} allows the use of double precision integers (longs).
|
1984-07-12 14:14:54 +00:00
|
|
|
The lseek system call, for instance, needs a long argument and returns a long result.
|
|
|
|
.IP -
|
1986-01-20 20:39:09 +00:00
|
|
|
If the system call requires a pointer as argument use a \fIvar\fP parameter.
|
1984-07-12 14:14:54 +00:00
|
|
|
For instance declare times as:
|
|
|
|
.br
|
|
|
|
procedure times(var t:timesbuf); extern;
|
|
|
|
.br
|
1986-01-20 20:39:09 +00:00
|
|
|
Note that a \fIstring\fP is already a pointer.
|
1984-07-12 14:14:54 +00:00
|
|
|
.IP -
|
|
|
|
When defining types, use packed records if two bytes must be allocated
|
|
|
|
in a single word, as in
|
|
|
|
.br
|
|
|
|
device = packed record
|
|
|
|
.br
|
|
|
|
minor,major:0..255;
|
|
|
|
.br
|
|
|
|
end;
|
|
|
|
.IP -
|
|
|
|
If a collection of bits is needed, then define an enumerated type and
|
|
|
|
a set of this enumerated type. The create mode of a file, for example,
|
|
|
|
can be declared as:
|
|
|
|
.br
|
|
|
|
modebits = (XHIM,WHIM,RHIM,
|
|
|
|
.br
|
|
|
|
XYOU,WYOU,RYOU,
|
|
|
|
.br
|
|
|
|
XME, WME, RME,
|
|
|
|
.br
|
|
|
|
TEXT,SGID,SUID,... );
|
|
|
|
.br
|
|
|
|
creatmode = set of XHIM..SUID;
|
|
|
|
.IP -
|
1986-01-20 20:39:09 +00:00
|
|
|
There are special system call routines \fIuread\fP and \fIuwrite\fP
|
1987-03-02 13:30:52 +00:00
|
|
|
in libpc(7),
|
1986-01-20 20:39:09 +00:00
|
|
|
because the names \fIread\fP and \fIwrite\fP
|
|
|
|
are blocked by similar functions in Pascal.
|
1984-07-12 14:14:54 +00:00
|
|
|
.PP
|
1986-01-20 20:39:09 +00:00
|
|
|
The system call \fIsignal\fP exists, but uses \fIsigtrp\fP.
|
1984-07-12 14:14:54 +00:00
|
|
|
This EM system call has the
|
|
|
|
following calling sequence:
|
|
|
|
.br
|
|
|
|
function sigtrp(signo,trapno:integer):integer;
|
|
|
|
.br
|
1986-01-20 20:39:09 +00:00
|
|
|
The action values of \fIsignal\fP, odd for \fIignore\fP and zero
|
|
|
|
for \fIget back to default\fP,
|
1984-07-12 14:14:54 +00:00
|
|
|
may interfere with the EM procedure identification in some
|
|
|
|
implementations.
|
|
|
|
In most interpreters procedures in EM are numbered consecutively from zero up.
|
1986-01-20 20:39:09 +00:00
|
|
|
The first argument of \fIsigtrp\fP is the signal number \fIsigno\fP
|
|
|
|
as for \fIsignal\fP.
|
|
|
|
The second argument is an integer \fItrapno\fP,
|
|
|
|
indicating the action to be performed
|
1984-07-12 14:14:54 +00:00
|
|
|
when the signal is issued:
|
|
|
|
.IP -2 8
|
1986-01-20 20:39:09 +00:00
|
|
|
Reset the action for signal \fIsigno\fP to the default.
|
1984-07-12 14:14:54 +00:00
|
|
|
.IP -3
|
1986-01-20 20:39:09 +00:00
|
|
|
Ignore signal \fIsigno\fP.
|
1984-07-12 14:14:54 +00:00
|
|
|
.IP "0-252"
|
1986-01-20 20:39:09 +00:00
|
|
|
Perform an EM instruction TRP with error code \fItrapno\fP,
|
|
|
|
whenever the signal \fIsigno\fP is issued.
|
1984-07-12 14:14:54 +00:00
|
|
|
Note that the error codes 0-127 are reserved for EM machine errors
|
|
|
|
and language runtime system errors.
|
|
|
|
.PP
|
1986-01-20 20:39:09 +00:00
|
|
|
The routine \fIsigtrp\fP returns the old \fItrapno\fP or -1 if an erroneous
|
1984-07-12 14:14:54 +00:00
|
|
|
signal number is specified.
|
|
|
|
Only the signal numbers 1, 2, 3, 13, 14, 15 and 16 may be used as argument
|
1986-01-20 20:39:09 +00:00
|
|
|
for \fIsigtrp\fP.
|
1984-07-12 14:14:54 +00:00
|
|
|
.SH FILES
|
1987-03-02 13:30:52 +00:00
|
|
|
.IP ~em/lib/*/tail_mon
|
1984-07-12 14:14:54 +00:00
|
|
|
.PD
|
|
|
|
.SH "SEE ALSO"
|
1987-03-02 13:30:52 +00:00
|
|
|
em(1), ack(1), *(2), libpc(7)
|
1984-07-12 14:14:54 +00:00
|
|
|
.SH DIAGNOSTICS
|
1986-01-20 20:39:09 +00:00
|
|
|
All routines put the UNIX error code in the global variable \fIerrno\fP.
|
1984-07-12 14:14:54 +00:00
|
|
|
Errno is not cleared by successful system calls, so it always gives
|
|
|
|
the error of the last failed call.
|
|
|
|
One exception: ptrace clears errno when successful.
|
|
|
|
.SH AUTHOR
|
|
|
|
Ed Keizer, Vrije Universiteit
|
|
|
|
.SH BUGS
|
|
|
|
There should be additional routines giving a fatal error when they fail.
|
|
|
|
It would be pleasant to have routines,
|
|
|
|
which print a nice message and stop execution for unexpected errors.
|