summaryrefslogtreecommitdiffstats
path: root/otherlibs/unix/unixLabels.mli
diff options
context:
space:
mode:
Diffstat (limited to 'otherlibs/unix/unixLabels.mli')
-rw-r--r--otherlibs/unix/unixLabels.mli92
1 files changed, 61 insertions, 31 deletions
diff --git a/otherlibs/unix/unixLabels.mli b/otherlibs/unix/unixLabels.mli
index 4dc411b0b..76ff890b1 100644
--- a/otherlibs/unix/unixLabels.mli
+++ b/otherlibs/unix/unixLabels.mli
@@ -236,10 +236,14 @@ type open_flag = Unix.open_flag =
| O_TRUNC (** Truncate to 0 length if existing *)
| O_EXCL (** Fail if existing *)
| O_NOCTTY (** Don't make this dev a controlling tty *)
- | O_DSYNC (** Writes complete as `Synchronised I/O data integrity completion' *)
- | O_SYNC (** Writes complete as `Synchronised I/O file integrity completion' *)
- | O_RSYNC (** Reads complete as writes (depending on O_SYNC/O_DSYNC) *)
- | O_SHARE_DELETE (** Windows only: allow the file to be deleted while still open *)
+ | O_DSYNC (** Writes complete as `Synchronised I/O data
+ integrity completion' *)
+ | O_SYNC (** Writes complete as `Synchronised I/O file
+ integrity completion' *)
+ | O_RSYNC (** Reads complete as writes (depending
+ on O_SYNC/O_DSYNC) *)
+ | O_SHARE_DELETE (** Windows only: allow the file to be deleted
+ while still open *)
| O_CLOEXEC (** Set the close-on-exec flag on the
descriptor returned by {!openfile} *)
(** The flags to {!UnixLabels.openfile}. *)
@@ -257,23 +261,32 @@ val openfile : string -> mode:open_flag list -> perm:file_perm -> file_descr
val close : file_descr -> unit
(** Close a file descriptor. *)
-val read : file_descr -> buf:string -> pos:int -> len:int -> int
-(** [read fd buff ofs len] reads [len] characters from descriptor
- [fd], storing them in string [buff], starting at position [ofs]
- in string [buff]. Return the number of characters actually read. *)
+val read : file_descr -> buf:bytes -> pos:int -> len:int -> int
+(** [read fd buff ofs len] reads [len] bytes from descriptor [fd],
+ storing them in byte sequence [buff], starting at position [ofs] in
+ [buff]. Return the number of bytes actually read. *)
-val write : file_descr -> buf:string -> pos:int -> len:int -> int
-(** [write fd buff ofs len] writes [len] characters to descriptor
- [fd], taking them from string [buff], starting at position [ofs]
- in string [buff]. Return the number of characters actually
- written. [write] repeats the writing operation until all characters
- have been written or an error occurs. *)
+val write : file_descr -> buf:bytes -> pos:int -> len:int -> int
+(** [write fd buff ofs len] writes [len] bytes to descriptor [fd],
+ taking them from byte sequence [buff], starting at position [ofs]
+ in [buff]. Return the number of bytes actually written. [write]
+ repeats the writing operation until all bytes have been written or
+ an error occurs. *)
-val single_write : file_descr -> buf:string -> pos:int -> len:int -> int
+val single_write : file_descr -> buf:bytes -> pos:int -> len:int -> int
(** Same as [write], but attempts to write only once.
Thus, if an error occurs, [single_write] guarantees that no data
has been written. *)
+val write_substring : file_descr -> buf:string -> pos:int -> len:int -> int
+(** Same as [write], but take the data from a string instead of a byte
+ sequence. *)
+
+val single_write_substring :
+ file_descr -> buf:string -> pos:int -> len:int -> int
+(** Same as [single_write], but take the data from a string instead of
+ a byte sequence. *)
+
(** {6 Interfacing with the standard input/output library} *)
@@ -772,9 +785,11 @@ val utimes : string -> access:float -> modif:float -> unit
type interval_timer = Unix.interval_timer =
ITIMER_REAL
- (** decrements in real time, and sends the signal [SIGALRM] when expired.*)
+ (** decrements in real time, and sends the signal [SIGALRM] when
+ expired.*)
| ITIMER_VIRTUAL
- (** decrements in process virtual time, and sends [SIGVTALRM] when expired. *)
+ (** decrements in process virtual time, and sends [SIGVTALRM] when
+ expired. *)
| ITIMER_PROF
(** (for profiling) decrements both when the process
is running and when the system is running on behalf of the
@@ -994,23 +1009,34 @@ type msg_flag = Unix.msg_flag =
{!UnixLabels.send} and {!UnixLabels.sendto}. *)
val recv :
- file_descr -> buf:string -> pos:int -> len:int -> mode:msg_flag list -> int
+ file_descr -> buf:bytes -> pos:int -> len:int -> mode:msg_flag list -> int
(** Receive data from a connected socket. *)
val recvfrom :
- file_descr -> buf:string -> pos:int -> len:int -> mode:msg_flag list ->
+ file_descr -> buf:bytes -> pos:int -> len:int -> mode:msg_flag list ->
int * sockaddr
(** Receive data from an unconnected socket. *)
val send :
- file_descr -> buf:string -> pos:int -> len:int -> mode:msg_flag list -> int
+ file_descr -> buf:bytes -> pos:int -> len:int -> mode:msg_flag list -> int
(** Send data over a connected socket. *)
+val send_substring :
+ file_descr -> buf:string -> pos:int -> len:int -> mode:msg_flag list -> int
+(** Same as [send], but take the data from a string instead of a byte
+ sequence. *)
+
val sendto :
- file_descr -> buf:string -> pos:int -> len:int -> mode:msg_flag list ->
+ file_descr -> buf:bytes -> pos:int -> len:int -> mode:msg_flag list ->
addr:sockaddr -> int
(** Send data over an unconnected socket. *)
+val sendto_substring :
+ file_descr -> bug:string -> pos:int -> len:int -> mode:msg_flag list
+ -> sockaddr -> int
+(** Same as [sendto], but take the data from a string instead of a
+ byte sequence. *)
+
(** {6 Socket options} *)
@@ -1031,12 +1057,12 @@ type socket_bool_option =
([true]/[false]) value. *)
type socket_int_option =
- SO_SNDBUF (** Size of send buffer *)
- | SO_RCVBUF (** Size of received buffer *)
- | SO_ERROR (** Deprecated. Use {!Unix.getsockopt_error} instead. *)
- | SO_TYPE (** Report the socket type *)
- | SO_RCVLOWAT (** Minimum number of bytes to process for input operations *)
- | SO_SNDLOWAT (** Minimum number of bytes to process for output operations *)
+ SO_SNDBUF (** Size of send buffer *)
+ | SO_RCVBUF (** Size of received buffer *)
+ | SO_ERROR (** Deprecated. Use {!Unix.getsockopt_error} instead. *)
+ | SO_TYPE (** Report the socket type *)
+ | SO_RCVLOWAT (** Minimum number of bytes to process for input operations *)
+ | SO_SNDLOWAT (** Minimum number of bytes to process for output operations *)
(** The socket options that can be consulted with {!UnixLabels.getsockopt_int}
and modified with {!UnixLabels.setsockopt_int}. These options have an
integer value. *)
@@ -1071,17 +1097,21 @@ val setsockopt_int : file_descr -> socket_int_option -> int -> unit
(** Same as {!Unix.setsockopt} for an integer-valued socket option. *)
val getsockopt_optint : file_descr -> socket_optint_option -> int option
-(** Same as {!Unix.getsockopt} for a socket option whose value is an [int option]. *)
+(** Same as {!Unix.getsockopt} for a socket option whose value is
+ an [int option]. *)
val setsockopt_optint :
file_descr -> socket_optint_option -> int option -> unit
-(** Same as {!Unix.setsockopt} for a socket option whose value is an [int option]. *)
+(** Same as {!Unix.setsockopt} for a socket option whose value is
+ an [int option]. *)
val getsockopt_float : file_descr -> socket_float_option -> float
-(** Same as {!Unix.getsockopt} for a socket option whose value is a floating-point number. *)
+(** Same as {!Unix.getsockopt} for a socket option whose value is a
+ floating-point number. *)
val setsockopt_float : file_descr -> socket_float_option -> float -> unit
-(** Same as {!Unix.setsockopt} for a socket option whose value is a floating-point number. *)
+(** Same as {!Unix.setsockopt} for a socket option whose value is a
+ floating-point number. *)
val getsockopt_error : file_descr -> error option
(** Return the error condition associated with the given socket,