Module ExtUnix.All

module All: ExtUnixAll
All functions, those not available on this platform will raise Not_available with function name as an argument

exception Not_available of string
Not_available "func" may be raised by ExtUnix.All.func if the wrapped C function is not available on this platform
type ('a, 'b) carray = ('a, 'b, Bigarray.c_layout) Bigarray.Array1.t 
type of bigarray used by BA submodules that read from files into bigarrays or write bigarrays into files. The only constraint here is Bigarray.c_layout. Naming: "bigarray with C layout" -> "carray".
type 'a carray8 = ('a, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t 
type of bigarray used by BA submodules that work with endianness and memory. Constraints are: 1. Bigarray.c_layout, 2. bigarray contains 8-bit integers. Naming: "bigarray with C layout and 8-bit elements" -> "carray8".
type open_flag = Unix.open_flag 
val eventfd : int -> Unix.file_descr
val eventfd_read : Unix.file_descr -> int64
val eventfd_write : Unix.file_descr -> int64 -> unit
module Uname: sig .. end
uname Author: Sylvain Le Gall sylvain@le-gall.net
val uname : unit -> Uname.t

Filesystem


val fsync : Unix.file_descr -> unit
synchronize a file's in-core state with storage device
val fdatasync : Unix.file_descr -> unit
val sync : unit -> unit
causes all buffered modifications to file metadata and data to be written to the underlying file systems
val syncfs : Unix.file_descr -> unit
like ExtUnixAll.sync, but synchronizes just the file system containing file referred to by the open file descriptor fd
val dirfd : Unix.dir_handle -> Unix.file_descr
type st_flag = 
| ST_RDONLY (*Mount read-only.*)
| ST_NOSUID (*Ignore suid and sgid bits.*)
| ST_NODEV (*Disallow access to device special files.*)
| ST_NOEXEC (*Disallow program execution.*)
| ST_SYNCHRONOUS (*Writes are synced at once.*)
| ST_MANDLOCK (*Allow mandatory locks on an FS.*)
| ST_WRITE (*Write on file/directory/symlink.*)
| ST_APPEND (*Append-only file.*)
| ST_IMMUTABLE (*Immutable file.*)
| ST_NOATIME (*Do not update access times.*)
| ST_NODIRATIME (*Do not update directory access times.*)
| ST_RELATIME
file system flags
type statvfs = {
   f_bsize : int; (*file system block size*)
   f_blocks : int64; (*size of file system in blocks*)
   f_bfree : int64; (*free blocks*)
   f_bavail : int64; (*free blocks for unprivileged users*)
   f_files : int64; (*inodes*)
   f_ffree : int64; (*free inodes*)
   f_favail : int64; (*free inodes for unprivileged users*)
   f_fsid : int64; (*file system ID*)
   f_flag : int; (*mount flags (raw value)*)
   f_flags : st_flag list; (*mount flags (decoded)*)
   f_namemax : int;
}
Update atime relative to mtime/ctime.
val statvfs : string -> statvfs
maximum filename length
val fstatvfs : Unix.file_descr -> statvfs
type at_flag = 
| AT_EACCESS
| AT_SYMLINK_NOFOLLOW
| AT_REMOVEDIR
| AT_SYMLINK_FOLLOW
| AT_NO_AUTOMOUNT
val openat : Unix.file_descr ->
string -> open_flag list -> Unix.file_perm -> Unix.file_descr
val fstatat : Unix.file_descr -> string -> at_flag list -> Unix.stats
Supported flags : AT_SYMLINK_NOFOLLOW AT_NO_AUTOMOUNT
val unlinkat : Unix.file_descr -> string -> at_flag list -> unit
Supported flags : AT_REMOVEDIR
val renameat : Unix.file_descr -> string -> Unix.file_descr -> string -> unit
val mkdirat : Unix.file_descr -> string -> int -> unit
val linkat : Unix.file_descr ->
string -> Unix.file_descr -> string -> at_flag list -> unit
Supported flags : AT_SYMLINK_FOLLOW
val symlinkat : string -> Unix.file_descr -> string -> unit
val readlinkat : Unix.file_descr -> string -> string
val int_of_file_descr : Unix.file_descr -> int
Raises Not_available if OS does not represent file descriptors as numbers
val file_descr_of_int : int -> Unix.file_descr
Raises Not_available if OS does not represent file descriptors as numbers
val is_open_descr : Unix.file_descr -> bool
Returns whether file descriptor is open
val realpath : string -> string
realpath path
Returns the canonicalized absolute pathname of path
See also realpath(2) manual

