23 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_M0D 32 #include <sys/resource.h> 35 #include <systemd/sd-daemon.h> 89 struct sigaction term_act;
95 sigemptyset(&term_act.sa_mask);
96 term_act.sa_flags = 0;
98 rc = sigaction(SIGTERM, &term_act,
NULL) ?:
99 sigaction(SIGINT, &term_act,
NULL) ?:
100 sigaction(SIGQUIT, &term_act,
NULL) ?:
101 sigaction(SIGUSR1, &term_act,
NULL);
119 M0_INTERNAL
int main(
int argc,
char **argv)
126 struct rlimit rlim = {10240, 10240};
129 (strcmp(argv[1],
"-v") == 0 || strcmp(argv[1],
"--version") == 0)) {
134 if (argc > 2 && strcmp(argv[1],
"--trace-buf-size-mb") == 0) {
146 " be greater than zero " 152 rc = setrlimit(RLIMIT_NOFILE, &rlim);
154 warnx(
"\n Failed to setrlimit\n");
160 warnx(
"\n Failed to register signals\n");
171 warnx(
"\n Failed to initialise Motr \n");
180 warnx(
"\n Failed to initialise Motr \n");
210 rc = sd_notify(0,
"READY=1");
212 warnx(
"systemd READY notification failed, rc=%d\n",
rc);
214 warnx(
"systemd notifications not allowed\n");
216 warnx(
"systemd READY notification successful\n");
237 warnx(
"\n Failed to set process memory limits Motr \n");
243 warnx(
"\n Failed to reconfigure Motr \n");
271 errno =
rc < 0 ? -
rc :
rc;
void m0_error_printf(const char *fmt,...)
void m0_console_printf(const char *fmt,...)
#define M0_FID_INIT(container, key)
int m0_cs_setup_env(struct m0_motr *cctx, int argc, char **argv)
int m0_resume(struct m0 *instance)
void m0_cs_fini(struct m0_motr *cctx)
volatile sig_atomic_t gotsignal
int m0_init(struct m0 *instance)
void m0_build_info_print(void)
static int cs_register_signal(void)
int m0_cs_memory_limits_setup(struct m0 *instance)
int m0_cs_init(struct m0_motr *cctx, struct m0_net_xprt **xprts, size_t xprts_nr, FILE *out, bool mkfs)
void m0_console_flush(void)
struct m0_reqh_context cc_reqh_ctx
M0_INTERNAL int main(int argc, char **argv)
struct m0_net_xprt ** m0_net_all_xprt_get(void)
static unsigned long trace_buf_size
int m0_trace_set_buffer_size(size_t size)
static struct m0 instance
int m0_cs_start(struct m0_motr *cctx)
static int cs_wait_signal(void)
static void cs_term_sig_handler(int signum)