{Begin SubSec Miscellaneous Operating System Functions}
{Title Miscellaneous Operating System Functions}
{Text


{FnDef {FnName LOADAV} {FnArgs }
{Text
Returns the current load average as a floating point number (this number is the first of the three printed by the {lisp SYSTAT} command).
}}



{FnDef {FnName ERSTR} {FnArgs ERN {anonarg}}
{Text
{arg ERN} is an error number from a {index JSYS FN}JSYS fail return.  {arg ERN}={lisp NIL} means the most recent error.  {fn ERSTR} returns the operating system error diagnostic as a string.
}}



{FnDef {FnName JSYS} {FnArgs N AC1 AC2 AC3 RESULTAC}
{Text
Loads the (unboxed) values of {arg AC1}, {arg AC2}, and {arg AC3} into
appropriate accumulaters, and executes JSYS number {arg N}.  If {arg AC1}, {arg AC2}, or {arg AC3}={lisp NIL}, 0 is used.  {fn JSYS} returns the (boxed) contents of the accumulator specified by {arg RESULTAC}, i.e., 1 means {arg AC1}, 2 means {arg AC2}, and 3 means {arg AC3},  with {lisp NIL} equivalent to 1.  Compiles open if {arg N} is itself a small integer, and {arg RESULTAC} is a small integer, or {lisp NIL}.

If the JSYS causes a trap, the message {index TRAP AT LOCATION Error}{lisp TRAP AT LOCATION {arg NNNNN}} is printed by the operating system, followed by {index JSYS ERROR Error}{lisp JSYS ERROR:} and the operating system diagnostic.  The user is then talking to the operating system exactly as though control-C had been typed.  If the user then continues using the {lisp CONTINUE} command, an Interlisp error is generated, {lisp JSYS ERROR}, and control then proceeds the same as for any other flavor of error, i.e. unwinds to last {fn ERRORSET} or goes into a break as described on {PageRef Tag WhenToBreak}.


The CJSYS package ({PageRef Tag CJSYS}) enables calling JSYSes by their corresponding name, rather than their number.
}}





{FnDef {FnName USERNUMBER} {FnArgs A FLG}
{Text
If {arg A}={lisp NIL}, returns the login user number; if {arg A}={lisp T}, returns the connected user number; if {arg A} is a literal atom or string, {fn USERNUMBER} returns the number of the corresponding user, or {lisp NIL} if no such user exists.

On TOPS-20, there is a difference between the user number, which is associated with the job, and the directory number, which is associated with the file system. Therefore, on TOPS-20, if {arg FLG}={lisp T}, {fn USERNUMBER} returns the directory number rather than the user number.
}}



{FnDef {FnName HOSTNAME} {FnArgs HOSTN FLG}
{Text
Returns the hostname as a string for host number {arg HOSTN}, e.g. {lisp "PARC-MAXC2"}, {lisp "BBN-TENEXD"}, etc.  If {arg HOSTN}={lisp NIL}, the local host is used.  If the local host is not an arpanet host, value is {lisp NIL}.  Also returns {lisp NIL} if {arg HOSTN} is not a valid host number.

{arg FLG} is interpreted the same as in {fn USERNAME}.
}}



{FnDef {FnName HOSTNUMBER} {FnArgs }
{Text
Returns the host numer of the local host, or {lisp NIL}, if the local host is not an arpanet host.
}}




{FnDef {FnName TENEX} {FnArgs STR FILEFLG}
{Text
Starts up a lower exec (without a message) using {fn SUBSYS}, and then if {arg FILEFLG}={lisp NIL} unreads {arg STR}, followed by {lisp "QUIT"}{foot
{lisp "POP"} for Interlisp on TOPS-20.
}{comment endfootnote}
(using {index BKSYSBUF FN}{fn BKSYSBUF}, {PageRef Fn BKSYSBUF}).
{fn TENEX} returns {lisp T} if all of {arg STR} is actually processed/read by the lower exec, {lisp NIL} if the user control-C's and manually QUIT's back to Interlisp.

If {arg FILEFLG}={lisp T}, {fn TENEX} passes the string as the second argument to {fn SUBSYS}, instead of unreading it.  This has the advantage that {arg STR} can be of any length, and also that typeahead will not interfere with the call to the lower exec.  The disadvantage is that {fn TENEX} cannot tell whether the commands to the lower exec terminated successfully, or were aborted.  Thus, if {arg FILEFLG}={lisp T}, the value of {fn TENEX} is always {lisp T}.

For example, {fn LISTFILES} ({PageRef Fn LISTFILES}) is implemented using {fn TENEX}, with {arg FILEFLG}={lisp NIL}, so {fn LISTFILES} can tell if listings actually were completed.
}}


}{End SubSec Miscellaneous Operating System Functions}