posix_fadvise

Author: Sylvain Le Gall

type advice = 
| POSIX_FADV_NORMAL (*Indicates that the application has no advice to give about its access pattern for the specified data.*)
| POSIX_FADV_SEQUENTIAL (*The application expects to access the specified data sequentially.*)
| POSIX_FADV_RANDOM (*The specified data will be accessed in random order.*)
| POSIX_FADV_NOREUSE (*The specified data will be accessed only once.*)
| POSIX_FADV_WILLNEED (*The specified data will be accessed in the near future.*)
| POSIX_FADV_DONTNEED
access pattern

The specified data will not be accessed in the near future.
val fadvise : Unix.file_descr -> int -> int -> advice -> unit
predeclare an access pattern for file data

posix_fallocate



Allocate disk space for file

Author: Sylvain Le Gall

val fallocate : Unix.file_descr -> int -> int -> unit
fallocate fd off len allocates disk space to ensure that subsequent writes between off and off + len in fd will not fail because of lack of disk space. The file size is modified if off + len is bigger than the current size.

pread

Author: Goswin von Brederlow

val unsafe_all_pread : Unix.file_descr -> int -> string -> int -> int -> int
all_pread fd off buf ofs len reads up to len bytes from file descriptor fd at offset off (from the start of the file) into the string buf at offset ofs. The file offset is not changed.

all_pread repeats the read operation until all characters have been read or an error occurs. Returns less than the number of characters requested on EAGAIN, EWOULDBLOCK or End-of-file but only ever returns 0 on End-of-file. Continues the read operation on EINTR. Raises an Unix.Unix_error exception in all other cases.

val all_pread : Unix.file_descr -> int -> string -> int -> int -> int
val unsafe_single_pread : Unix.file_descr -> int -> string -> int -> int -> int
single_pread fd off buf ifs len reads up to len bytes from file descriptor fd at offset off (from the start of the file) into the string buf at offset ofs. The file offset is not changed.

single_pread attempts to read only once. Returns the number of characters read or raises an Unix.Unix_error exception.

val single_pread : Unix.file_descr -> int -> string -> int -> int -> int
val unsafe_pread : Unix.file_descr -> int -> string -> int -> int -> int
pread fd off buf ofs len reads up to len bytes from file descriptor fd at offset off (from the start of the file) into the string buf at offset ofs. The file offset is not changed.

pread repeats the read operation until all characters have been read or an error occurs. Raises an Unix.Unix_error exception if 0 characters could be read before an error occurs. Continues the read operation on EINTR. Returns the number of characters written in all other cases.

val pread : Unix.file_descr -> int -> string -> int -> int -> int
val unsafe_intr_pread : Unix.file_descr -> int -> string -> int -> int -> int
intr_pread fd off buf ofs len reads up to len bytes from file descriptor fd at offset off (from the start of the file) into the string buf at offset ofs. The file offset is not changed.

intr_pread repeats the read operation until all characters have been read or an error occurs. Raises an Unix.Unix_error exception if 0 characters could be read before an error occurs. Does NOT continue on EINTR. Returns the number of characters written in all other cases.

val intr_pread : Unix.file_descr -> int -> string -> int -> int -> int

pwrite

Author: Goswin von Brederlow

val unsafe_all_pwrite : Unix.file_descr -> int -> string -> int -> int -> int
all_pwrite fd off buf ofs len writes up to len bytes from file descriptor fd at offset off (from the start of the file) into the string buf at offset ofs. The file offset is not changed.

all_pwrite repeats the write operation until all characters have been written or an error occurs. Returns less than the number of characters requested on EAGAIN, EWOULDBLOCK but never 0. Continues the write operation on EINTR. Raises an Unix.Unix_error exception in all other cases.

