ECP-VELOC Components
User documentation for all components
Functions
kvtree_io.h File Reference

Go to the source code of this file.

Functions

mode_t kvtree_getmode (int read, int write, int execute)
 
int kvtree_open (const char *file, int flags,...)
 
int kvtree_close (const char *file, int fd)
 
int kvtree_file_lock_write (const char *file, int fd)
 
int kvtree_file_unlock (const char *file, int fd)
 
int kvtree_open_with_lock (const char *file, int flags, mode_t mode, int write)
 
int kvtree_close_with_unlock (const char *file, int fd)
 
int kvtree_lseek (const char *file, int fd, off_t pos, int whence)
 
ssize_t kvtree_read_attempt (const char *file, int fd, void *buf, size_t size)
 
ssize_t kvtree_write_attempt (const char *file, int fd, const void *buf, size_t size)
 
int kvtree_file_is_readable (const char *file)
 

Function Documentation

◆ kvtree_close()

int kvtree_close ( const char *  file,
int  fd 
)

close file with an fsync

◆ kvtree_close_with_unlock()

int kvtree_close_with_unlock ( const char *  file,
int  fd 
)

unlocks the specified file descriptor and then closes the file

◆ kvtree_file_is_readable()

int kvtree_file_is_readable ( const char *  file)

tests whether the file or directory is readable

◆ kvtree_file_lock_write()

int kvtree_file_lock_write ( const char *  file,
int  fd 
)

get and release file locks

◆ kvtree_file_unlock()

int kvtree_file_unlock ( const char *  file,
int  fd 
)

◆ kvtree_getmode()

mode_t kvtree_getmode ( int  read,
int  write,
int  execute 
)

returns user's current mode as determine by their umask

◆ kvtree_lseek()

int kvtree_lseek ( const char *  file,
int  fd,
off_t  pos,
int  whence 
)

seek file descriptor to specified position

◆ kvtree_open()

int kvtree_open ( const char *  file,
int  flags,
  ... 
)

open file with specified flags and mode, retry open a few times on failure

◆ kvtree_open_with_lock()

int kvtree_open_with_lock ( const char *  file,
int  flags,
mode_t  mode,
int  write 
)

opens specified file and waits for a shared lock if write=0 or an exclusive lock if write=1 before returning the file descriptor

◆ kvtree_read_attempt()

ssize_t kvtree_read_attempt ( const char *  file,
int  fd,
void *  buf,
size_t  size 
)

make a good attempt to read from file (retries, if necessary, return error if fail)

◆ kvtree_write_attempt()

ssize_t kvtree_write_attempt ( const char *  file,
int  fd,
const void *  buf,
size_t  size 
)

make a good attempt to write to file (retries, if necessary, return error if fail)