/* startup daemon side of ctdb according to command line options */ struct ctdb_context *ctdb_cmdline_init(struct event_context *ev) { struct ctdb_context *ctdb; int ret; /* initialise ctdb */ ctdb = ctdb_init(ev); if (ctdb == NULL) { printf("Failed to init ctdb\n"); exit(1); } if (ctdb_cmdline.torture) { ctdb_set_flags(ctdb, CTDB_FLAG_TORTURE); } /* command line specified a socket name */ if (ctdb_cmdline.socketname != NULL) { setenv("CTDB_SOCKET", ctdb_cmdline.socketname, 1); ret = ctdb_set_socketname(ctdb, ctdb_cmdline.socketname); if (ret == -1) { printf("ctdb_set_socketname failed - %s\n", ctdb_errstr(ctdb)); exit(1); } } /* Set the debug level */ if (isalpha(ctdb_cmdline.debuglevel[0]) || ctdb_cmdline.debuglevel[0] == '-') { LogLevel = get_debug_by_desc(ctdb_cmdline.debuglevel); } else { LogLevel = strtol(ctdb_cmdline.debuglevel, NULL, 0); } /* set up the tree to store server ids */ ctdb->server_ids = trbt_create(ctdb, 0); return ctdb; }
/* startup daemon side of ctdb according to command line options */ struct ctdb_context *ctdb_cmdline_init(struct event_context *ev) { struct ctdb_context *ctdb; int ret; /* initialise ctdb */ ctdb = ctdb_init(ev); if (ctdb == NULL) { printf("Failed to init ctdb\n"); exit(1); } if (ctdb_cmdline.torture) { ctdb_set_flags(ctdb, CTDB_FLAG_TORTURE); } /* command line specified a socket name */ if (ctdb_cmdline.socketname != NULL) { setenv("CTDB_SOCKET", ctdb_cmdline.socketname, 1); ret = ctdb_set_socketname(ctdb, ctdb_cmdline.socketname); if (ret == -1) { printf("ctdb_set_socketname failed - %s\n", ctdb_errstr(ctdb)); exit(1); } } /* Set the debug level */ if (!parse_debug(ctdb_cmdline.debuglevel, &DEBUGLEVEL)) { DEBUGLEVEL = DEBUG_ERR; } /* set up the tree to store server ids */ ctdb->server_ids = trbt_create(ctdb, 0); return ctdb; }