val all_pwrite : Unix.file_descr -> int -> string -> int -> int -> int
val unsafe_single_pwrite : Unix.file_descr -> int -> string -> int -> int -> int
single_pwrite fd off buf ofs len writes up to len bytes from file descriptor fd at offset off (from the start of the file) into the string buf at offset ofs. The file offset is not changed.

single_pwrite attempts to write only once. Returns the number of characters written or raises an Unix.Unix_error exception.

val single_pwrite : Unix.file_descr -> int -> string -> int -> int -> int
val unsafe_pwrite : Unix.file_descr -> int -> string -> int -> int -> int
pwrite fd off buf ofs len writes up to len bytes from file descriptor fd at offset off (from the start of the file) into the string buf at offset ofs. The file offset is not changed.

pwrite repeats the write operation until all characters have been written or an error occurs. Raises an Unix.Unix_error exception if 0 characters could be written before an error occurs. Continues the write operation on EINTR. Returns the number of characters written in all other cases.

val pwrite : Unix.file_descr -> int -> string -> int -> int -> int
val unsafe_intr_pwrite : Unix.file_descr -> int -> string -> int -> int -> int
intr_pwrite fd off buf ofs len writes up to len bytes from file descriptor fd at offset off (from the start of the file) into the string buf at offset ofs. The file offset is not changed.

intr_pwrite repeats the write operation until all characters have been written or an error occurs. Raises an Unix.Unix_error exception if 0 characters could be written before an error occurs. Does NOT continue on EINTR. Returns the number of characters written in all other cases.

val intr_pwrite : Unix.file_descr -> int -> string -> int -> int -> int

read

Author: Goswin von Brederlow

val unsafe_all_read : Unix.file_descr -> string -> int -> int -> int
all_read fd buf ofs len reads up to len bytes from file descriptor fd into the string buf at offset ofs.

all_read repeats the read operation until all characters have been read or an error occurs. Returns less than the number of characters requested on EAGAIN, EWOULDBLOCK or End-of-file but only ever returns 0 on End-of-file. Continues the read operation on EINTR. Raises an Unix.Unix_error exception in all other cases.

val all_read : Unix.file_descr -> string -> int -> int -> int
val unsafe_single_read : Unix.file_descr -> string -> int -> int -> int
single_read fd buf ifs len reads up to len bytes from file descriptor fd into the string buf at offset ofs.

single_read attempts to read only once. Returns the number of characters read or raises an Unix.Unix_error exception.

val single_read : Unix.file_descr -> string -> int -> int -> int
val unsafe_read : Unix.file_descr -> string -> int -> int -> int
read fd buf ofs len reads up to len bytes from file descriptor fd into the string buf at offset ofs.

read repeats the read operation until all characters have been read or an error occurs. Raises an Unix.Unix_error exception if 0 characters could be read before an error occurs. Continues the read operation on EINTR. Returns the number of characters written in all other cases.

val read : Unix.file_descr -> string -> int -> int -> int
val unsafe_intr_read : Unix.file_descr -> string -> int -> int -> int
intr_read fd buf ofs len reads up to len bytes from file descriptor fd into the string buf at offset ofs.

intr_read repeats the read operation until all characters have been read or an error occurs. Raises an Unix.Unix_error exception if 0 characters could be read before an error occurs. Does NOT continue on EINTR. Returns the number of characters written in all other cases.

val intr_read : Unix.file_descr -> string -> int -> int -> int

write

Author: Goswin von Brederlow

val unsafe_all_write : Unix.file_descr -> string -> int -> int -> int
all_write fd buf ofs len writes up to len bytes from file descriptor fd into the string buf at offset ofs.

all_write repeats the write operation until all characters have been written or an error occurs. Returns less than the number of characters requested on EAGAIN, EWOULDBLOCK but never 0. Continues the write operation on EINTR. Raises an Unix.Unix_error exception in all other cases.

val all_write : Unix.file_descr -> string -> int -> int -> int
val unsafe_single_write : Unix.file_descr -> string -> int -> int -> int
single_write fd buf ofs len writes up to len bytes from file descriptor fd into the string buf at offset ofs.

single_write attempts to write only once. Returns the number of characters written or raises an Unix.Unix_error exception.

