1ee04292dcedc2a737c66b247e7b0f3902537088
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.
15 #ifndef __PROCD_INSTANCE_H
16 #define __PROCD_INSTANCE_H
18 #include <libubox/vlist.h>
19 #include <libubox/uloop.h>
20 #include <libubox/ustream.h>
21 #include "../utils/utils.h"
23 #define RESPAWN_ERROR (5 * 60)
33 struct blobmsg_list mount
;
37 struct service_instance
{
38 struct vlist_node node
;
52 struct timespec start
;
61 uint32_t respawn_timeout
;
62 uint32_t respawn_threshold
;
63 uint32_t respawn_retry
;
65 struct blob_attr
*config
;
66 struct uloop_process proc
;
67 struct uloop_timeout timeout
;
68 struct ustream_fd _stdout
;
69 struct ustream_fd _stderr
;
71 struct blob_attr
*command
;
72 struct blob_attr
*trigger
;
73 struct blobmsg_list env
;
74 struct blobmsg_list data
;
75 struct blobmsg_list netdev
;
76 struct blobmsg_list file
;
77 struct blobmsg_list limits
;
78 struct blobmsg_list errors
;
81 void instance_start(struct service_instance
*in
);
82 void instance_stop(struct service_instance
*in
);
83 bool instance_update(struct service_instance
*in
, struct service_instance
*in_new
);
84 void instance_init(struct service_instance
*in
, struct service
*s
, struct blob_attr
*config
);
85 void instance_free(struct service_instance
*in
);
86 void instance_dump(struct blob_buf
*b
, struct service_instance
*in
, int debug
);