mcs_st *mcs_create(mcs_st *ptr, const char *config, const char *default_usr, const char *default_pwd, const char *opts) { #ifdef MOXI_USE_LIBVBUCKET if (config[0] == '{') { if (settings.verbose > 2) { moxi_log_write("mcs_create using libvbucket\n"); } return lvb_create(ptr, config, default_usr, default_pwd, opts); } #endif #ifdef MOXI_USE_LIBMEMCACHED if (config[0] != '{') { if (settings.verbose > 2) { moxi_log_write("mcs_create using libmemcached\n"); } return lmc_create(ptr, config, default_usr, default_pwd, opts); } #endif moxi_log_write("ERROR: unconfigured hash library\n"); exit(1); return NULL; }
int main(int argc, char **argv) { lmc_parser_t *lmc; int r; int nofork = 0; int x; signal(SIGPIPE, SIG_IGN); _cfg_file = "/etc/mn-slaved.conf"; if (argc > 1) { for (x=1; x<argc; x++) { if (strcmp(argv[x], "--no-fork") == 0) nofork=1; else _cfg_file = argv[x]; } } if (!(lmc = lmc_create(&srv))) { fprintf(stderr, "out of mem\n"); return 1; } lmc_add_scope(lmc, &slave_scope); if ((r = nol_daemon_launch( _cfg_file, lmc, &opt_vals.user, &opt_vals.group, &slave_init_cb, &slave_run_cb, nofork==1?0:1)) == 0) fprintf(stdout, "started\n"); /* if nol_daemon_launch() does not return 0, * it should have printed an error message to stderr already */ lmc_destroy(lmc); nol_s_cleanup(); return r; }