From 0d706ae72ceefd74053ad6cb0900ecce6cf1f085 Mon Sep 17 00:00:00 2001 From: auric Date: Sat, 21 Feb 2026 11:08:36 -0600 Subject: Add Umbrella 0.1.5 --- src/unit.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/unit.h (limited to 'src/unit.h') 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 */ -- cgit v1.2.3