File: Sys.html

package info (click to toggle)
ocaml-doc 4.11-2
  • links: PTS, VCS
  • area: non-free
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 20,580 kB
  • sloc: sh: 37; makefile: 11
file content (710 lines) | stat: -rw-r--r-- 32,371 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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
<!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">
<meta name="viewport" content="width=device-width, initial-scale=1">
<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 extensions" rel=Appendix href="index_extensions.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="Array" rel="Chapter" href="Array.html">
<link title="ArrayLabels" rel="Chapter" href="ArrayLabels.html">
<link title="Bigarray" rel="Chapter" href="Bigarray.html">
<link title="Bool" rel="Chapter" href="Bool.html">
<link title="Buffer" rel="Chapter" href="Buffer.html">
<link title="Bytes" rel="Chapter" href="Bytes.html">
<link title="BytesLabels" rel="Chapter" href="BytesLabels.html">
<link title="Callback" rel="Chapter" href="Callback.html">
<link title="CamlinternalFormat" rel="Chapter" href="CamlinternalFormat.html">
<link title="CamlinternalFormatBasics" rel="Chapter" href="CamlinternalFormatBasics.html">
<link title="CamlinternalLazy" rel="Chapter" href="CamlinternalLazy.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="Digest" rel="Chapter" href="Digest.html">
<link title="Dynlink" rel="Chapter" href="Dynlink.html">
<link title="Ephemeron" rel="Chapter" href="Ephemeron.html">
<link title="Event" rel="Chapter" href="Event.html">
<link title="Filename" rel="Chapter" href="Filename.html">
<link title="Float" rel="Chapter" href="Float.html">
<link title="Format" rel="Chapter" href="Format.html">
<link title="Fun" rel="Chapter" href="Fun.html">
<link title="Gc" rel="Chapter" href="Gc.html">
<link title="Genlex" rel="Chapter" href="Genlex.html">
<link title="Hashtbl" rel="Chapter" href="Hashtbl.html">
<link title="Int" rel="Chapter" href="Int.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="Obj" rel="Chapter" href="Obj.html">
<link title="Ocaml_operators" rel="Chapter" href="Ocaml_operators.html">
<link title="Oo" rel="Chapter" href="Oo.html">
<link title="Option" rel="Chapter" href="Option.html">
<link title="Parsing" rel="Chapter" href="Parsing.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="Result" rel="Chapter" href="Result.html">
<link title="Scanf" rel="Chapter" href="Scanf.html">
<link title="Seq" rel="Chapter" href="Seq.html">
<link title="Set" rel="Chapter" href="Set.html">
<link title="Spacetime" rel="Chapter" href="Spacetime.html">
<link title="Stack" rel="Chapter" href="Stack.html">
<link title="StdLabels" rel="Chapter" href="StdLabels.html">
<link title="Stdlib" rel="Chapter" href="Stdlib.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="Uchar" rel="Chapter" href="Uchar.html">
<link title="Unit" rel="Chapter" href="Unit.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="#1_Signalhandling">
<link title="Optimization" rel="Section" href="#1_Optimization">
<link title="Signal numbers for the standard POSIX signals." rel="Subsection" href="#2_SignalnumbersforthestandardPOSIXsignals">
<title>Sys</title>
</head>
<body>
<div class="navbar"><a class="pre" href="StringLabels.html" title="StringLabels">Previous</a>
&nbsp;<a class="up" href="index.html" title="Index">Up</a>
&nbsp;<a class="post" href="Thread.html" title="Thread">Next</a>
</div>
<h1>Module <a href="type_Sys.html">Sys</a></h1>

<pre><span id="MODULESys"><span class="keyword">module</span> Sys</span>: <code class="code"><span class="keyword">sig</span></code> <a href="Sys.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><div class="info module top">
<div class="info-desc">
<p>System interface.</p>

<p>Every function in this module raises <code class="code"><span class="constructor">Sys_error</span></code> with an
  informative message when the underlying system call signal
  an error.</p>
</div>
</div>
<hr width="100%">

<pre><span id="VALargv"><span class="keyword">val</span> argv</span> : <code class="type">string array</code></pre><div class="info ">
<div class="info-desc">
<p>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.</p>
</div>
</div>

<pre><span id="VALexecutable_name"><span class="keyword">val</span> executable_name</span> : <code class="type">string</code></pre><div class="info ">
<div class="info-desc">
<p>The name of the file containing the executable currently running.
    This name may be absolute or relative to the current directory, depending
    on the platform and whether the program was compiled to bytecode or a native
    executable.</p>
