API for managing concurrent file access. More...
Go to the source code of this file.
Typedefs | |
typedef struct exfile_t | exfile_t |
Functions | |
int | exfile_close (exfile_t *lf, int fd) |
Close the log file. More... | |
exfile_t * | exfile_init (TALLOC_CTX *ctx, uint32_t entries, uint32_t idle, bool locking) |
Initialize a way for multiple threads to log to one or more files. More... | |
int | exfile_open (exfile_t *lf, char const *filename, mode_t permissions, bool append) |
Open a new log file, or maybe an existing one. More... | |
int | exfile_unlock (exfile_t *lf, int fd) |
API for managing concurrent file access.
Definition in file exfile.h.
int exfile_close | ( | exfile_t * | ef, |
int | fd | ||
) |
Close the log file.
Really just return it to the pool.
When multithreaded, the FD is locked via a mutex. This way we're sure that no other thread is writing to the file. This function will unlock the mutex, so that other threads can write to the file.
ef | The logfile context returned from exfile_init. |
fd | the FD to close (i.e. return to the pool). |
Definition at line 356 of file exfile.c.
exfile_t* exfile_init | ( | TALLOC_CTX * | ctx, |
uint32_t | max_entries, | ||
uint32_t | max_idle, | ||
bool | locking | ||
) |
Initialize a way for multiple threads to log to one or more files.
ctx | The talloc context |
max_entries | Max file descriptors to cache, and manage locks for. |
max_idle | Maximum time a file descriptor can be idle before it's closed. |
locking | whether or not to lock the files. |
Definition at line 100 of file exfile.c.
int exfile_open | ( | exfile_t * | ef, |
char const * | filename, | ||
mode_t | permissions, | ||
bool | append | ||
) |
Open a new log file, or maybe an existing one.
When multithreaded, the FD is locked via a mutex. This way we're sure that no other thread is writing to the file.
ef | The logfile context returned from exfile_init(). |
filename | the file to open. |
permissions | to use. |
append | If true seek to the end of the file. |
Definition at line 142 of file exfile.c.