Go to the source code of this file.
Defines | |
#define | COPY_IOBUFF_SIZE 4096 |
Size, in bytes, of the buffer used by copy_file_with_lock() for I/O operations. | |
#define | LOG_BUFFER_OVERFLOW -1 |
Return value for the function my_logger(). This means that the argument 'buffer' is too small. | |
#define | LOG_WRITE_ERROR -2 |
Return value for the function my_logger(). The function can not write to the file (which name is specified as first argument). | |
#define | LOG_OPEN_ERROR -3 |
Return value for the function my_logger(). The function can not open the file (which name is specified as first argument). | |
#define | LOG_CLOSE_ERROR -4 |
Return value for the function my_logger(). The function can not close the file (which name is specified as first argument). | |
#define | LOG_LOCK_ERROR -5 |
Return value for the function my_logger(). The function can not lock the file (which name is specified as first argument). | |
#define | LOG_OK -6 |
Return value for the function my_logger(). The function succed. Everything is fine. | |
#define | COPY_SRC_OPEN_ERROR -1 |
Return value for the function copy_file_with_lock(). Can not open the source file. | |
#define | COPY_DST_OPEN_ERROR -2 |
Return value for the function copy_file_with_lock(). Can not open the destination file. | |
#define | COPY_LOCK_ERROR -3 |
Return value for the function copy_file_with_lock(). Lock on the destination file failed. | |
#define | COPY_STAT_ERROR -4 |
Return value for the function copy_file_with_lock(). Can not stat() the srouce file. | |
#define | COPY_READ_ERROR -5 |
Return value for the function copy_file_with_lock(). Error while reading the source file. | |
#define | COPY_WRITE_ERROR -6 |
Return value for the function copy_file_with_lock(). Error while writing to the destination file. | |
#define | COPY_UNLOCK_ERROR -7 |
Return value for the function copy_file_with_lock(). Error while unlocking the destinatination file. | |
#define | COPY_SRC_CLOSE_ERROR -8 |
Return value for the function copy_file_with_lock(). Error while closing the source file. | |
#define | COPY_DST_CLOSE_ERROR -9 |
Return value for the function copy_file_with_lock(). Error while closing the destination file. | |
#define | COPY_OK 0 |
Return value for the function copy_file_with_lock(). File successfully copied. | |
#define | FLOCK_HD |
Functions | |
int | lock_file (int fd) |
Lock a file. | |
int | unlock_file (int fd) |
Unlock a file. | |
int | my_logger (char *file_name, char *buffer, int buffsize, char *format,...) |
Write data into the log file. | |
int | append_file_with_lock (char *src, char *dst) |
Append a file to another - The destination file is locked. |
Definition in file flock.h.
|
Append a file to another - The destination file is locked.
Definition at line 253 of file flock.c. References COPY_DST_CLOSE_ERROR, COPY_DST_OPEN_ERROR, COPY_IOBUFF_SIZE, COPY_LOCK_ERROR, COPY_OK, COPY_READ_ERROR, COPY_SRC_CLOSE_ERROR, COPY_SRC_OPEN_ERROR, COPY_STAT_ERROR, COPY_UNLOCK_ERROR, COPY_WRITE_ERROR, lock_file(), and unlock_file(). |
|
Lock a file.
Definition at line 15 of file flock.c. Referenced by append_file_with_lock(), and my_logger(). |
|
Write data into the log file.
Definition at line 105 of file flock.c. References INT_MAX_CHAR, lock_file(), LOG_BUFFER_OVERFLOW, LOG_CLOSE_ERROR, LOG_LOCK_ERROR, LOG_OK, LOG_OPEN_ERROR, LOG_WRITE_ERROR, and unlock_file(). |
|
Unlock a file.
Definition at line 53 of file flock.c. Referenced by append_file_with_lock(), and my_logger(). |