val single_write : Unix.file_descr -> string -> int -> int -> int
val unsafe_write : Unix.file_descr -> string -> int -> int -> int
write fd buf ofs len writes up to len bytes from file descriptor fd into the string buf at offset ofs.

write repeats the write operation until all characters have been written or an error occurs. Raises an Unix.Unix_error exception if 0 characters could be written before an error occurs. Continues the write operation on EINTR. Returns the number of characters written in all other cases.

val write : Unix.file_descr -> string -> int -> int -> int
val unsafe_intr_write : Unix.file_descr -> string -> int -> int -> int
intr_write fd buf ofs len writes up to len bytes from file descriptor fd into the string buf at offset ofs.

intr_write repeats the write operation until all characters have been written or an error occurs. Raises an Unix.Unix_error exception if 0 characters could be written before an error occurs. Does NOT continue on EINTR. Returns the number of characters written in all other cases.

val intr_write : Unix.file_descr -> string -> int -> int -> int

File operations on large files


module LargeFile: sig .. end
File operations on large files.

ioctl


module Ioctl: sig .. end
Control the underlying device parameters of special files

Miscellaneous


val ttyname : Unix.file_descr -> string
Returns name of terminal
val ctermid : unit -> string
Get controlling terminal name
val setpgid : int -> int -> unit
setpgid pid pgid sets the process group of the process specified by pid to pgid. If pid is zero, then the process ID of the calling process is used. If pgid is zero, then the PGID of the process specified by pid is made the same as its process ID.
val getpgid : int -> int
getpgid pid returns the PGID of the process specified by pid. If pid is zero, the process ID of the calling process is used.
val getsid : int -> int
getsid pid returns the session ID of the process specified by pid. If pid is zero, the process ID of the calling process is used.
val setreuid : int -> int -> unit
setreuid ruid euid sets real and effective user IDs of the calling process. Supplying a value of -1 for either the real or effective user ID forces the system to leave that ID unchanged.
See also setreuid(2) manual
val setregid : int -> int -> unit
setregid rgid egid sets real and effective group IDs of the calling process. Supplying a value of -1 for either the real or effective group ID forces the system to leave that ID unchanged.
See also setregid(2) manual
val setresuid : int -> int -> int -> unit
setresuid ruid euid suid sets real, effective and saved user IDs of the calling process. Supplying a value of -1 for either the real or effective user ID forces the system to leave that ID unchanged.
See also setresuid(2) manual
val setresgid : int -> int -> int -> unit
setresgid rgid egid sgid sets real, effective and saved group IDs of the calling process. Supplying a value of -1 for either the real or effective group ID forces the system to leave that ID unchanged.
See also setresgid(2) manual
val tcgetpgrp : Unix.file_descr -> int
val tcsetpgrp : Unix.file_descr -> int -> unit
val sys_exit : int -> 'a
Exit process without running any at_exit hooks (implemented in Pervasives)

Network


val getifaddrs : unit -> (string * string) list
Returns the list of PF_INET interfaces and corresponding addresses (may change)
type socket_int_option = 
| TCP_KEEPCNT (*The maximum number of keepalive probes TCP should send before dropping the connection*)
| TCP_KEEPIDLE (*The time (in seconds) the connection needs to remain idle before TCP starts sending keepalive probes, if the socket option SO_KEEPALIVE has been set on this socket*)
| TCP_KEEPINTVL
Extra socket options with integer value not covered in Unix module

The time (in seconds) between individual keepalive probes
val setsockopt_int : Unix.file_descr -> socket_int_option -> int -> unit
Set an integer-valued option in the given socket
val getsockopt_int : Unix.file_descr -> socket_int_option -> int
Get the current value for the integer-valued option in the given socket

signalfd



OCaml bindings for signalfd(2) and related functions

Author: Kaustuv Chaudhuri <kaustuv.chaudhuri@inria.fr>