</div>
</div>

<pre><span id="VALfile_exists"><span class="keyword">val</span> file_exists</span> : <code class="type">string -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>Test if a file with the given name exists.</p>
</div>
</div>

<pre><span id="VALis_directory"><span class="keyword">val</span> is_directory</span> : <code class="type">string -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>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.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 3.10.0</li>
<li><b>Raises</b> <code>Sys_error</code> if no file exists with the given name.</li>
</ul>
</div>

<pre><span id="VALremove"><span class="keyword">val</span> remove</span> : <code class="type">string -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Remove the given file name from the file system.</p>
</div>
</div>

<pre><span id="VALrename"><span class="keyword">val</span> rename</span> : <code class="type">string -> string -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Rename a file.  <code class="code">rename&nbsp;oldpath&nbsp;newpath</code> renames the file
    called <code class="code">oldpath</code>, giving it <code class="code">newpath</code> as its new name,
    moving it between directories if needed.  If <code class="code">newpath</code> already
    exists, its contents will be replaced with those of <code class="code">oldpath</code>.
    Depending on the operating system, the metadata (permissions,
    owner, etc) of <code class="code">newpath</code> can either be preserved or be replaced by
    those of <code class="code">oldpath</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.06 concerning the "replace existing file" behavior</li>
</ul>
</div>

<pre><span id="VALgetenv"><span class="keyword">val</span> getenv</span> : <code class="type">string -> string</code></pre><div class="info ">
<div class="info-desc">
<p>Return the value associated to a variable in the process
   environment.</p>
</div>
<ul class="info-attributes">
<li><b>Raises</b> <code>Not_found</code> if the variable is unbound.</li>
</ul>
</div>

<pre><span id="VALgetenv_opt"><span class="keyword">val</span> getenv_opt</span> : <code class="type">string -> string option</code></pre><div class="info ">
<div class="info-desc">
<p>Return the value associated to a variable in the process
    environment or <code class="code"><span class="constructor">None</span></code> if the variable is unbound.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.05</li>
</ul>
</div>

<pre><span id="VALcommand"><span class="keyword">val</span> command</span> : <code class="type">string -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Execute the given shell command and return its exit code.</p>

<p>The argument of <a href="Sys.html#VALcommand"><code class="code"><span class="constructor">Sys</span>.command</code></a> is generally the name of a
  command followed by zero, one or several arguments, separated
  by whitespace.  The given argument is interpreted by a
  shell: either the Windows shell <code class="code">cmd.exe</code> for the Win32 ports of
  OCaml, or the POSIX shell <code class="code">sh</code> for other ports.  It can contain
  shell builtin commands such as <code class="code">echo</code>, and also special characters
  such as file redirections <code class="code">&gt;</code> and <code class="code">&lt;</code>, which will be honored by the
  shell.</p>

<p>Conversely, whitespace or special shell characters occurring in
  command names or in their arguments must be quoted or escaped
  so that the shell does not interpret them.  The quoting rules vary
  between the POSIX shell and the Windows shell.
  The <a href="Filename.html#VALquote_command"><code class="code"><span class="constructor">Filename</span>.quote_command</code></a> performs the appropriate quoting
  given a command name, a list of arguments, and optional file redirections.</p>
</div>
</div>

<pre><span id="VALtime"><span class="keyword">val</span> time</span> : <code class="type">unit -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Return the processor time, in seconds, used by the program
   since the beginning of execution.</p>
</div>
</div>

<pre><span id="VALchdir"><span class="keyword">val</span> chdir</span> : <code class="type">string -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Change the current working directory of the process.</p>
</div>
</div>

<pre><span id="VALgetcwd"><span class="keyword">val</span> getcwd</span> : <code class="type">unit -> string</code></pre><div class="info ">
<div class="info-desc">
<p>Return the current working directory of the process.</p>
</div>
</div>

<pre><span id="VALreaddir"><span class="keyword">val</span> readdir</span> : <code class="type">string -> string array</code></pre><div class="info ">
<div class="info-desc">
<p>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.</p>
</div>
</div>

<pre><span id="VALinteractive"><span class="keyword">val</span> interactive</span> : <code class="type">bool <a href="Stdlib.html#TYPEref">ref</a></code></pre><div class="info ">
<div class="info-desc">
<p>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>.</p>
</div>
</div>

