2 * Copyright (C) 2013 Felix Fietkau <nbd@openwrt.org>
3 * Copyright (C) 2013 John Crispin <blogic@openwrt.org>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License version 2.1
7 * as published by the Free Software Foundation
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
18 #include <libubox/uloop.h>
19 #include <libubox/utils.h>
27 #define __init __attribute__((constructor))
29 #define DEBUG(level, fmt, ...) do { \
31 fprintf(stderr, "procd: %s(%d): " fmt, __func__, __LINE__, ## __VA_ARGS__); \
34 #define LOG(fmt, ...) do { \
35 log_printf(fmt, ## __VA_ARGS__); \
36 fprintf(stderr, "procd: "fmt, ## __VA_ARGS__); \
39 #define ERROR(fmt, ...) do { \
40 log_printf(fmt, ## __VA_ARGS__); \
41 fprintf(stderr, "procd: "fmt, ## __VA_ARGS__); \
44 extern char *ubus_socket;
45 extern int upgrade_running;
47 extern unsigned int debug;
48 void debug_init(void);
50 void procd_connect_ubus(void);
51 void procd_reconnect_ubus(int reconnect);
52 void ubus_init_service(struct ubus_context *ctx);
53 void ubus_init_log(struct ubus_context *ctx);
54 void ubus_init_system(struct ubus_context *ctx);
55 void ubus_notify_log(struct log_head *l);
57 void procd_state_next(void);
58 void procd_shutdown(int event);
59 void procd_early(void);
60 void procd_preinit(void);
61 void procd_coldplug(void);
62 void procd_signal(void);
63 void procd_signal_preinit(void);
64 void procd_inittab(void);
65 void procd_inittab_run(const char *action);
67 int mkdev(const char *progname, int progmode);
70 void trigger_init(void);
71 void trigger_event(char *type, struct blob_attr *data);
72 void trigger_add(struct blob_attr *rule, void *id);
73 void trigger_del(void *id);
82 int measure_process(pid_t pid, struct pid_info *pi);