% ----------------------------------------------------------------------------
% - ref-sys-2.tex                                                            -
% - aleph documentation - standard system library - function references      -
% ----------------------------------------------------------------------------
% - This program is  free software;  you can  redistribute it and/or  modify -
% - it provided that this copyright notice is kept intact.                   -
% -                                                                          -
% - This  program  is  distributed in the hope  that it  will be useful, but -
% - without  any   warranty;  without  even   the   implied    warranty   of -
% - merchantability  or fitness for a particular purpose. In not event shall -
% - the copyright holder be  liable for  any direct, indirect, incidental or -
% - special damages arising in any way out of the use of this software.      -
% ----------------------------------------------------------------------------
% - copyright (c) 1999-2003 amaury darsch                                    -
% ----------------------------------------------------------------------------

\chapter{System Calls}

This chapter is a reference of the Aleph system calls. The functions
described here are part of the \textbf{aleph-sys} library. The library
must be loaded prior any use of these functions. Once the library is
loaded, all functions are located in the \textbf{aleph:sys} nameset.

\begin{table}[ht]
\begin{tabularx}{\linewidth}{|p{2in}|X|}
\hline
\textbf{Function} & \textbf{Description}\\
\hline\hline
exit               & exit unconditionally with an exit code\\
sleep              & pause for a certain time\\
random             & return a random integer number\\
get-pid            & get the process identifier\\
get-env            & get an environment variable\\
get-host-name      & return the host name\\
get-user-name      & return the user name\\
\hline
\end{tabularx}
\caption{Aleph system call functions}
\end{table}

\appfunction{aleph:sys}{exit}
\begin{mlist}
\item[return]    \texttt{none}
\item[arguments] \texttt{Integer}
\end{mlist}
The \textbt{exit} function exit unconditionally with the exit code as
the argument.

\appfunction{aleph:sys}{sleep}
\begin{mlist}
\item[return]    \texttt{none}
\item[arguments] \texttt{Integer}
\end{mlist}
The \textbt{sleep} function pause the specific thread for a certain
time. The time argument is expressed in milliseconds. This function
returns nil.

\appfunction{aleph:sys}{random}
\begin{mlist}
\item[return]    \texttt{Integer}
\item[arguments] \texttt{none}
\end{mlist}
The \textbt{random} function returns a random integer number. The
function is protected by a mutex. A calling thread will block until
the other one has completed the call.

\appfunction{aleph:sys}{get-pid}
\begin{mlist}
\item[return]    \texttt{Integer}
\item[arguments] \texttt{none}
\end{mlist}
The \textbt{get-pid} function returns the process identifier
(pid). The returned value is a positive integer.

\appfunction{aleph:sys}{get-env}
\begin{mlist}
\item[return]    \texttt{String}
\item[arguments] \texttt{String}
\end{mlist}
The \textbt{get-env} function returns the environment variable
associated with the string argument. If the environment does not exist
an exception is raised.

\appfunction{aleph:sys}{get-host-name}
\begin{mlist}
\item[return]    \texttt{String}
\item[arguments] \texttt{none}
\end{mlist}
The \textbt{get-host-name} function returns the host name. The host name can be
either a simple name or a canonical name with its domain, depending on the
system configuration.

\appfunction{aleph:sys}{get-user-name}
\begin{mlist}
\item[return]    \texttt{String}
\item[arguments] \texttt{none}
\end{mlist}
The \textbt{get-user-name} function returns the current user name. 

% LocalWords:  tex darsch pt nameset pid env mutex amaury