<pre><span id="VALos_type"><span class="keyword">val</span> os_type</span> : <code class="type">string</code></pre><div class="info ">
<div class="info-desc">
<p>Operating system currently executing the OCaml program. One of</p>
<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>
</div>
</div>

<pre><code><span id="TYPEbackend_type"><span class="keyword">type</span> <code class="type"></code>backend_type</span> = </code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTbackend_type.Native"><span class="constructor">Native</span></span></code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTbackend_type.Bytecode"><span class="constructor">Bytecode</span></span></code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTbackend_type.Other"><span class="constructor">Other</span></span> <span class="keyword">of</span> <code class="type">string</code></code></td>

</tr></table>

<div class="info ">
<div class="info-desc">
<p>Currently, the official distribution only supports <code class="code"><span class="constructor">Native</span></code> and
    <code class="code"><span class="constructor">Bytecode</span></code>, but it can be other backends with alternative
    compilers, for example, javascript.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.04.0</li>
</ul>
</div>


<pre><span id="VALbackend_type"><span class="keyword">val</span> backend_type</span> : <code class="type"><a href="Sys.html#TYPEbackend_type">backend_type</a></code></pre><div class="info ">
<div class="info-desc">
<p>Backend type  currently executing the OCaml program.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.04.0</li>
</ul>
</div>

<pre><span id="VALunix"><span class="keyword">val</span> unix</span> : <code class="type">bool</code></pre><div class="info ">
<div class="info-desc">
<p>True if <code class="code"><span class="constructor">Sys</span>.os_type&nbsp;=&nbsp;<span class="string">"Unix"</span></code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.01.0</li>
</ul>
</div>

<pre><span id="VALwin32"><span class="keyword">val</span> win32</span> : <code class="type">bool</code></pre><div class="info ">
<div class="info-desc">
<p>True if <code class="code"><span class="constructor">Sys</span>.os_type&nbsp;=&nbsp;<span class="string">"Win32"</span></code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.01.0</li>
</ul>
</div>

<pre><span id="VALcygwin"><span class="keyword">val</span> cygwin</span> : <code class="type">bool</code></pre><div class="info ">
<div class="info-desc">
<p>True if <code class="code"><span class="constructor">Sys</span>.os_type&nbsp;=&nbsp;<span class="string">"Cygwin"</span></code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.01.0</li>
</ul>
</div>

<pre><span id="VALword_size"><span class="keyword">val</span> word_size</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Size of one word on the machine currently executing the OCaml
    program, in bits: 32 or 64.</p>
</div>
</div>

<pre><span id="VALint_size"><span class="keyword">val</span> int_size</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Size of <code class="code">int</code>, in bits. It is 31 (resp. 63) when using OCaml on a
    32-bit (resp. 64-bit) platform. It may differ for other implementations,
    e.g. it can be 32 bits when compiling to JavaScript.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.03.0</li>
</ul>
</div>

<pre><span id="VALbig_endian"><span class="keyword">val</span> big_endian</span> : <code class="type">bool</code></pre><div class="info ">
<div class="info-desc">
<p>Whether the machine currently executing the Caml program is big-endian.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.00.0</li>
</ul>
</div>

<pre><span id="VALmax_string_length"><span class="keyword">val</span> max_string_length</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Maximum length of strings and byte sequences.</p>
</div>
</div>

<pre><span id="VALmax_array_length"><span class="keyword">val</span> max_array_length</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Maximum length of a normal array (i.e. any array whose elements are
    not of type <code class="code">float</code>). The maximum length of a <code class="code">float&nbsp;array</code>
    is <code class="code">max_floatarray_length</code> if OCaml was configured with
    <code class="code">--enable-flat-float-array</code> and <code class="code">max_array_length</code> if configured
    with <code class="code">--disable-flat-float-array</code>.</p>
</div>
</div>

<pre><span id="VALmax_floatarray_length"><span class="keyword">val</span> max_floatarray_length</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Maximum length of a floatarray. This is also the maximum length of
    a <code class="code">float&nbsp;array</code> when OCaml is configured with
    <code class="code">--enable-flat-float-array</code>.</p>
</div>
</div>

