<html> <head> <link rel="stylesheet" href="style.css" type="text/css"> <link rel="Start" href="index.html"> <link rel="previous" href="StringLabels.html"> <link rel="next" href="Thread.html"> <link rel="Up" href="index.html"> <link title="Index of types" rel=Appendix href="index_types.html"> <link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> <link title="Index of values" rel=Appendix href="index_values.html"> <link title="Index of modules" rel=Appendix href="index_modules.html"> <link title="Index of module types" rel=Appendix href="index_module_types.html"> <link title="Arg" rel="Chapter" href="Arg.html"> <link title="Arith_status" rel="Chapter" href="Arith_status.html"> <link title="Array" rel="Chapter" href="Array.html"> <link title="ArrayLabels" rel="Chapter" href="ArrayLabels.html"> <link title="Big_int" rel="Chapter" href="Big_int.html"> <link title="Bigarray" rel="Chapter" href="Bigarray.html"> <link title="Buffer" rel="Chapter" href="Buffer.html"> <link title="Callback" rel="Chapter" href="Callback.html"> <link title="CamlinternalOO" rel="Chapter" href="CamlinternalOO.html"> <link title="Char" rel="Chapter" href="Char.html"> <link title="Complex" rel="Chapter" href="Complex.html"> <link title="Condition" rel="Chapter" href="Condition.html"> <link title="Dbm" rel="Chapter" href="Dbm.html"> <link title="Digest" rel="Chapter" href="Digest.html"> <link title="Dynlink" rel="Chapter" href="Dynlink.html"> <link title="Event" rel="Chapter" href="Event.html"> <link title="Filename" rel="Chapter" href="Filename.html"> <link title="Format" rel="Chapter" href="Format.html"> <link title="Gc" rel="Chapter" href="Gc.html"> <link title="Genlex" rel="Chapter" href="Genlex.html"> <link title="Graphics" rel="Chapter" href="Graphics.html"> <link title="GraphicsX11" rel="Chapter" href="GraphicsX11.html"> <link title="Hashtbl" rel="Chapter" href="Hashtbl.html"> <link title="Int32" rel="Chapter" href="Int32.html"> <link title="Int64" rel="Chapter" href="Int64.html"> <link title="Lazy" rel="Chapter" href="Lazy.html"> <link title="Lexing" rel="Chapter" href="Lexing.html"> <link title="List" rel="Chapter" href="List.html"> <link title="ListLabels" rel="Chapter" href="ListLabels.html"> <link title="Map" rel="Chapter" href="Map.html"> <link title="Marshal" rel="Chapter" href="Marshal.html"> <link title="MoreLabels" rel="Chapter" href="MoreLabels.html"> <link title="Mutex" rel="Chapter" href="Mutex.html"> <link title="Nativeint" rel="Chapter" href="Nativeint.html"> <link title="Num" rel="Chapter" href="Num.html"> <link title="Obj" rel="Chapter" href="Obj.html"> <link title="Oo" rel="Chapter" href="Oo.html"> <link title="Parsing" rel="Chapter" href="Parsing.html"> <link title="Pervasives" rel="Chapter" href="Pervasives.html"> <link title="Printexc" rel="Chapter" href="Printexc.html"> <link title="Printf" rel="Chapter" href="Printf.html"> <link title="Queue" rel="Chapter" href="Queue.html"> <link title="Random" rel="Chapter" href="Random.html"> <link title="Scanf" rel="Chapter" href="Scanf.html"> <link title="Set" rel="Chapter" href="Set.html"> <link title="Sort" rel="Chapter" href="Sort.html"> <link title="Stack" rel="Chapter" href="Stack.html"> <link title="StdLabels" rel="Chapter" href="StdLabels.html"> <link title="Str" rel="Chapter" href="Str.html"> <link title="Stream" rel="Chapter" href="Stream.html"> <link title="String" rel="Chapter" href="String.html"> <link title="StringLabels" rel="Chapter" href="StringLabels.html"> <link title="Sys" rel="Chapter" href="Sys.html"> <link title="Thread" rel="Chapter" href="Thread.html"> <link title="ThreadUnix" rel="Chapter" href="ThreadUnix.html"> <link title="Tk" rel="Chapter" href="Tk.html"> <link title="Unix" rel="Chapter" href="Unix.html"> <link title="UnixLabels" rel="Chapter" href="UnixLabels.html"> <link title="Weak" rel="Chapter" href="Weak.html"><link title="Signal handling" rel="Section" href="#6_Signalhandling"> <link title="Signal numbers for the standard POSIX signals." rel="Subsection" href="#7_SignalnumbersforthestandardPOSIXsignals"> <title>Sys</title> </head> <body> <div class="navbar"><a href="StringLabels.html">Previous</a> <a href="index.html">Up</a> <a href="Thread.html">Next</a> </div> <center><h1>Module <a href="type_Sys.html">Sys</a></h1></center> <br> <pre><span class="keyword">module</span> Sys: <code class="type">sig end</code></pre><div class="info"> System interface.<br> </div> <hr width="100%"> <pre><span class="keyword">val</span> <a name="VALargv"></a>argv : <code class="type">string array</code></pre><div class="info"> The command line arguments given to the process. The first element is the command name used to invoke the program. The following elements are the command-line arguments given to the program.<br> </div> <pre><span class="keyword">val</span> <a name="VALexecutable_name"></a>executable_name : <code class="type">string</code></pre><div class="info"> The name of the file containing the executable currently running.<br> </div> <pre><span class="keyword">val</span> <a name="VALfile_exists"></a>file_exists : <code class="type">string -> bool</code></pre><div class="info"> Test if a file with the given name exists.<br> </div> <pre><span class="keyword">val</span> <a name="VALremove"></a>remove : <code class="type">string -> unit</code></pre><div class="info"> Remove the given file name from the file system.<br> </div> <pre><span class="keyword">val</span> <a name="VALrename"></a>rename : <code class="type">string -> string -> unit</code></pre><div class="info"> Rename a file. The first argument is the old name and the second is the new name.<br> </div> <pre><span class="keyword">val</span> <a name="VALgetenv"></a>getenv : <code class="type">string -> string</code></pre><div class="info"> Return the value associated to a variable in the process environment. Raise <code class="code"><span class="constructor">Not_found</span></code> if the variable is unbound.<br> </div> <pre><span class="keyword">val</span> <a name="VALcommand"></a>command : <code class="type">string -> int</code></pre><div class="info"> Execute the given shell command and return its exit code.<br> </div> <pre><span class="keyword">val</span> <a name="VALtime"></a>time : <code class="type">unit -> float</code></pre><div class="info"> Return the processor time, in seconds, used by the program since the beginning of execution.<br> </div> <pre><span class="keyword">val</span> <a name="VALchdir"></a>chdir : <code class="type">string -> unit</code></pre><div class="info"> Change the current working directory of the process.<br> </div> <pre><span class="keyword">val</span> <a name="VALgetcwd"></a>getcwd : <code class="type">unit -> string</code></pre><div class="info"> Return the current working directory of the process.<br> </div> <pre><span class="keyword">val</span> <a name="VALinteractive"></a>interactive : <code class="type">bool <a href="Pervasives.html#TYPEref">Pervasives.ref</a></code></pre><div class="info"> This reference is initially set to <code class="code"><span class="keyword">false</span></code> in standalone programs and to <code class="code"><span class="keyword">true</span></code> if the code is being executed under the interactive toplevel system <code class="code">ocaml</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALos_type"></a>os_type : <code class="type">string</code></pre><div class="info"> Operating system currently executing the Caml program. One of <code class="code"><span class="string">"Unix"</span></code> (for all Unix versions, including Linux and Mac OS X), <code class="code"><span class="string">"Win32"</span></code> (for MS-Windows, OCaml compiled with MSVC++), <code class="code"><span class="string">"Cygwin"</span></code> (for MS-Windows, OCaml compiled with Cygwin), <code class="code"><span class="string">"MacOS"</span></code> (for MacOS 9).<br> </div> <pre><span class="keyword">val</span> <a name="VALword_size"></a>word_size : <code class="type">int</code></pre><div class="info"> Size of one word on the machine currently executing the Caml program, in bits: 32 or 64.<br> </div> <pre><span class="keyword">val</span> <a name="VALmax_string_length"></a>max_string_length : <code class="type">int</code></pre><div class="info"> Maximum length of a string.<br> </div> <pre><span class="keyword">val</span> <a name="VALmax_array_length"></a>max_array_length : <code class="type">int</code></pre><div class="info"> Maximum length of an array.<br> </div> <br> <br> <a name="6_Signalhandling"></a> <table cellpadding=5 cellspacing=5 width="100%"> <tr class="title6"><td><div align=center> <span class="title6">Signal handling</span> </div> </td> </tr> </table> <br><br> <br><code><span class="keyword">type</span> <a name="TYPEsignal_behavior"></a>signal_behavior =<br></code><table border="0" cellpadding="1"> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span class="constructor">Signal_default</span></code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span class="constructor">Signal_ignore</span></code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span class="constructor">Signal_handle</span> <span class="keyword">of</span> <code class="type">(int -> unit)</code></code></td> <td align="left" valign="top" ><code>(*</code></td><td align="left" valign="top" ><code>What to do when receiving a signal:<ul> <li><code class="code"><span class="constructor">Signal_default</span></code>: take the default behavior (usually: abort the program)</li> <li><code class="code"><span class="constructor">Signal_ignore</span></code>: ignore the signal</li> <li><code class="code"><span class="constructor">Signal_handle</span> f</code>: call function <code class="code">f</code>, giving it the signal number as argument.</li> </ul> </code></td><td align="left" valign="bottom" ><code>*)</code></td> </tr></table> <br> <pre><span class="keyword">val</span> <a name="VALsignal"></a>signal : <code class="type">int -> <a href="Sys.html#TYPEsignal_behavior">signal_behavior</a> -> <a href="Sys.html#TYPEsignal_behavior">signal_behavior</a></code></pre><div class="info"> Set the behavior of the system on receipt of a given signal. The first argument is the signal number. Return the behavior previously associated with the signal.<br> </div> <pre><span class="keyword">val</span> <a name="VALset_signal"></a>set_signal : <code class="type">int -> <a href="Sys.html#TYPEsignal_behavior">signal_behavior</a> -> unit</code></pre><div class="info"> Same as <a href="Sys.html#VALsignal"><code class="code"><span class="constructor">Sys</span>.signal</code></a> but return value is ignored.<br> </div> <br> <br> <a name="7_SignalnumbersforthestandardPOSIXsignals"></a> <table cellpadding=5 cellspacing=5 width="100%"> <tr class="title7"><td><div align=center> <span class="title7">Signal numbers for the standard POSIX signals.</span> </div> </td> </tr> </table> <br><br> <pre><span class="keyword">val</span> <a name="VALsigabrt"></a>sigabrt : <code class="type">int</code></pre><div class="info"> Abnormal termination<br> </div> <pre><span class="keyword">val</span> <a name="VALsigalrm"></a>sigalrm : <code class="type">int</code></pre><div class="info"> Timeout<br> </div> <pre><span class="keyword">val</span> <a name="VALsigfpe"></a>sigfpe : <code class="type">int</code></pre><div class="info"> Arithmetic exception<br> </div> <pre><span class="keyword">val</span> <a name="VALsighup"></a>sighup : <code class="type">int</code></pre><div class="info"> Hangup on controlling terminal<br> </div> <pre><span class="keyword">val</span> <a name="VALsigill"></a>sigill : <code class="type">int</code></pre><div class="info"> Invalid hardware instruction<br> </div> <pre><span class="keyword">val</span> <a name="VALsigint"></a>sigint : <code class="type">int</code></pre><div class="info"> Interactive interrupt (ctrl-C)<br> </div> <pre><span class="keyword">val</span> <a name="VALsigkill"></a>sigkill : <code class="type">int</code></pre><div class="info"> Termination (cannot be ignored)<br> </div> <pre><span class="keyword">val</span> <a name="VALsigpipe"></a>sigpipe : <code class="type">int</code></pre><div class="info"> Broken pipe<br> </div> <pre><span class="keyword">val</span> <a name="VALsigquit"></a>sigquit : <code class="type">int</code></pre><div class="info"> Interactive termination<br> </div> <pre><span class="keyword">val</span> <a name="VALsigsegv"></a>sigsegv : <code class="type">int</code></pre><div class="info"> Invalid memory reference<br> </div> <pre><span class="keyword">val</span> <a name="VALsigterm"></a>sigterm : <code class="type">int</code></pre><div class="info"> Termination<br> </div> <pre><span class="keyword">val</span> <a name="VALsigusr1"></a>sigusr1 : <code class="type">int</code></pre><div class="info"> Application-defined signal 1<br> </div> <pre><span class="keyword">val</span> <a name="VALsigusr2"></a>sigusr2 : <code class="type">int</code></pre><div class="info"> Application-defined signal 2<br> </div> <pre><span class="keyword">val</span> <a name="VALsigchld"></a>sigchld : <code class="type">int</code></pre><div class="info"> Child process terminated<br> </div> <pre><span class="keyword">val</span> <a name="VALsigcont"></a>sigcont : <code class="type">int</code></pre><div class="info"> Continue<br> </div> <pre><span class="keyword">val</span> <a name="VALsigstop"></a>sigstop : <code class="type">int</code></pre><div class="info"> Stop<br> </div> <pre><span class="keyword">val</span> <a name="VALsigtstp"></a>sigtstp : <code class="type">int</code></pre><div class="info"> Interactive stop<br> </div> <pre><span class="keyword">val</span> <a name="VALsigttin"></a>sigttin : <code class="type">int</code></pre><div class="info"> Terminal read from background process<br> </div> <pre><span class="keyword">val</span> <a name="VALsigttou"></a>sigttou : <code class="type">int</code></pre><div class="info"> Terminal write from background process<br> </div> <pre><span class="keyword">val</span> <a name="VALsigvtalrm"></a>sigvtalrm : <code class="type">int</code></pre><div class="info"> Timeout in virtual time<br> </div> <pre><span class="keyword">val</span> <a name="VALsigprof"></a>sigprof : <code class="type">int</code></pre><div class="info"> Profiling interrupt<br> </div> <pre><span class="keyword">exception</span> <a name="EXCEPTIONBreak"></a>Break</pre> <div class="info"> Exception raised on interactive interrupt if <a href="Sys.html#VALcatch_break"><code class="code"><span class="constructor">Sys</span>.catch_break</code></a> is on.<br> </div> <pre><span class="keyword">val</span> <a name="VALcatch_break"></a>catch_break : <code class="type">bool -> unit</code></pre><div class="info"> <code class="code">catch_break</code> governs whether interactive interrupt (ctrl-C) terminates the program or raises the <code class="code"><span class="constructor">Break</span></code> exception. Call <code class="code">catch_break <span class="keyword">true</span></code> to enable raising <code class="code"><span class="constructor">Break</span></code>, and <code class="code">catch_break <span class="keyword">false</span></code> to let the system terminate the program on user interrupt.<br> </div> <pre><span class="keyword">val</span> <a name="VALocaml_version"></a>ocaml_version : <code class="type">string</code></pre><div class="info"> <code class="code">ocaml_version</code> is the version of Objective Caml. It is a string of the form <code class="code"><span class="string">"major.minor[additional-info]"</span></code> Where major and minor are integers, and <code class="code">additional-info</code> is a string that is empty or starts with a '+'.<br> </div> </body></html>