To focus the search input from anywhere on the page, press the 'S' key.
in-package search v0.1.0
- Error report
- Access to the process environment
- Process handling
- Basic file input/output
- Interfacing with the standard input/output library
- Seeking and truncating
- File status
- File operations on large files
- Mapping files into memory
- Operations on file names
- File permissions and ownership
- Operations on file descriptors
- Directories
- Pipes and redirections
- High-level process and redirection management
- Symbolic links
- Polling
- Locking
- Signals
- Time functions
- User id, group id
- Internet addresses
- Sockets
- Socket options
- High-level network connection functions
- Host and protocol databases
- Terminal interface
-
bigarray
-
dynlink
-
ocamlbytecomp
-
ocamlcommon
-
ocamlmiddleend
-
ocamloptcomp
-
odoc_info
-
raw_spacetime_lib
-
-
stdlib
-
str
-
threads
-
unix
Library
Module
Module type
Parameter
Class
Class type
Interface to the Unix system.
Note: all the functions of this module (except error_message
and handle_unix_error
) are liable to raise the Unix_error
exception whenever the underlying system call signals an error.
Error report
type error =
| E2BIG
(*Argument list too long
*)| EACCES
(*Permission denied
*)| EAGAIN
(*Resource temporarily unavailable; try again
*)| EBADF
(*Bad file descriptor
*)| EBUSY
(*Resource unavailable
*)| ECHILD
(*No child process
*)| EDEADLK
(*Resource deadlock would occur
*)| EDOM
(*Domain error for math functions, etc.
*)| EEXIST
(*File exists
*)| EFAULT
(*Bad address
*)| EFBIG
(*File too large
*)| EINTR
(*Function interrupted by signal
*)| EINVAL
(*Invalid argument
*)| EIO
(*Hardware I/O error
*)| EISDIR
(*Is a directory
*)| EMFILE
(*Too many open files by the process
*)| EMLINK
(*Too many links
*)| ENAMETOOLONG
(*Filename too long
*)| ENFILE
(*Too many open files in the system
*)| ENODEV
(*No such device
*)| ENOENT
(*No such file or directory
*)| ENOEXEC
(*Not an executable file
*)| ENOLCK
(*No locks available
*)| ENOMEM
(*Not enough memory
*)| ENOSPC
(*No space left on device
*)| ENOSYS
(*Function not supported
*)| ENOTDIR
(*Not a directory
*)| ENOTEMPTY
(*Directory not empty
*)| ENOTTY
(*Inappropriate I/O control operation
*)| ENXIO
(*No such device or address
*)| EPERM
(*Operation not permitted
*)| EPIPE
(*Broken pipe
*)| ERANGE
(*Result too large
*)| EROFS
(*Read-only file system
*)| ESPIPE
(*Invalid seek e.g. on a pipe
*)| ESRCH
(*No such process
*)| EXDEV
(*Invalid link
*)| EWOULDBLOCK
(*Operation would block
*)| EINPROGRESS
(*Operation now in progress
*)| EALREADY
(*Operation already in progress
*)| ENOTSOCK
(*Socket operation on non-socket
*)| EDESTADDRREQ
(*Destination address required
*)| EMSGSIZE
(*Message too long
*)| EPROTOTYPE
(*Protocol wrong type for socket
*)| ENOPROTOOPT
(*Protocol not available
*)| EPROTONOSUPPORT
(*Protocol not supported
*)| ESOCKTNOSUPPORT
(*Socket type not supported
*)| EOPNOTSUPP
(*Operation not supported on socket
*)| EPFNOSUPPORT
(*Protocol family not supported
*)| EAFNOSUPPORT
(*Address family not supported by protocol family
*)| EADDRINUSE
(*Address already in use
*)| EADDRNOTAVAIL
(*Can't assign requested address
*)| ENETDOWN
(*Network is down
*)| ENETUNREACH
(*Network is unreachable
*)| ENETRESET
(*Network dropped connection on reset
*)| ECONNABORTED
(*Software caused connection abort
*)| ECONNRESET
(*Connection reset by peer
*)| ENOBUFS
(*No buffer space available
*)| EISCONN
(*Socket is already connected
*)| ENOTCONN
(*Socket is not connected
*)| ESHUTDOWN
(*Can't send after socket shutdown
*)| ETOOMANYREFS
(*Too many references: can't splice
*)| ETIMEDOUT
(*Connection timed out
*)| ECONNREFUSED
(*Connection refused
*)| EHOSTDOWN
(*Host is down
*)| EHOSTUNREACH
(*No route to host
*)| ELOOP
(*Too many levels of symbolic links
*)| EOVERFLOW
(*File size or position not representable
*)| EUNKNOWNERR of int
(*Unknown error
*)
The type of error codes. Errors defined in the POSIX standard and additional errors from UNIX98 and BSD. All other errors are mapped to EUNKNOWNERR.
exception Unix_error of error * string * string
Raised by the system calls below when an error is encountered. The first component is the error code; the second component is the function name; the third component is the string parameter to the function, if it has one, or the empty string otherwise.
val error_message : error -> string
Return a string describing the given error code.
handle_unix_error f x
applies f
to x
and returns the result. If the exception Unix_error
is raised, it prints a message describing the error and exits with code 2.
Access to the process environment
Return the process environment, as an array of strings with the format ``variable=value''. The returned array is empty if the process has special privileges.
Return the process environment, as an array of strings with the format ``variable=value''. Unlike environment
, this function returns a populated array even if the process has special privileges. See the documentation for unsafe_getenv
for more details.
- since 4.06.0
Return the value associated to a variable in the process environment, unless the process has special privileges.
- raises Not_found
if the variable is unbound or the process has special privileges.
(This function is identical to
Sys.getenv
.
Return the value associated to a variable in the process environment.
Unlike getenv
, this function returns the value even if the process has special privileges. It is considered unsafe because the programmer of a setuid or setgid program must be careful to avoid using maliciously crafted environment variables in the search path for executables, the locations for temporary files or logs, and the like.
- raises Not_found
if the variable is unbound.
- since 4.06.0
Unix.putenv name value
sets the value associated to a variable in the process environment. name
is the name of the environment variable, and value
its new associated value.
Process handling
The termination status of a process. See module Sys
for the definitions of the standard signal numbers. Note that they are not the numbers used by the OS.
Flags for Unix.waitpid
.
execv prog args
execute the program in file prog
, with the arguments args
, and the current process environment. These execv*
functions never return: on success, the current program is replaced by the new one.
- raises Unix.Unix_error
on failure.
Same as Unix.execv
, except that the third argument provides the environment to the program executed.
Same as Unix.execv
, except that the program is searched in the path.
Same as Unix.execve
, except that the program is searched in the path.
Fork a new process. The returned integer is 0 for the child process, the pid of the child process for the parent process.
On Windows: not implemented, use create_process
or threads.
val wait : unit -> int * process_status
Wait until one of the children processes die, and return its pid and termination status.
On Windows: Not implemented, use waitpid
.
val waitpid : wait_flag list -> int -> int * process_status
Same as Unix.wait
, but waits for the child process whose pid is given. A pid of -1
means wait for any child. A pid of 0
means wait for any child in the same process group as the current process. Negative pid arguments represent process groups. The list of options indicates whether waitpid
should return immediately without waiting, and whether it should report s