1
0
mirror of https://github.com/PDP-10/its.git synced 2026-03-29 19:08:01 +00:00
Files
PDP-10.its/c20/new/doc/jsys.doc
2018-05-15 07:06:17 +02:00

69 lines
2.1 KiB
Plaintext

System Interface (JSYS Calls)
Arbitrary monitor functions (JSYS Calls) may be performed from a
TOPS-20 C program through the use of the _jsys function. If you use
this function, you should have
# include <jsys.h>
near the beginning of your file.
The _jsys function is invoked as follows:
_jsys(num, acp);
The first argument num is the number of the desired jsys. These are
#defined mnemonically in jsys.h, so you can just place the jsys name
(in caps) here. The second argument is a pointer to an object of type
acblk, defined in jsys.h. This object is a structure containing four
elements t1, t2, t3, and t4. The contents of these elements will be
copied into AC's 1 - 4 before the specified JSYS is executed.
_jsys returns 0 if the JSYS was successful, or the resulting system
error number if the call was unsuccessful. Additionally, the elements
of the acblk structure pointed to by acp will be set to the value of
AC's 1 - 4 after the JSYS call, whether or not an error occurred. Note
that erjmp is used to detect JSYS errors, so that any element of the
acblk which would normally contain an error code may be invalid on an
error return. Always use the value returned by _jsys to obtain the
error code.
Auxiliary Functions
The function _erstr can be used to translate an error number returned
by _jsys (or obtained from anywhere else, for that matter) into the
corresponding system error message. The function is called as follows:
_erstr(error, buf, size)
error is the system error number, buf is a pointer to a character
array in which the error string is to be written, and size is the
maximum allowable length of the error message string.
Example
The following simple program executes the GTRPI system call to obtain
pager information for itself and prints the results on the standard
output. If an error occurs during the system call, the applicable
error message is also printed.
#include <stdio.h>
#include <jsys.h>
acblk foo;
main()
{
acblk *ap = &foo;
int res;
char buf[100];
ap->t1 = 0400000; /* process handle for ourself */
res = _jsys(GTRPI,ap);
printf("%o,%o,%o\n", ap->t1,ap->t2,ap->t3);
if (res) {
_erstr(res,buf,100);
printf(buf);
}
}