summaryrefslogtreecommitdiff
path: root/src/log_tail.h
blob: 3131ff60ffc368fb7c96e46cb485e67d074deddf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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 */