package xapi-stdext-unix
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=ed012587042f93b2cf2b1c49ecf7fb2c4ffd6bfea4af82cdfb8b9b78fd957215
doc/xapi-stdext-unix/Xapi_stdext_unix/Unixext/index.html
Module Xapi_stdext_unix.Unixext
A collection of extensions to the Unix module.
val mkdir_safe : string -> Unix.file_perm -> unitval mkdir_rec : string -> Unix.file_perm -> unitval with_file :
string ->
Unix.open_flag list ->
Unix.file_perm ->
(Unix.file_descr -> 'a) ->
'aval with_input_channel : string -> (in_channel -> 'a) -> 'aval with_directory : string -> (Unix.dir_handle -> 'a) -> 'aval lines_fold : ('a -> string -> 'a) -> 'a -> in_channel -> 'aFolds function f over every line in the input channel
val lines_iter : (string -> unit) -> in_channel -> unitApplies function f to every line in the input channel
Folds function f over every line in the file at file_path using the starting value start.
read_lines path returns a list of lines in the file at path.
Applies function f to every line in the file at file_path.
val fd_blocks_fold : int -> ('a -> bytes -> 'a) -> 'a -> Unix.file_descr -> 'afd_blocks_fold block_size f start fd folds f over blocks (strings) from the fd fd with initial value start
val buffer_of_fd : Unix.file_descr -> Buffer.tbuffer_of_fd fd returns a Buffer.t containing all data read from fd up to EOF
val string_of_fd : Unix.file_descr -> stringstring_of_fd fd returns a string containing all data read from fd up to EOF
val buffer_of_file : string -> Buffer.tbuffer_of_file file returns a Buffer.t containing the contents of file
string_of_file file returns a string containing the contents of file
val atomic_write_to_file :
string ->
Unix.file_perm ->
(Unix.file_descr -> 'a) ->
'aatomic_write_to_file fname perms f writes a file to path fname using the function f with permissions perms. In case of error during the operation the file with the path fname is not modified at all.
write_string_to_file fname contents creates a file with path fname with the string contents as its contents, atomically
write_string_to_file fname contents creates a file with path fname with the buffer contents as its contents, atomically
val execv_get_output : string -> string array -> int * Unix.file_descrval copy_file : ?limit:int64 -> Unix.file_descr -> Unix.file_descr -> int64Sets both the access and modification times of the file * at the given path to the current time. Creates an empty * file at the given path if no such file already exists.
Returns true if and only if an empty file exists at the given path.
Safely deletes a file at the given path if (and only if) the * file exists and is empty. Returns true if a file was deleted.
val open_connection_fd : string -> int -> Unix.file_descrval open_connection_unix_fd : string -> Unix.file_descrstring_of_signal x translates an ocaml signal number into * a string suitable for logging.
val proxy : Unix.file_descr -> Unix.file_descr -> unitval really_read : Unix.file_descr -> bytes -> int -> int -> unitval really_read_string : Unix.file_descr -> int -> stringval really_write : Unix.file_descr -> string -> int -> int -> unitreally_write keeps repeating the write operation until all bytes * have been written or an error occurs. This is not atomic but is * robust against EINTR errors. * See: https://ocaml.github.io/ocamlunix/ocamlunix.html#sec118
val really_write_string : Unix.file_descr -> string -> unitval try_read_string : ?limit:int -> Unix.file_descr -> stringval time_limited_write : Unix.file_descr -> int -> bytes -> float -> unitval time_limited_write_substring :
Unix.file_descr ->
int ->
string ->
float ->
unitval time_limited_read : Unix.file_descr -> int -> float -> stringval read_data_in_string_chunks :
(string -> int -> unit) ->
?block_size:int ->
?max_bytes:int ->
Unix.file_descr ->
intval read_data_in_chunks :
(bytes -> int -> unit) ->
?block_size:int ->
?max_bytes:int ->
Unix.file_descr ->
intval spawnvp :
?pid_callback:(int -> unit) ->
string ->
string array ->
Unix.process_statusval set_tcp_nodelay : Unix.file_descr -> bool -> unitval set_sock_keepalives : Unix.file_descr -> int -> int -> int -> unitval fsync : Unix.file_descr -> unitval blkgetsize64 : Unix.file_descr -> int64val int_of_file_descr : Unix.file_descr -> intval file_descr_of_int : int -> Unix.file_descrval close_all_fds_except : Unix.file_descr list -> unitval seek_to : Unix.file_descr -> int -> intval seek_rel : Unix.file_descr -> int -> intval current_cursor_pos : Unix.file_descr -> intval send_fd :
Unix.file_descr ->
bytes ->
int ->
int ->
Unix.msg_flag list ->
Unix.file_descr ->
intval send_fd_substring :
Unix.file_descr ->
string ->
int ->
int ->
Unix.msg_flag list ->
Unix.file_descr ->
intval recv_fd :
Unix.file_descr ->
bytes ->
int ->
int ->
Unix.msg_flag list ->
int * Unix.sockaddr * Unix.file_descrval statvfs : string -> statvfs_tval domain_of_addr : string -> Unix.socket_domain optionReturns Some Unix.PF_INET or Some Unix.PF_INET6 if passed a valid IP address, otherwise returns None.
module Direct : sig ... endPerform I/O in O_DIRECT mode using 4KiB page-aligned buffers