Remove wheel submodule - will re-add later with new URL
[dmon:dmon.git] / task.h
1 /*
2  * task.h
3  * Copyright (C) 2010 Adrian Perez <aperez@igalia.com>
4  *
5  * Distributed under terms of the MIT license.
6  */
7
8 #ifndef __task_h__
9 #define __task_h__
10
11 #include "util.h"
12 #include <sys/types.h>
13
14 typedef enum {
15     A_NONE = 0,
16     A_START,
17     A_STOP,
18     A_SIGNAL,
19 } action_t;
20
21
22 typedef struct {
23     pid_t    pid;
24     action_t action;
25     int      argc;
26     char   **argv;
27     int      write_fd;
28     int      read_fd;
29     int      signal;
30     time_t   started;
31     uidgid_t user;
32     unsigned redir_errfd;
33 } task_t;
34
35 #define NO_PID    (-1)
36 #define NO_SIGNAL (-1)
37 #define TASK      { NO_PID,    \
38                     A_START,   \
39                     0,         \
40                     NULL,      \
41                     -1,        \
42                     -1,        \
43                     NO_SIGNAL, \
44                     0,         \
45                     UIDGID,    \
46                     0 }
47
48
49 void task_start           (task_t *task);
50 void task_signal_dispatch (task_t *task);
51 void task_action_dispatch (task_t *task);
52 void task_signal          (task_t *task, int signum);
53 void task_action          (task_t *task, action_t action);
54
55 #endif /* !__task_h__ */
56
57 /* vim: expandtab tabstop=4 shiftwidth=4
58  */