#include <stdio.h>
typedef struct Manager Manager;
-typedef enum ManagerEventType ManagerEventType;
+typedef enum WatchType WatchType;
+typedef struct Watch Watch;
+
+enum WatchType {
+ WATCH_INVALID,
+ WATCH_SIGNAL_FD,
+ WATCH_FD,
+ WATCH_TIMER
+};
+
+struct Watch {
+ int fd;
+ WatchType type;
+ union Unit *unit;
+};
#include "unit.h"
#include "job.h"
#include "list.h"
#include "set.h"
-enum ManagerEventType {
- MANAGER_SIGNAL,
- MANAGER_FD,
- MANAGER_TIMER
-};
-
struct Manager {
uint32_t current_job_id;
Hashmap *watch_pids; /* pid => Unit object n:1 */
int epoll_fd;
- int signal_fd;
+
+ Watch signal_watch;
};
Manager* manager_new(void);
Job *manager_get_job(Manager *m, uint32_t id);
Unit *manager_get_unit(Manager *m, const char *name);
-int manager_load_unit(Manager *m, const char *name, Unit **_ret);
+int manager_load_unit(Manager *m, const char *path_or_name, Unit **_ret);
int manager_add_job(Manager *m, JobType type, Unit *unit, JobMode mode, bool force, Job **_ret);
void manager_dump_units(Manager *s, FILE *f, const char *prefix);