libcortex
Event loop library following a "batteries included" approach
Loading...
Searching...
No Matches
sd_journal.h
1#ifndef _CRTX_SD_JOURNAL_H
2#define _CRTX_SD_JOURNAL_H
3
4#ifdef __cplusplus
5extern "C" {
6 #endif
7
8 /*
9 * Mario Kicherer (dev@kicherer.org) 2022
10 *
11 */
12
13 #include <systemd/sd-journal.h>
14 #include "core.h"
15
16 #define CRTX_SD_JOURNAL_EVT_NEW_ENTRY "sd_journal.new_entry"
17
18 #define CRTX_SD_JOURNAL_EVT_NEW_ENTRY_ID (1<<0)
19
21 FILE *f;
22 char *buf;
23 size_t buf_size;
24
25 void (*cb)(struct crtx_sd_journal_print_event_userdata *udata);
26 void *cb_data;
27 };
28
30 struct crtx_listener_base base;
31
32 sd_journal *sd_journal;
33 int flags;
34 int seek; // positive: skip first x entries, negative: read last x entries
35 char try_read; // obsolete
36 char same_boot_filter;
37
38 int (*event_cb)(struct crtx_sd_journal_listener *jlstnr, void *userdata);
39 void *event_cb_data;
40 };
41
42 struct crtx_listener_base *crtx_setup_sd_journal_listener(void *options);
43 void crtx_sd_journal_clear_listener(struct crtx_sd_journal_listener *lstnr);
44 CRTX_DECLARE_CALLOC_FUNCTION(sd_journal)
45
46 void crtx_sd_journal_init();
47 void crtx_sd_journal_finish();
48
49 int crtx_sd_journal_print_event(struct crtx_sd_journal_listener *jlstnr, void *userdata);
50 int crtx_sd_journal_gen_event_dict(struct crtx_sd_journal_listener *jlstnr, void *userdata);
51
52 #ifdef __cplusplus
53}
54#endif
55
56#endif
The core definitions of libcortex.
base structure of a listener
Definition core.h:186
void * userdata
storage for user-provided data
Definition core.h:225
Definition sd_journal.h:29
Definition sd_journal.h:20