module Sys:sig
..end
Every function in this module raises Sys_error
with an
informative message when the underlying system call signal
an error.
val argv : string array
val executable_name : string
val file_exists : string -> bool
val is_directory : string -> bool
true
if the given name refers to a directory,
false
if it refers to another kind of file.
Raise Sys_error
if no file exists with the given name.val remove : string -> unit
val rename : string -> string -> unit
rename
may replace it, or raise an
exception, depending on your operating system.val getenv : string -> string
Not_found
if the variable is unbound.val command : string -> int
val time : unit -> float
val chdir : string -> unit
val getcwd : unit -> string
val readdir : string -> string array
"."
and ".."
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.val interactive : bool ref
false
in standalone
programs and to true
if the code is being executed under
the interactive toplevel system ocaml
.val os_type : string
"Unix"
(for all Unix versions, including Linux and Mac OS X),"Win32"
(for MS-Windows, OCaml compiled with MSVC++ or Mingw),"Cygwin"
(for MS-Windows, OCaml compiled with Cygwin).val unix : bool
Sys.os_type = "Unix"
.val win32 : bool
Sys.os_type = "Win32"
.val cygwin : bool
Sys.os_type = "Cygwin"
.val word_size : int
val int_size : int
val big_endian : bool
val max_string_length : int
val max_array_length : int
max_array_length/2
on 32-bit machines and
max_array_length
on 64-bit machines.val runtime_variant : unit -> string
-runtime-variant
at compile
time, but for byte-code it can be changed after compilation.val runtime_parameters : unit -> string
OCAMLRUNPARAM
environment variable.type
signal_behavior =
| |
Signal_default |
| |
Signal_ignore |
| |
Signal_handle of |
Signal_default
: take the default behavior
(usually: abort the program)Signal_ignore
: ignore the signalSignal_handle f
: call function f
, giving it the signal
number as argument.val signal : int -> signal_behavior -> signal_behavior
Invalid_argument
exception is raised.val set_signal : int -> signal_behavior -> unit
Sys.signal
but return value is ignored.val sigabrt : int
val sigalrm : int
val sigfpe : int
val sighup : int
val sigill : int
val sigint : int
val sigkill : int
val sigpipe : int
val sigquit : int
val sigsegv : int
val sigterm : int
val sigusr1 : int
val sigusr2 : int
val sigchld : int
val sigcont : int
val sigstop : int
val sigtstp : int
val sigttin : int
val sigttou : int
val sigvtalrm : int
val sigprof : int
val sigbus : int
val sigpoll : int
val sigsys : int
val sigtrap : int
val sigurg : int
val sigxcpu : int
val sigxfsz : int
exception Break
Sys.catch_break
is on.val catch_break : bool -> unit
catch_break
governs whether interactive interrupt (ctrl-C)
terminates the program or raises the Break
exception.
Call catch_break true
to enable raising Break
,
and catch_break false
to let the system
terminate the program on user interrupt.val ocaml_version : string
ocaml_version
is the version of OCaml.
It is a string of the form "major.minor[.patchlevel][+additional-info]"
,
where major
, minor
, and patchlevel
are integers, and
additional-info
is an arbitrary string. The [.patchlevel]
and
[+additional-info]
parts may be absent.val enable_runtime_warnings : bool -> unit
open_*
functions is finalized without
being closed. Runtime warnings are enabled by default.val runtime_warnings_enabled : unit -> bool
val opaque_identity : 'a -> 'a
opaque_identity
behaves like an
unknown (and thus possibly side-effecting) function.
At runtime, opaque_identity
disappears altogether.
A typical use of this function is to prevent pure computations from being optimized away in benchmarking loops. For example:
for _round = 1 to 100_000 do
ignore (Sys.opaque_identity (my_pure_computation ()))
done