diff options
Diffstat (limited to 'src/log_tail.h')
| -rw-r--r-- | src/log_tail.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/log_tail.h b/src/log_tail.h new file mode 100644 index 0000000..3131ff6 --- /dev/null +++ b/src/log_tail.h @@ -0,0 +1,31 @@ +#ifndef UMBRELLA_LOG_TAIL_H +#define UMBRELLA_LOG_TAIL_H + +#include "umbrella.h" + +/* + * log_tail_init: open log files for all units that have them defined, + * seek to end, and register fds with epoll. + * Call once after units are loaded. + */ +void log_tail_init(void); + +/* + * log_tail_handle: called when a log fd becomes readable. + * Reads new lines, pushes to the unit's ring buffer, and broadcasts + * to all attached clients. + */ +void log_tail_handle(int fd); + +/* + * log_tail_cleanup: close all open log fds. + */ +void log_tail_cleanup(void); + +/* + * log_tail_fd_to_unit: find which unit owns a given log fd. + * Returns NULL if not found. + */ +Unit *log_tail_fd_to_unit(int fd); + +#endif /* UMBRELLA_LOG_TAIL_H */ |
