Xapi_stdext_unix.UnixextSourceA collection of extensions to the Unix module.
val with_file :
string ->
Unix.open_flag list ->
Unix.file_perm ->
(Unix.file_descr -> 'a) ->
'aException to be raised in function to break out of file_lines_fold.
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
Alias for function file_lines_iter.
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
Returns true if and only if a file exists at the given path.
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 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 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_descrtype statvfs_t = {f_bsize : int64;f_frsize : int64;f_blocks : int64;f_bfree : int64;f_bavail : int64;f_files : int64;f_ffree : int64;f_favail : int64;f_fsid : int64;f_flag : int64;f_namemax : int64;}Returns Some Unix.PF_INET or Some Unix.PF_INET6 if passed a valid IP address, otherwise returns None.