Xapi_stdext_unix.Unixext
A collection of extensions to the Unix
module.
removes a file or recursively removes files/directories below a directory without following symbolic links. If path is a directory, it is only itself removed if rm_top is true. If path is non-existent nothing happens, it does not lead to an error.
Folds function f
over every line in the input channel
Applies 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
.
fd_blocks_fold block_size f start fd
folds f
over blocks (strings) from the fd fd
with initial value start
buffer_of_fd fd
returns a Buffer.t containing all data read from fd
up to EOF
string_of_fd fd
returns a string containing all data read from fd
up to EOF
buffer_of_file file
returns a Buffer.t containing the contents of file
string_of_file file
returns a string containing the contents of file
atomic_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
Sets 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.
string_of_signal x
translates an ocaml signal number into * a string suitable for logging.
really_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 statvfs : string -> statvfs_t
Returns Some Unix.PF_INET or Some Unix.PF_INET6 if passed a valid IP address, otherwise returns None.
module Direct : sig ... end
Perform I/O in O_DIRECT mode using 4KiB page-aligned buffers