package extunix

  1. Overview
  2. Docs
include sig ... end
val unsafe_all_pread : Unix.file_descr -> int -> ('a, 'b) carray -> int

all_pread fd off buf reads up to size of buf bytes from file descriptor fd at offset off (from the start of the file) into the buffer buf. 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 -> ('a, 'b) carray -> int
val unsafe_single_pread : Unix.file_descr -> int -> ('a, 'b) carray -> int

single_pread fd off buf reads up to size of buf bytes from file descriptor fd at offset off (from the start of the file) into the buffer buf. 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. Unlike the string variant of the same name there is no limit on the number of characters read.

val single_pread : Unix.file_descr -> int -> ('a, 'b) carray -> int
val unsafe_pread : Unix.file_descr -> int -> ('a, 'b) carray -> int

pread fd off buf reads up to size of buf bytes from file descriptor fd at offset off (from the start of the file) into the buffer buf. 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 -> ('a, 'b) carray -> int
val unsafe_intr_pread : Unix.file_descr -> int -> ('a, 'b) carray -> int

intr_pread fd off buf reads up to size of buf bytes from file descriptor fd at offset off (from the start of the file) into the buffer buf. 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 -> ('a, 'b) carray -> int
include sig ... end
val unsafe_all_pwrite : Unix.file_descr -> int -> ('a, 'b) carray -> int

all_pwrite fd off buf writes up to size of buf bytes from file descriptor fd at offset off (from the start of the file) into the buffer buf. 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 -> ('a, 'b) carray -> int
val unsafe_single_pwrite : Unix.file_descr -> int -> ('a, 'b) carray -> int

single_pwrite fd off buf writes up to size of buf bytes from file descriptor fd at offset off (from the start of the file) into the buffer buf. 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. Unlike the string variant of the same name there is no limit on the number of characters written.

val single_pwrite : Unix.file_descr -> int -> ('a, 'b) carray -> int
val unsafe_pwrite : Unix.file_descr -> int -> ('a, 'b) carray -> int

pwrite fd off buf writes up to size of buf bytes from file descriptor fd at offset off (from the start of the file) into the buffer buf. 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 -> ('a, 'b) carray -> int
val unsafe_intr_pwrite : Unix.file_descr -> int -> ('a, 'b) carray -> int

intr_pwrite fd off buf writes up to size of buf bytes from file descriptor fd at offset off (from the start of the file) into the buffer buf. 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 -> ('a, 'b) carray -> int
include sig ... end
val all_read : Unix.file_descr -> ('a, 'b) carray -> int

all_read fd buf reads up to size of buf bytes from file descriptor fd into the buffer buf.

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 single_read : Unix.file_descr -> ('a, 'b) carray -> int

single_read fd buf reads up to size of buf bytes from file descriptor fd into the buffer buf.

single_read attempts to read only once. Returns the number of characters read or raises an Unix.Unix_error exception. Unlike the string variant of the same name there is no limit on the number of characters read.

val read : Unix.file_descr -> ('a, 'b) carray -> int

read fd buf reads up to size of buf bytes from file descriptor fd into the buffer buf.

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 intr_read : Unix.file_descr -> ('a, 'b) carray -> int

intr_read fd buf reads up to size of buf bytes from file descriptor fd into the buffer buf.

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.

include sig ... end
val all_write : Unix.file_descr -> ('a, 'b) carray -> int

all_write fd buf writes up to size of buf bytes from file descriptor fd into the buffer buf.

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 single_write : Unix.file_descr -> ('a, 'b) carray -> int

single_write fd buf writes up to size of buf bytes from file descriptor fd into the buffer buf.

single_write attempts to write only once. Returns the number of characters written or raises an Unix.Unix_error exception. Unlike the string variant of the same name there is no limit on the number of characters written.

val write : Unix.file_descr -> ('a, 'b) carray -> int

write fd buf writes up to size of buf bytes from file descriptor fd into the buffer buf.

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 intr_write : Unix.file_descr -> ('a, 'b) carray -> int

intr_write fd buf writes up to size of buf bytes from file descriptor fd into the buffer buf.

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.

Byte order conversion

module BigEndian : sig ... end
module LittleEndian : sig ... end
module HostEndian : sig ... end
val unsafe_get_substr : 'a carray8 -> int -> int -> string

unsafe_get_substr buf off len extracts the substring from buffer buf starting at offset off and length len. Bounds checking is not performed. Use with caution and only when the program logic guarantees that the access is within bounds.

val get_substr : ('a, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t -> int -> int -> string

get_substr buf off len same as unsafe_get_substr but with bounds checking.

val unsafe_set_substr : 'a carray8 -> int -> string -> unit

unsafe_set_substr buf off str stores the string in buffer buf starting at offset off. Bounds checking is not performed. Use with caution and only when the program logic guarantees that the access is within bounds.

val set_substr : ('a, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t -> int -> string -> unit

set_substr buf off str same as unsafe_set_substr but with bounds checking.

include sig ... end

splice

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

type 'a iov = {
  1. iov_buf : 'a carray8;
  2. iov_off : int;
  3. iov_len : int;
}

I/O vector. Used to send multiple data using a single system call

val vmsplice : Unix.file_descr -> 'a iov array -> splice_flag list -> int

vmsplice fd iovs flags sends the data described by iovs to the pipe fd

  • returns

    the number of bytes transferred to the pipe.

OCaml

Innovation. Community. Security.