File: Sys.html

package info (click to toggle)
ocaml-doc 3.10-1
  • links: PTS, VCS
  • area: non-free
  • in suites: lenny
  • size: 7,476 kB
  • ctags: 2,644
  • sloc: ml: 325; sh: 64; makefile: 34; ansic: 15
file content (293 lines) | stat: -rw-r--r-- 17,996 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<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="CamlinternalMod" rel="Chapter" href="CamlinternalMod.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>
&nbsp;<a href="index.html">Up</a>
&nbsp;<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="code"><span class="keyword">sig</span></code> <a href="Sys.html">..</a> <code class="code"><span class="keyword">end</span></code></pre>System interface.<br>
<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="VALis_directory"></a>is_directory : <code class="type">string -> bool</code></pre><div class="info">
Returns <code class="code"><span class="keyword">true</span></code> if the given name refers to a directory,
    <code class="code"><span class="keyword">false</span></code> if it refers to another kind of file.
    Raise <code class="code"><span class="constructor">Sys_error</span></code> if no file exists with the given name.<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. If there is already another file
   under the new name, <code class="code">rename</code> may replace it, or raise an
   exception, depending on your operating system.<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="VALreaddir"></a>readdir : <code class="type">string -> string array</code></pre><div class="info">
Return the names of all files present in the given directory.
   Names denoting the current directory and the parent directory
   (<code class="code"><span class="string">"."</span></code> and <code class="code"><span class="string">".."</span></code> in Unix) are not returned.  Each string in the
   result is a file name rather than a complete path.  There is no
   guarantee that the name strings in the resulting array will appear
   in any specific order; they are not, in particular, guaranteed to
   appear in alphabetical order.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALinteractive"></a>interactive : <code class="type">bool <a href="Pervasives.html#TYPEref">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<ul>
<li> <code class="code"><span class="string">"Unix"</span></code> (for all Unix versions, including Linux and Mac OS X),</li>
<li> <code class="code"><span class="string">"Win32"</span></code> (for MS-Windows, OCaml compiled with MSVC++ or Mingw),</li>
<li> <code class="code"><span class="string">"Cygwin"</span></code> (for MS-Windows, OCaml compiled with Cygwin).</li>
</ul>
<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 a normal array.  The maximum length of a float
    array is <code class="code">max_array_length/2</code> on 32-bit machines and
    <code class="code">max_array_length</code> on 64-bit machines.<br>
</div>
<br>
<a name="6_Signalhandling"></a>
<h6>Signal handling</h6><br>
<br><code><span class="keyword">type</span> <a name="TYPEsignal_behavior"></a><code class="type"></code>signal_behavior = </code><table class="typetable">
<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 class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >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>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr></table>


<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. If the signal number is
   invalid (or not available on your system), an <code class="code"><span class="constructor">Invalid_argument</span></code>
   exception is raised.<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>
<a name="7_SignalnumbersforthestandardPOSIXsignals"></a>
<div class="h7">Signal numbers for the standard POSIX signals.</div><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[.patchlevel][+additional-info]"</span></code>,
    where <code class="code">major</code>, <code class="code">minor</code>, and <code class="code">patchlevel</code> are integers, and
    <code class="code">additional-info</code> is an arbitrary string. The <code class="code">[.patchlevel]</code> and
    <code class="code">[+additional-info]</code> parts may be absent.<br>
</div>
</body></html>