scclib
Stable Cloud Computing C++ Library
|
Provides signal safe wrapper for commonly used C library APIs. More...
Files | |
file | safe_clib.h |
Signal-safe C library wrapper. | |
file | safe_clib.cc |
Signal-safe C library wrapper implementation | |
file | safe_clib.cc |
Tests for Signal-safe C library wrapper. | |
Functions | |
int | scc::util::safe_close (int fd) |
Signal safe close. | |
int | scc::util::safe_close_throw (int fd) |
Signal safe close, throws system_error on error. | |
ssize_t | scc::util::safe_read (int fd, void *buf, size_t count) |
Signal safe read. | |
ssize_t | scc::util::safe_read_throw (int fd, void *buf, size_t count) |
Signal safe read, throws system_error on error. | |
ssize_t | scc::util::safe_write (int fd, const void *buf, size_t count) |
Signal safe write. | |
ssize_t | scc::util::safe_write_throw (int fd, const void *buf, size_t count) |
Signal safe write, throws system_error on error. | |
int | scc::util::safe_dup (int oldfd) |
Signal safe dup. | |
int | scc::util::safe_dup_throw (int oldfd) |
Signal safe dup, throws system_error on error. | |
int | scc::util::safe_dup2 (int oldfd, int newfd) |
Signal safe dup2. | |
int | scc::util::safe_dup2_throw (int oldfd, int newfd) |
Signal safe dup2, throws system_error on error. | |
int | scc::util::safe_open (const char *pathname, int flags) |
Signal safe open. | |
int | scc::util::safe_open (const char *pathname, int flags, mode_t mode) |
Signal safe open. | |
int | scc::util::safe_open_throw (const char *pathname, int flags) |
Signal safe open, throws system_error on error. | |
int | scc::util::safe_open_throw (const char *pathname, int flags, mode_t mode) |
Signal safe open, throws system_error on error. | |
FILE * | scc::util::safe_fopen (const char *pathname, const char *mode) |
Signal safe fopen. | |
FILE * | scc::util::safe_fopen_throw (const char *pathname, const char *mode) |
Signal safe fopen, throws system_error on error. | |
int | scc::util::safe_fclose (FILE *stream) |
Signal safe fclose. | |
int | scc::util::safe_fclose_throw (FILE *stream) |
Signal safe fclose, throws system_error on error. | |
int | scc::util::safe_fscanf (FILE *stream, const char *format,...) |
Signal safe fscanf. | |
int | scc::util::safe_fscanf_throw (FILE *stream, const char *format,...) |
Signal safe fscanf, throw on error. | |
ssize_t | scc::util::safe_getline (char **lineptr, size_t *n, FILE *stream) |
Signal safe getline. | |
ssize_t | scc::util::safe_getline_throw (char **lineptr, size_t *n, FILE *stream) |
Signal safe getline, throw on error. | |
int | scc::util::safe_truncate (const char *path, off_t length) |
Signal safe truncate. | |
int | scc::util::safe_truncate_throw (const char *path, off_t length) |
Signal safe truncate, throw on error. | |
int | scc::util::safe_ftruncate (int fd, off_t length) |
Signal safe ftruncate. | |
int | scc::util::safe_ftruncate_throw (int fd, off_t length) |
Signal safe ftruncate, throw on error. | |
int | scc::util::safe_wait (int *wstatus) |
Signal safe wait. | |
int | scc::util::safe_waitpid (pid_t pid, int *wstatus, int options) |
Signal safe waitpid. | |
int | scc::util::safe_wait_throw (int *wstatus) |
Signal safe wait, throws system_error on error. | |
int | scc::util::safe_waitpid_throw (pid_t pid, int *wstatus, int options) |
Signal safe waitpid, throws system_error on error. | |
Provides signal safe wrapper for commonly used C library APIs.
Generally, APIs which are capable of EINTR error when interrupted a signal are included.
See https://man7.org/linux/man-pages/man7/signal.7.html
An example which uses safe clib apis to write into a sparse file, from scclib/util/unittest/fs.cc