blob: d709b773aa56215bdaf5e863f8d5deb0ca7e277b (
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
|
#ifndef UMBRELLA_UNIT_H
#define UMBRELLA_UNIT_H
#include "umbrella.h"
/*
* unit_load_all: scan UMBRELLA_UNITS_DIR and load all *.yaml files.
* Populates g.units and g.unit_count.
* Returns number of units loaded, -1 on fatal error.
*/
int unit_load_all(void);
/*
* unit_load_file: load a single unit yaml file.
* Returns 0 on success, -1 on error.
*/
int unit_load_file(const char *path, Unit *out);
/*
* unit_find: look up a unit by name.
* Returns pointer into g.units, or NULL if not found.
*/
Unit *unit_find(const char *name);
/*
* unit_state_str: human-readable state name.
*/
const char *unit_state_str(ProcessState state);
/*
* ring_init: allocate and zero a ring buffer.
*/
RingBuffer *ring_init(void);
/*
* ring_push: append a line to the ring buffer.
*/
void ring_push(RingBuffer *rb, const char *line, int len);
/*
* ring_free: free a ring buffer.
*/
void ring_free(RingBuffer *rb);
#endif /* UMBRELLA_UNIT_H */
|