Functions | |
int | sb_file_is_fifo (const char *filepath) |
Test if path is a FIFO. | |
int | sb_file_is_file (const char *filepath) |
Test if file is OK. | |
int | sb_file_get_stamp (const char *filepath) |
Get file creation timestamp. | |
int | sb_file_get_size (const char *filepath) |
Get file size. | |
char * | sb_file_read (const char *filepath) |
Read data from given file. | |
int | sb_file_write (const char *filepath, char *data) |
Write data to given file. | |
int | sb_file_remove (const char *filepath) |
remove given file | |
int | sb_file_open (const char *filepath, int flags) |
Open given file. | |
int | sb_file_open_ext (const char *filepath, int flags, mode_t mode) |
Open given file. | |
int | sb_file_close (int fd) |
Close given file descriptor. | |
int | sb_file_set_lock (int fd, int type, int wait) |
Wrapper for setting the locks. | |
int | sb_file_lock_acquire_read (int fd) |
Acquire read lock for given file descriptor. | |
int | sb_file_lock_acquire_read_wait (int fd) |
Wait until file descriptor can be read locked, and than do it. | |
int | sb_file_lock_acquire_write (int fd) |
Acquire write lock for given file descriptor. | |
int | sb_file_lock_acquire_write_wait (int fd) |
Wait until file descriptor can be write locked, and than do it. | |
int | sb_file_lock_release (int fd) |
Release lock from given file descriptor. |
This module provides functions for handling files.
|
Close given file descriptor. Wrapper around libcs close() function. Set locks will be released automatically. So you don't need to call the release function, but it's good coding style to do it.
Definition at line 234 of file file.c. Referenced by sb_daemon_is_running(). |
|
Get file size.
Definition at line 99 of file file.c. Referenced by mntd_volume_config_parse(), and sb_file_read(). |
|
Get file creation timestamp.
|
|
Test if path is a FIFO.
|
|
Test if file is OK.
Definition at line 63 of file file.c. Referenced by main(), mntd_volume_config_parse(), sb_dir_rmdirs(), and sb_file_remove(). |
|
Acquire read lock for given file descriptor.
Definition at line 261 of file file.c. References sb_file_set_lock(). |
|
Wait until file descriptor can be read locked, and than do it.
Definition at line 269 of file file.c. References sb_file_set_lock(). |
|
Acquire write lock for given file descriptor.
Definition at line 277 of file file.c. References sb_file_set_lock(). Referenced by sb_daemon_pidfile_create_and_lock(). |
|
Wait until file descriptor can be write locked, and than do it.
Definition at line 285 of file file.c. References sb_file_set_lock(). |
|
Release lock from given file descriptor.
Definition at line 293 of file file.c. References sb_file_set_lock(). |
|
Open given file. Wrapper around libcs open() function.
Definition at line 206 of file file.c. Referenced by sb_daemon_pidfile_create_and_lock(), and sb_daemon_pidfile_read(). |
|
Open given file. Wrapper around libcs open() function.
Definition at line 220 of file file.c. Referenced by sb_daemon_pidfile_create_and_lock(). |
|
Read data from given file.
Definition at line 117 of file file.c. References sb_file_get_size(). Referenced by mntd_volume_config_parse(). |
|
remove given file
Definition at line 193 of file file.c. References sb_file_is_file(). Referenced by sb_daemon_destroy(), sb_daemon_is_running(), and sb_dir_rmdirs(). |
|
Wrapper for setting the locks. Private function, that you don't need to call.
Definition at line 242 of file file.c. Referenced by sb_file_lock_acquire_read(), sb_file_lock_acquire_read_wait(), sb_file_lock_acquire_write(), sb_file_lock_acquire_write_wait(), and sb_file_lock_release(). |
|
Write data to given file.
|