<pre><span id="VALruntime_variant"><span class="keyword">val</span> runtime_variant</span> : <code class="type">unit -> string</code></pre><div class="info ">
<div class="info-desc">
<p>Return the name of the runtime variant the program is running on.
    This is normally the argument given to <code class="code">-runtime-variant</code> at compile
    time, but for byte-code it can be changed after compilation.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.03.0</li>
</ul>
</div>

<pre><span id="VALruntime_parameters"><span class="keyword">val</span> runtime_parameters</span> : <code class="type">unit -> string</code></pre><div class="info ">
<div class="info-desc">
<p>Return the value of the runtime parameters, in the same format
    as the contents of the <code class="code"><span class="constructor">OCAMLRUNPARAM</span></code> environment variable.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.03.0</li>
</ul>
</div>
<h2 id="1_Signalhandling">Signal handling</h2>
<pre><code><span id="TYPEsignal_behavior"><span class="keyword">type</span> <code class="type"></code>signal_behavior</span> = </code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTsignal_behavior.Signal_default"><span class="constructor">Signal_default</span></span></code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTsignal_behavior.Signal_ignore"><span class="constructor">Signal_ignore</span></span></code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTsignal_behavior.Signal_handle"><span class="constructor">Signal_handle</span></span> <span class="keyword">of</span> <code class="type">(int -> unit)</code></code></td>

</tr></table>

<div class="info ">
<div class="info-desc">
<p>What to do when receiving a signal:</p>
<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>&nbsp;f</code>: call function <code class="code">f</code>, giving it the signal
   number as argument.</li>
</ul>
</div>
</div>


<pre><span id="VALsignal"><span class="keyword">val</span> signal</span> : <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 ">
<div class="info-desc">
<p>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.</p>
</div>
</div>

<pre><span id="VALset_signal"><span class="keyword">val</span> set_signal</span> : <code class="type">int -> <a href="Sys.html#TYPEsignal_behavior">signal_behavior</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <a href="Sys.html#VALsignal"><code class="code"><span class="constructor">Sys</span>.signal</code></a> but return value is ignored.</p>
</div>
</div>
<h3 id="2_SignalnumbersforthestandardPOSIXsignals">Signal numbers for the standard POSIX signals.</h3>
<pre><span id="VALsigabrt"><span class="keyword">val</span> sigabrt</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Abnormal termination</p>
</div>
</div>

<pre><span id="VALsigalrm"><span class="keyword">val</span> sigalrm</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Timeout</p>
</div>
</div>

<pre><span id="VALsigfpe"><span class="keyword">val</span> sigfpe</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Arithmetic exception</p>
</div>
</div>

<pre><span id="VALsighup"><span class="keyword">val</span> sighup</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Hangup on controlling terminal</p>
</div>
</div>

<pre><span id="VALsigill"><span class="keyword">val</span> sigill</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Invalid hardware instruction</p>
</div>
</div>

<pre><span id="VALsigint"><span class="keyword">val</span> sigint</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Interactive interrupt (ctrl-C)</p>
</div>
</div>

<pre><span id="VALsigkill"><span class="keyword">val</span> sigkill</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Termination (cannot be ignored)</p>
</div>
</div>

<pre><span id="VALsigpipe"><span class="keyword">val</span> sigpipe</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Broken pipe</p>
</div>
</div>

<pre><span id="VALsigquit"><span class="keyword">val</span> sigquit</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Interactive termination</p>
</div>
</div>

<pre><span id="VALsigsegv"><span class="keyword">val</span> sigsegv</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Invalid memory reference</p>
</div>
</div>

<pre><span id="VALsigterm"><span class="keyword">val</span> sigterm</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Termination</p>
</div>
</div>

<pre><span id="VALsigusr1"><span class="keyword">val</span> sigusr1</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Application-defined signal 1</p>
</div>
</div>

<pre><span id="VALsigusr2"><span class="keyword">val</span> sigusr2</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Application-defined signal 2</p>
</div>
</div>

<pre><span id="VALsigchld"><span class="keyword">val</span> sigchld</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Child process terminated</p>
</div>
</div>

<pre><span id="VALsigcont"><span class="keyword">val</span> sigcont</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Continue</p>
</div>
</div>

<pre><span id="VALsigstop"><span class="keyword">val</span> sigstop</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Stop</p>
</div>
</div>

<pre><span id="VALsigtstp"><span class="keyword">val</span> sigtstp</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Interactive stop</p>
</div>
</div>

