NAME
KS_fs_replace,
KS_fs_tmpfd —
file system utility
functions
SYNOPSIS
#include
<libks/fs.h>
int
KS_fs_replace(const
char *path, const char
*buf, size_t
buflen);
int
KS_fs_tmpfd(const
char *buf, size_t
buflen, char *path,
size_t pathsiz);
DESCRIPTION
The fs API provides functions for file system interactions.
The
KS_fs_replace()
function replaces the contents of path with
buflen bytes from buf in an
atomic fashion.
The
KS_fs_tmpfd()
function creates a temporary read/write file descriptor and writes out
buflen number of bytes from buf
to it. The same file descriptor can be accessed through the
path buffer which must have a capacity of at least
PATH_MAX, communicated through
pathsiz.
RETURN VALUES
KS_fs_replace() returns zero on success.
On failure, -1 is returned and errno is set
accordingly.
KS_fs_tmpfd() returns a file descriptor
greater to or equal to zero on success. On failure, -1 is returned and
errno is set accordingly.
AUTHORS
Anton Lindqvist <anton@basename.se>