module Sys: sig .. end
Every function in this module raises Sys_error
with an
informative message when the underlying system call signal
an error.
let argv: array(string);
let executable_name: string;
let file_exists: string => bool;
let 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.let remove: string => unit;
let rename: (string, string) => unit;
rename
may replace it, or raise an
exception, depending on your operating system.let getenv: string => string;
Not_found
if the variable is unbound.let command: string => int;
let time: unit => float;
let chdir: string => unit;
let getcwd: unit => string;
let readdir: string => array(string);
"."
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.let interactive: Pervasives.ref(bool);
false
in standalone
programs and to true
if the code is being executed under
the interactive toplevel system ocaml
.let 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).let unix: bool;
Sys.os_type = "Unix"
.let win32: bool;
Sys.os_type = "Win32"
.let cygwin: bool;
Sys.os_type = "Cygwin"
.let word_size: int;
let big_endian: bool;
let max_string_length: int;
let max_array_length: int;
max_array_length/2
on 32-bit machines and
max_array_length
on 64-bit machines.type signal_behavior =
| |
Signal_default |
|||
| |
Signal_ignore |
|||
| |
Signal_handle of (int -> unit) |
(* | *) |
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.let signal: (int, signal_behavior) => signal_behavior;
Invalid_argument
exception is raised.let set_signal: (int, signal_behavior) => unit;
Sys.signal
but return value is ignored.let sigabrt: int;
let sigalrm: int;
let sigfpe: int;
let sighup: int;
let sigill: int;
let sigint: int;
let sigkill: int;
let sigpipe: int;
let sigquit: int;
let sigsegv: int;
let sigterm: int;
let sigusr1: int;
let sigusr2: int;
let sigchld: int;
let sigcont: int;
let sigstop: int;
let sigtstp: int;
let sigttin: int;
let sigttou: int;
let sigvtalrm: int;
let sigprof: int;
exception Break;
Sys.catch_break
is on.let 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.let 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.