diff options
Diffstat (limited to 'src/unit.h')
| -rw-r--r-- | src/unit.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/unit.h b/src/unit.h new file mode 100644 index 0000000..d709b77 --- /dev/null +++ b/src/unit.h @@ -0,0 +1,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 */ |