val signalfd : ?fd:Unix.file_descr ->
sigs:int list -> flags:int list -> unit -> Unix.file_descr
signalfd ?fd sigs flags () If the first optional argument is omitted, then a new file descriptor is allocated. Otherwise, the given file descriptor is modified (in which case it must have been created with signalfd previously). When you are done with the fd, remember to Unix.close it. Do not forget to block sigs with Unix.sigprocmask to prevent signal handling according to default dispositions.
See also signalfd(2) manual
type ssi 
This type represents signal information that is read(2) from the signalfd.
val signalfd_read : Unix.file_descr -> ssi
Blocking read(2) on a signalfd. Has undefined behaviour on non-signalfds. Every successful read consumes a pending signal.

Functions to query the signal information structure.

val ssi_signo_sys : ssi -> int
Get the signal value. This form is compatible with the signal values defined in the standard Sys module.

See signalfd(2) for the details of the remaining functions. Most of these integers are actually unsigned.

val ssi_signo : ssi -> int32
val ssi_errno : ssi -> int32
val ssi_code : ssi -> int32
val ssi_pid : ssi -> int32
val ssi_uid : ssi -> int32
val ssi_fd : ssi -> Unix.file_descr
val ssi_tid : ssi -> int32
val ssi_band : ssi -> int32
val ssi_overrun : ssi -> int32
val ssi_trapno : ssi -> int32
val ssi_status : ssi -> int32
val ssi_int : ssi -> int32
val ssi_ptr : ssi -> int64
val ssi_utime : ssi -> int64
val ssi_stime : ssi -> int64
val ssi_addr : ssi -> int64

POSIX resource operations

Author: Sylvain Le Gall <sylvain@le-gall.net>

type which_prio_t = 
| PRIO_PROCESS of int (*Priority for a process id*)
| PRIO_PGRP of int (*Priority for a process group id*)
| PRIO_USER of int
priority target
type priority = int 
Priority for a user id
type resource = 
| RLIMIT_CORE (*Limit on size of core dump file.*)
| RLIMIT_CPU (*Limit on CPU time per process.*)
| RLIMIT_DATA (*Limit on data segment size.*)
| RLIMIT_FSIZE (*Limit on file size.*)
| RLIMIT_NOFILE (*Limit on number of open files.*)
| RLIMIT_STACK (*Limit on stack size.*)
| RLIMIT_AS

Limit on address space size.
val string_of_resource : resource -> string
get resource name
module Rlimit: sig .. end
Limits
val getpriority : which_prio_t -> priority
Get nice value
val setpriority : which_prio_t -> priority -> unit
Set nice value
val getrlimit : resource -> Rlimit.t * Rlimit.t
Get maximum resource consumption.
Returns (soft,hard) limits
val setrlimit : resource ->
soft:Rlimit.t -> hard:Rlimit.t -> unit
Set maximum resource consumption

getrusage is not implemented because the only meaningful information it provides are ru_utime and ru_stime which can be accessed through Unix.times.

Memory management


type mlockall_flag = 
| MCL_CURRENT
| MCL_FUTURE
mlockall flag
val mlockall : mlockall_flag list -> unit
Lock all pages mapped into the address space of the calling process.
val munlockall : unit -> unit
Unlock all pages mapped into the address space of the calling process.
val memalign : int -> int -> Bigarray.int8_unsigned_elt carray8
memalign alignment size creates a Bigarray.Array1.t of size bytes, which data is aligned to alignment (must be a power of 2)

Author: Goswin von Brederlow


Time conversion


val strptime : string -> string -> Unix.tm
This function is the converse of the ExtUnixAll.strftime function. strptime fmt data convert a string containing time information data into a tm struct according to the format specified by fmt.
val asctime : Unix.tm -> string
Return the ascii representation of a given tm argument. The ascii time is returned in the form of a string like 'Wed Jun 30, 21:21:21 2005\n'
val strftime : string -> Unix.tm -> string
This functions is the converse of the ExtUnixAll.strptime function. strftime fmt data convert a a tm structure data into a string according to the format specified by fmt.
val tzname : bool -> string
tzname isdst
Returns abbreviated name of the current timezone
val timezone : unit -> int * bool
Returns timezone (seconds West of UTC) and daylight (whether there is time during the year when daylight saving time applies in this timezone)
val timegm : Unix.tm -> float
Inverse of Unix.gmtime

Pseudo terminal management

