module Unix_ext: sig
.. end
Interface to additional Unix-system calls
Utility functions
val unix_error : int -> string -> string -> 'a
val mknod : ?file_kind:Unix.file_kind ->
?perm:int -> ?major:int -> ?minor:int -> string -> unit
I/O vectors
module IOVec: sig
.. end
I/O-vectors for scatter/gather-operations
I/O functions
val int_of_file_descr : Unix.file_descr -> int
int_of_file_descr fd
converts file descriptor fd
to the internal
integer value.
val file_descr_of_int : int -> Unix.file_descr
file_descr_of_int n
converts an integer to a file descriptor.
val dirfd : Unix.dir_handle -> Unix.file_descr
Extract a file descriptor from a directory handle.
val sync : unit -> unit
Synchronize all filesystem buffers with disk.
val fsync : Unix.file_descr -> unit
Synchronize the kernel buffers of a given file descriptor with disk.
val fdatasync : Unix.file_descr -> unit
Synchronize the kernel buffers of a given file descriptor with disk,
but do not necessarily write file attributes.
val readdir_ino : Unix.dir_handle -> string * int
readdir_ino dh
return the next entry in a directory (((filename,
inode)
).
Raises End_of_file
when the end of the directory has been
reached.
val read_assume_nonblocking : Unix.file_descr -> ?pos:int -> ?len:int -> string -> int
val write_assume_nonblocking : Unix.file_descr -> ?pos:int -> ?len:int -> string -> int
val writev_assume_nonblocking : Unix.file_descr -> ?count:int -> string IOVec.t array -> int
val pselect : Unix.file_descr list ->
Unix.file_descr list ->
Unix.file_descr list ->
float ->
int list ->
Unix.file_descr list * Unix.file_descr list * Unix.file_descr list
pselect rfds wfds efds timeout sigmask
like Unix.select
but
also allows one to wait for the arrival of signals.
Clock functions
type
clock
Type of Unix-clocks
val clock_gettime : clock -> float
val clock_settime : clock -> float -> unit
val clock_getres : clock -> float
val pthread_getcpuclockid : Thread.t -> clock
module RLimit: sig
.. end
val getrlimit : RLimit.resource -> RLimit.t
val setrlimit : RLimit.resource -> RLimit.t -> unit
module RUsage: sig
.. end
Resource usage
val getrusage : RUsage.who -> RUsage.t
System configuration
type
sysconf =
| |
ARG_MAX |
| |
CHILD_MAX |
| |
HOST_NAME_MAX |
| |
LOGIN_NAME_MAX |
| |
OPEN_MAX |
| |
PAGESIZE |
| |
RE_DUP_MAX |
| |
STREAM_MAX |
| |
SYMLOOP_MAX |
| |
TTY_NAME_MAX |
| |
TZNAME_MAX |
| |
POSIX_VERSION |
| |
PHYS_PAGES |
| |
AVPHYS_PAGES |
| |
IOV_MAX |
val sysconf : sysconf -> int64
POSIX thread functions
val mutex_timedlock : Mutex.t -> float -> bool
mutex_timedlock mtx timeout
tries to lock mtx
, but returns once
timeout
expires. Note that timeout
is an absolute Unix-time
to prevent time-related race conditions.
Returns false
iff
the timer expired without the lock being acquired. See man
pthread_mutex_timedlock
for details.
val condition_timedwait : Condition.t -> Mutex.t -> float -> bool
condition_timedwait cnd mtx timeout
waits on condition variable
cond
with mutex mtx
until either the condition is signalled,
or until timeout
expires. Note that timeout
is an absolute
Unix-time to prevent time-related race conditions.
Returns false
iff the timer expired, but this does not mean that the condition is
not true due to an unavoidable race condition in the system call.
See man pthread_cond_timedwait
for details.
Pathname resolution
val realpath : string -> string
realpath path
Raises Unix_error
on errors.
Returns the canonicalized absolute pathname of path
.
Temp dir creation
val mkdtemp : string -> string
mkdtemp pattern
pattern must end with XXXXXX.
Will replace XXXXXX with unique characters and create a new directory
with the generated name.
Raises Unix_error
on errors.
Signal handling
val abort : unit -> 'a
User id, group id
val initgroups : string -> int -> unit