<pre><span id="VALsigttin"><span class="keyword">val</span> sigttin</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Terminal read from background process</p>
</div>
</div>

<pre><span id="VALsigttou"><span class="keyword">val</span> sigttou</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Terminal write from background process</p>
</div>
</div>

<pre><span id="VALsigvtalrm"><span class="keyword">val</span> sigvtalrm</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Timeout in virtual time</p>
</div>
</div>

<pre><span id="VALsigprof"><span class="keyword">val</span> sigprof</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Profiling interrupt</p>
</div>
</div>

<pre><span id="VALsigbus"><span class="keyword">val</span> sigbus</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Bus error</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.03</li>
</ul>
</div>

<pre><span id="VALsigpoll"><span class="keyword">val</span> sigpoll</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Pollable event</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.03</li>
</ul>
</div>

<pre><span id="VALsigsys"><span class="keyword">val</span> sigsys</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Bad argument to routine</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.03</li>
</ul>
</div>

<pre><span id="VALsigtrap"><span class="keyword">val</span> sigtrap</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Trace/breakpoint trap</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.03</li>
</ul>
</div>

<pre><span id="VALsigurg"><span class="keyword">val</span> sigurg</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Urgent condition on socket</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.03</li>
</ul>
</div>

<pre><span id="VALsigxcpu"><span class="keyword">val</span> sigxcpu</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>Timeout in cpu time</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.03</li>
</ul>
</div>

<pre><span id="VALsigxfsz"><span class="keyword">val</span> sigxfsz</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>File size limit exceeded</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.03</li>
</ul>
</div>

<pre><span id="EXCEPTIONBreak"><span class="keyword">exception</span> Break</span></pre>
<div class="info ">
<div class="info-desc">
<p>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.</p>
</div>
</div>

<pre><span id="VALcatch_break"><span class="keyword">val</span> catch_break</span> : <code class="type">bool -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><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&nbsp;<span class="keyword">true</span></code> to enable raising <code class="code"><span class="constructor">Break</span></code>,
   and <code class="code">catch_break&nbsp;<span class="keyword">false</span></code> to let the system
   terminate the program on user interrupt.</p>
</div>
</div>

<pre><span id="VALocaml_version"><span class="keyword">val</span> ocaml_version</span> : <code class="type">string</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">ocaml_version</code> is the version of OCaml.
    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> part is absent for versions anterior to 3.08.0.
    The <code class="code">[(+|~)additional-info]</code> part may be absent.</p>
</div>
</div>

<pre><span id="VALenable_runtime_warnings"><span class="keyword">val</span> enable_runtime_warnings</span> : <code class="type">bool -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Control whether the OCaml runtime system can emit warnings
    on stderr.  Currently, the only supported warning is triggered
    when a channel created by <code class="code">open_*</code> functions is finalized without
    being closed.  Runtime warnings are disabled by default.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.03.0</li>
</ul>
</div>

<pre><span id="VALruntime_warnings_enabled"><span class="keyword">val</span> runtime_warnings_enabled</span> : <code class="type">unit -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>Return whether runtime warnings are currently enabled.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.03.0</li>
</ul>
</div>
<h2 id="1_Optimization">Optimization</h2>
<pre><span id="VALopaque_identity"><span class="keyword">val</span> opaque_identity</span> : <code class="type">'a -> 'a</code></pre><div class="info ">
<div class="info-desc">
<p>For the purposes of optimization, <code class="code">opaque_identity</code> behaves like an
    unknown (and thus possibly side-effecting) function.</p>

<p>At runtime, <code class="code">opaque_identity</code> disappears altogether.</p>

<p>A typical use of this function is to prevent pure computations from being
    optimized away in benchmarking loops.  For example:</p>
<pre class="codepre"><code class="code">      <span class="keyword">for</span> _round = 1 <span class="keyword">to</span> 100_000 <span class="keyword">do</span>
        ignore (<span class="constructor">Sys</span>.opaque_identity (my_pure_computation ()))
      <span class="keyword">done</span>
    </code></pre></div>
<ul class="info-attributes">
<li><b>Since</b> 4.03.0</li>
</ul>
</div>

<pre><span id="MODULEImmediate64"><span class="keyword">module</span> <a href="Sys.Immediate64.html">Immediate64</a></span>: <code class="code"><span class="keyword">sig</span></code> <a href="Sys.Immediate64.html">..</a> <code class="code"><span class="keyword">end</span></code></pre></body></html>