Author: Niki Yoshiuchi <aplusbi@gmail.com>

val posix_openpt : open_flag list -> Unix.file_descr
This function opens a pseudo-terminal device.
val grantpt : Unix.file_descr -> unit
This function grants access to the slave pseudo-terminal.
val unlockpt : Unix.file_descr -> unit
This function unlock a pseudo-terminal master/slave pair.
val ptsname : Unix.file_descr -> string
This function get the name of the slave pseudo-terminal.

Application self-debugging and diagnostics


val backtrace : unit -> string array
Returns a backtrace for the calling program

NB native function backtrace may fail to unwind the OCaml callstack correctly or even segfault. Do not use lightly.

See bug #1290, PR#5344 and Debian bug #637380 for details.

val malloc_stats : unit -> unit
Print brief heap summary statistics on stderr
val malloc_info : unit -> string
Returns the information about state of allocator
val ptrace_traceme : unit -> unit
val ptrace_peekdata : int -> nativeint -> nativeint
val ptrace_peektext : int -> nativeint -> nativeint
type ptrace_request = 
| PTRACE_ATTACH
| PTRACE_DETACH
val ptrace : int -> ptrace_request -> unit

Environment manipulation


val setenv : string -> string -> bool -> unit
setenv name value overwrite adds the variable name to the environment with the value value, if name does not already exist or overwrite is true
val unsetenv : string -> unit
unsetenv name removes variable name from the environment. If name does not exist in the environment, then the function succeeds, and the environment is unchanged.
val clearenv : unit -> unit
Clear the environment of all name-value pairs

Temporary directories


val mkdtemp : string -> string
mkdtemp template creates a unique temporary directory (with permissions 0700). Last six characters of template must be "XXXXXX".
val mkstemp : ?suffix:string -> string -> Unix.file_descr * string
mkstemp ?(suffix="") prefix generates a unique temporary filename in the form prefixXXXXXXsuffix, creates and opens the file, and returns an open file descriptor and name for the file.
val mkostemp : ?suffix:string ->
?flags:open_flag list -> string -> Unix.file_descr * string
mkostemp ?(suffix="") ?(flags=[]) prefix generates a unique temporary filename in the form prefixXXXXXXsuffix, creates and opens the file with flags, and returns an open file descriptor and name for the file.

Byte order conversion


module BigEndian: sig .. end
big endian functions
module LittleEndian: sig .. end
little endian functions
module HostEndian: sig .. end
host endian functions

read_credentials

Author: Andre Nathan

val read_credentials : Unix.file_descr -> int * int * int
Reads sender credentials from a file descriptor, returning a 3-element tuple containing the sender process' PID, UID and GID.

fexecve

Author: Andre Nathan

val fexecve : Unix.file_descr -> string array -> string array -> 'a
fexecve fd args env executes the program in file represented by file descriptor fd with arguments args and environment variables given by env. As with the execv* functions, on success fexecve never returns; the current process is replaced by the new one.

sendmsg / recvmsg

Author: Andre Nathan

val sendmsg : Unix.file_descr -> ?sendfd:Unix.file_descr -> string -> unit
Send a message and optionally a file descriptor through a socket. Passing file descriptors requires UNIX domain sockets.
val recvmsg_fd : Unix.file_descr -> Unix.file_descr option * string
Recieve a message and possibly a file descriptor from a socket.
val sendfd : Unix.file_descr -> Unix.file_descr -> unit
Send a file descriptor through a UNIX domain socket.
val recvfd : Unix.file_descr -> Unix.file_descr
Receive a file descriptor sent through a UNIX domain socket.
exception Recvfd of Unix.file_descr * string
Receive a message sent through a UNIX domain socket. Raises Recvfd(fd, msg) if a file descriptor is recieved.
val recvmsg : Unix.file_descr -> string
val recvmsg_nofd : Unix.file_descr -> string
Receive a message sent through a UNIX domain socket. Closes and ignores file descriptors.

sysconf

Author: Roman Vorobets

