[Next] [Prev] [Right] [Left] [Up] [Index] [Root]
System Calls

System Calls

Alarm(s)
A procedure which when used on UNIX systems, sends the signal SIGALRM to the Magma process after s seconds. This allows the user to specify that a Magma-process should self-destruct after a certain period.
ChangeDirectory(s) : MonStgElt ->
Procedure. Change to the directory specified by the string s. Tilde expansion is allowed.
GetCurrentDirectory() : ->
Returns the current directory as a string.
Getpid() : ->
Returns Magma's process ID (value of getpid()).
Pipe(C, S) : MonStgElt, MonStgElt -> MonStgElt
Given a shell command C and an input string S, create a pipe to the command C, send S into the standard input of C, and return the output of C as a string. Note that for many commands, S should finish with a new line character if it consists of only one line.
System(c)
System(C) : MonStgElt -> RngIntElt
Procedure or function. Execute the system command specified by the string C. If used as a function rather than a procedure, also returns the system command's return value as an integer; this can be used for error-checking. See also the Pipe intrinsic function.
%! shell-command
Execute the given command in the Unix shell then return to Magma. Note that this type of shell escape (contrary to the one using a System call) takes place entirely outside Magma and does not show up in Magma's history.
[Next] [Prev] [Right] [Left] [Up] [Index] [Root]