]> git.itanic.dy.fi Git - rrdd/blob - process.h
onewire_parser.c: Fix compiler warnings about string lengths
[rrdd] / process.h
1 #ifndef _PROCESS_H
2 #define _PROCESS_H
3
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <unistd.h>
7 #include <string.h>
8 #include <sys/wait.h>
9 #include <error.h>
10 #include <errno.h>
11 #include <stdint.h>
12 #include <sys/epoll.h>
13
14 struct event_handler;
15
16 typedef int (handle_event_fn_t)(struct event_handler *);
17 typedef int (work_fn_t)(void *);
18
19 struct event_handler {
20         int fd;
21         uint32_t events;
22         handle_event_fn_t *handle_event;
23         char *name;
24 };
25
26 int register_event_handler(struct event_handler *handler, int op);
27
28 int init_jobcontrol(int max_jobs_requested);
29 int poll_job_requests(int timeout);
30 int notify_job_request(void);
31 int do_fork(void);
32 int run(const char *p, char *const argv[]);
33 int clear_zombie(int pid);
34 int run_piped(const char *cmd, char *const argv[],
35               int *stdinfd, int *stdoutfd, int *stderrfd);
36 int run_piped_stream(const char *cmd, char *const argv[],
37                      FILE **stdinf, FILE **stdoutf, FILE **stderrf);
38
39 enum {
40         WORK_PRIORITY_HIGH,
41         WORK_PRIORITY_LOW,
42         WORK_PRIORITIES_NUM,
43 };
44
45 int queue_work(unsigned int priority, char *name,
46         int (work_fn)(void *arg), void *arg);
47
48 #endif