type sysconf_name = 
| ARG_MAX (*The maximum length of the arguments to the exec(3) family of functions.*)
| CHILD_MAX (*The max number of simultaneous processes per user ID.*)
| HOST_NAME_MAX (*Max length of a hostname, not including the terminating null byte, as returned by gethostname(2).*)
| LOGIN_NAME_MAX (*Maximum length of a login name, including the terminating null byte.*)
| CLK_TCK (*The number of clock ticks per second.*)
| OPEN_MAX (*The maximum number of files that a process can have open at any time.*)
| PAGESIZE (*Size of a page in bytes.*)
| RE_DUP_MAX (*The number of repeated occurrences of a BRE permitted by regexec(3) and regcomp(3).*)
| STREAM_MAX (*The maximum number of streams that a process can have open at any time.*)
| SYMLOOP_MAX (*The maximum number of symbolic links seen in a pathname before resolution returns ELOOP.*)
| TTY_NAME_MAX (*The maximum length of terminal device name, including the terminating null byte.*)
| TZNAME_MAX (*The maximum number of bytes in a timezone name.*)
| POSIX_VERSION (*Indicates the year and month the POSIX.1 standard was approved in the format YYYYMML; the value 199009L indicates the Sept. 1990 revision.*)
| LINE_MAX (*The maximum length of a utility's input line, either from standard input or from a file. This includes space for a trailing newline.*)
| POSIX2_VERSION (*Indicates the version of the POSIX.2 standard in the format of YYYYMML.*)
| PHYS_PAGES (*The number of pages of physical memory. Note that it is possible for the product of this value and the value of PAGE_SIZE to overflow.*)
| AVPHYS_PAGES (*The number of currently available pages of physical memory.*)
| NPROCESSORS_CONF (*The number of processors configured.*)
| NPROCESSORS_ONLN
name of the variable

The number of processors currently online (available).
val sysconf : sysconf_name -> int64
get configuration information at runtime

splice

Author: Pierre Chambart <pierre.chambart@ocamlpro.com>

type splice_flag = 
| SPLICE_F_MOVE (*Attempt to move pages instead of copying. Only a hint to the kernel*)
| SPLICE_F_NONBLOCK (*Do not block on I/O*)
| SPLICE_F_MORE (*Announce that more data will be coming. Hint used by sockets*)
| SPLICE_F_GIFT
splice functions flags

The user pages are a gift to the kernel. The application may not modify this memory ever, or page cache and on-disk data may differ. Gifting pages to the kernel means that a subsequent splice(2) SPLICE_F_MOVE can successfully move the pages; if this flag is not specified, then a subsequent splice(2) SPLICE_F_MOVE must copy the pages. Data must also be properly page aligned, both in memory and length.

Only use for vmsplice.

val splice : Unix.file_descr ->
int option ->
Unix.file_descr -> int option -> int -> splice_flag list -> int
splice fd_in off_in fd_out off_out len flags moves data between two file descriptors without copying between kernel address space and user address space. It transfers up to len bytes of data from the file descriptor fd_in to the file descriptor fd_out, where one of the descriptors must refer to a pipe.

If fd_in refers to a pipe, then off_in must be None. If fd_in does not refer to a pipe and off_in is None, then bytes are read from fd_in starting from the current file offset, and the current file offset is adjusted appropriately. If fd_in does not refer to a pipe and off_in is Some n, then n mspecifies the starting offset from which bytes will be read from fd_in; in this case, the current file offset of fd_in is not changed. Analogous statements apply for fd_out and off_out.
Returns the number of bytes spliced to or from the pipe. A return value of 0 means that there was no data to transfer, and it would not make sense to block, because there are no writers connected to the write end of the pipe referred to by fd_in.

val tee : Unix.file_descr ->
Unix.file_descr -> int -> splice_flag list -> int
tee fd_in fd_out len flags duplicates up to len bytes of data from the pipe fd_in to the pipe fd_out. It does not consume the data that is duplicated from fd_in; therefore, that data can be copied by a subsequent splice.
Returns the number of bytes that were duplicated between the input and output. A return value of 0 means that there was no data to transfer, and it would not make sense to block, because there are no writers connected to the write end of the pipe referred to by fd_in.

Bigarray variants


module BA: sig .. end

Meta


val have : string -> bool option
have name
Returns indication whether function name is available e.g. have "eventfd"