summaryrefslogtreecommitdiff
path: root/src/fdlog.h
blob: cd739d2f6160ffd29955df7f7b638b076f31d11a (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef INCLUDED_FDLOG_H
#define INCLUDED_FDLOG_H
#include "first.h"

#include "base_decls.h"
#include "buffer.h"

struct fdlog_st {
    enum { FDLOG_FILE, FDLOG_FD, FDLOG_SYSLOG, FDLOG_PIPE } mode;
    int fd;
    buffer b;
    const char *fn;
};

__attribute_cold__
__attribute_returns_nonnull__
fdlog_st * fdlog_init (const char *fn, int fd, int mode);

__attribute_cold__
void fdlog_free (fdlog_st *fdlog);

/* fdlog_maint.c */

__attribute_cold__
fdlog_st * fdlog_open (const char *fn);

__attribute_cold__
void fdlog_closeall (fdlog_st *errh);

__attribute_cold__
void fdlog_flushall (fdlog_st *errh);

__attribute_cold__
void fdlog_files_flush (fdlog_st *errh, int memrel);

__attribute_cold__
void fdlog_files_cycle (fdlog_st *errh);

__attribute_cold__
int fdlog_pipes_waitpid_cb (pid_t pid);

__attribute_cold__
void fdlog_pipes_restart (unix_time64_t ts);

__attribute_cold__
void fdlog_pipes_abandon_pids (void);

__attribute_cold__
void fdlog_pipe_serrh (int fd);

#endif