• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/procd/service/instance.h

  1 /*
  2  * Copyright (C) 2013 Felix Fietkau <nbd@openwrt.org>
  3  * Copyright (C) 2013 John Crispin <blogic@openwrt.org>
  4  *
  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
  8  *
  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.
 13  */
 14 
 15 #ifndef __PROCD_INSTANCE_H
 16 #define __PROCD_INSTANCE_H
 17 
 18 #include <libubox/vlist.h>
 19 #include <libubox/uloop.h>
 20 #include <libubox/ustream.h>
 21 #include "../utils/utils.h"
 22 
 23 #define RESPAWN_ERROR   (5 * 60)
 24 #define SIGNALLED_OFFSET 128
 25 
 26 struct jail {
 27         bool procfs;
 28         bool sysfs;
 29         bool ubus;
 30         bool log;
 31         bool ronly;
 32         bool netns;
 33         bool userns;
 34         bool cgroupsns;
 35         bool console;
 36         char *name;
 37         char *hostname;
 38         struct blobmsg_list mount;
 39         int argc;
 40 };
 41 
 42 struct service_instance {
 43         struct vlist_node node;
 44         struct service *srv;
 45         const char *name;
 46 
 47         int8_t nice;
 48         bool valid;
 49 
 50         char *user;
 51         uid_t uid;
 52         gid_t pw_gid;
 53         char *group;
 54         gid_t gr_gid;
 55 
 56         bool halt;
 57         bool restart;
 58         bool respawn;
 59         int respawn_count;
 60         int reload_signal;
 61         struct timespec start;
 62 
 63         bool trace;
 64         bool has_jail;
 65         bool require_jail;
 66         bool no_new_privs;
 67         struct jail jail;
 68         char *seccomp;
 69         char *pidfile;
 70         char *extroot;
 71         char *overlaydir;
 72         char *tmpoverlaysize;
 73         int syslog_facility;
 74         int exit_code;
 75 
 76         uint32_t term_timeout;
 77         uint32_t respawn_timeout;
 78         uint32_t respawn_threshold;
 79         uint32_t respawn_retry;
 80 
 81         struct blob_attr *config;
 82         struct uloop_process proc;
 83         struct uloop_timeout timeout;
 84         struct ustream_fd _stdout;
 85         struct ustream_fd _stderr;
 86         struct ustream_fd console;
 87         struct ustream_fd console_client;
 88 
 89         struct blob_attr *command;
 90         struct blob_attr *trigger;
 91         struct blobmsg_list env;
 92         struct blobmsg_list data;
 93         struct blobmsg_list netdev;
 94         struct blobmsg_list file;
 95         struct blobmsg_list limits;
 96         struct blobmsg_list errors;
 97 };
 98 
 99 void instance_start(struct service_instance *in);
100 void instance_stop(struct service_instance *in, bool halt);
101 void instance_update(struct service_instance *in, struct service_instance *in_new);
102 void instance_init(struct service_instance *in, struct service *s, struct blob_attr *config);
103 void instance_free(struct service_instance *in);
104 void instance_dump(struct blob_buf *b, struct service_instance *in, int debug);
105 
106 #endif
107 

This page was automatically generated by LXR 0.3.1.  •  OpenWrt