module Netsys:Some POSIX system calls missing in thesig
..end
Unix
moduleval restart : ('a -> 'b) -> 'a -> 'b
restart f arg
calls f arg
, and restarts this call if the
exception Unix_error(EINTR,_,_)
is caught.
Note that there are some cases where this handling of EINTR
is
not sufficient:
Unix.select
: When
EINTR
is caught the timeout should be adjusted.Unix.connect
with a blocking descriptor because this is not
well-enough specified by POSIXval restarting_select : Unix.file_descr list ->
Unix.file_descr list ->
Unix.file_descr list ->
float -> Unix.file_descr list * Unix.file_descr list * Unix.file_descr list
Unix.select
that handles the EINTR
conditionval really_write : Unix.file_descr -> string -> int -> int -> unit
really_write fd s pos len
: Writes exactly the len
bytes from s
to fd
starting at pos
. The conditions EINTR
, EAGAIN
and
EWOULDBLOCK
are handled.val blocking_read : Unix.file_descr -> string -> int -> int -> int
let p = blocking_read fd s pos len
: Reads exactly p
bytes from fd
and stores them in s
starting at pos
where p
is the minimum
of len
and the number of bytes that are available on fd
until
the end of the file. If the function is called with len>0
but
returns less than len
this indicates end of file.
The conditions EINTR
, EAGAIN
and EWOULDBLOCK
are handled.val really_read : Unix.file_descr -> string -> int -> int -> unit
really_read fd s pos len
: Reads exactly len
bytes from fd
and stores them in s
starting at pos
. If the end of file condition
is seen before len
bytes are read, the exception End_of_file
is raised, and it is unspecified how many bytes have been stored in
s
. The conditions EINTR
, EAGAIN
and EWOULDBLOCK
are handled.val domain_of_inet_addr : Unix.inet_addr -> Unix.socket_domain
val int_of_file_descr : Unix.file_descr -> int
val file_descr_of_int : int -> Unix.file_descr
val _exit : int -> unit
exit
.val sysconf_open_max : unit -> int
fd
:
fd < sysconf_open_max()
val getpgid : int -> int
val getpgrp : unit -> int
getpgid 0
, i.e. returns the process group ID of the
current process.val setpgid : int -> int -> unit
setpgid pid pgid
: Set the process group ID of the process pid
to pgid
. If pid = 0
, the process group ID of the current process
is changed. If pgid = 0
, as process group ID the process ID of the
process referenced by pid
is used.
It is only possible for a process to join a process group if both
belong to the same session.
val setpgrp : unit -> unit
setpgid 0 0
: A new process group ID is created, and the
current process becomes its sole member.val tcgetpgrp : Unix.file_descr -> int
val tcsetpgrp : Unix.file_descr -> int -> unit
val ctermid : unit -> string
val ttyname : Unix.file_descr -> string
val getsid : int -> int
val setreuid : int -> int -> unit
val setregid : int -> int -> unit
val have_posix_shm : unit -> bool
type
shm_open_flag =
| |
SHM_O_RDONLY |
| |
SHM_O_RDWR |
| |
SHM_O_CREAT |
| |
SHM_O_EXCL |
| |
SHM_O_TRUNC |
val shm_open : string -> shm_open_flag list -> int -> Unix.file_descr
The open flags are interpreted as follows:
SHM_O_RDONLY
: Open the object for read accessSHM_O_RDWR
: Open the object for read-write accessSHM_O_CREAT
: Create the object if it does not existSHM_O_EXCL
: If SHM_O_CREAT
was also specified, and a an object
with the given name already exists, return an error
(Unix.EEXIST
).SHM_O_TRUNC
: If the object already exists, truncate it to
zero bytesSHM_O_RDONLY
or SHM_O_RDWR
must be given.
On success, the function returns a file descriptor representing the
object. To access the object, one has to memory-map this file
(in O'Caml use one of the map_file
functions in the Bigarray
module). Use Unix.ftruncate
to resize the object.
Note that it is unspecified whether this file pops up somewhere in the file system, and if so, where.
If a system error occurs, the function raises a Unix.Unix_error
exception.
val shm_unlink : string -> unit