Changeset 71803743714376fc12fb54b3506df6a4c17a8828
- Timestamp:
- 08/04/08 02:12:25 (5 years ago)
- git-parent:
- Files:
-
- src/noit_check.c (modified) (6 diffs)
- src/noit_check.h (modified) (6 diffs)
- src/noit_check_log.c (modified) (5 diffs)
- src/noit_conf_checks.c (modified) (3 diffs)
- src/noit_console.c (modified) (6 diffs)
- src/noit_console.h (modified) (1 diff)
- src/noit_console_state.c (modified) (1 diff)
- src/utils/noit_skiplist.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
src/noit_check.c
r5e653fe r7180374 27 27 28 28 static noit_hash_table polls = NOIT_HASH_EMPTY; 29 static noit_skiplist watchlist = { 0 }; 29 30 static noit_skiplist polls_by_name = { 0 }; 30 31 static u_int32_t __config_load_generation = 0; … … 62 63 if((rv = strcmp(ac->name, bc->name)) != 0) return rv; 63 64 return 0; 65 } 66 static int __watchlist_compare(const void *a, const void *b) { 67 const noit_check_t *ac = a; 68 const noit_check_t *bc = b; 69 int rv; 70 if((rv = memcmp(ac->checkid, bc->checkid, sizeof(ac->checkid))) != 0) return rv; 71 if(ac->period < bc->period) return -1; 72 if(ac->period == bc->period) return 0; 73 return 1; 64 74 } 65 75 int … … 198 208 } 199 209 210 int 211 noit_check_activate(noit_check_t *check) { 212 noit_module_t *mod; 213 mod = noit_module_lookup(check->module); 214 if(mod && mod->initiate_check && !NOIT_CHECK_LIVE(check)) { 215 if((check->flags & NP_DISABLED) == 0) { 216 mod->initiate_check(mod, check, 0, NULL); 217 return 1; 218 } 219 else 220 noitL(noit_debug, "Skipping %s`%s, disabled.\n", 221 check->target, check->name); 222 } 223 else { 224 noitL(noit_stderr, "Cannot find module '%s'\n", check->module); 225 check->flags |= NP_DISABLED; 226 } 227 return 0; 228 } 229 200 230 void 201 231 noit_poller_initiate() { … … 206 236 while(noit_hash_next(&polls, &iter, (const char **)key_id, &klen, 207 237 (void **)&check)) { 208 noit_module_t *mod; 209 mod = noit_module_lookup(check->module); 210 if(mod && mod->initiate_check) { 211 if(NOIT_CHECK_LIVE(check)) 212 continue; 213 if((check->flags & NP_DISABLED) == 0) { 214 mod->initiate_check(mod, check, 0, NULL); 215 } 216 else 217 noitL(noit_debug, "Skipping %s`%s, disabled.\n", 218 check->target, check->name); 219 } 220 else { 221 noitL(noit_stderr, "Cannot find module '%s'\n", check->module); 222 check->flags |= NP_DISABLED; 223 } 238 noit_check_activate(check); 224 239 } 225 240 } … … 321 336 noit_skiplist_set_compare(&polls_by_name, __check_name_compare, 322 337 __check_name_compare); 338 noit_skiplist_init(&watchlist); 339 noit_skiplist_set_compare(&watchlist, __watchlist_compare, 340 __watchlist_compare); 323 341 register_console_check_commands(); 324 342 noit_poller_reload(NULL); 343 } 344 345 noit_check_t * 346 noit_check_clone(uuid_t in) { 347 noit_check_t *checker, *new_check; 348 if(noit_hash_retrieve(&polls, 349 (char *)in, UUID_SIZE, 350 (void **)&checker) == 0) { 351 return NULL; 352 } 353 if(checker->oncheck) { 354 return NULL; 355 } 356 new_check = calloc(1, sizeof(*new_check)); 357 memcpy(new_check, checker, sizeof(*new_check)); 358 new_check->target = strdup(new_check->target); 359 new_check->module = strdup(new_check->module); 360 new_check->name = strdup(new_check->name); 361 new_check->filterset = strdup(new_check->filterset); 362 new_check->flags = 0; 363 new_check->fire_event = NULL; 364 memset(&new_check->last_fire_time, 0, sizeof(new_check->last_fire_time)); 365 memset(&new_check->stats, 0, sizeof(new_check->stats)); 366 new_check->closure = NULL; 367 new_check->config = calloc(1, sizeof(*new_check->config)); 368 noit_hash_merge_as_dict(new_check->config, checker->config); 369 return new_check; 370 } 371 372 noit_check_t * 373 noit_check_watch(uuid_t in, int period) { 374 /* First look for a copy that is being watched */ 375 noit_check_t n, *f; 376 377 uuid_copy(n.checkid, in); 378 n.period = period; 379 380 f = noit_skiplist_find(&watchlist, &n, NULL); 381 if(f) return f; 382 f = noit_check_clone(in); 383 if(!f) return NULL; 384 f->period = period; 385 f->timeout = period - 1; 386 f->flags |= NP_TRANSIENT; 387 noit_skiplist_insert(&watchlist, f); 388 return f; 389 } 390 391 noit_check_t * 392 noit_check_get_watch(uuid_t in, int period) { 393 noit_check_t n, *f; 394 395 uuid_copy(n.checkid, in); 396 n.period = period; 397 398 f = noit_skiplist_find(&watchlist, &n, NULL); 399 return f; 400 } 401 402 void 403 noit_check_transient_add_feed(noit_check_t *check, const char *feed) { 404 char *feedcopy; 405 if(!check->feeds) { 406 check->feeds = calloc(1, sizeof(*check->feeds)); 407 noit_skiplist_init(check->feeds); 408 noit_skiplist_set_compare(check->feeds, 409 (noit_skiplist_comparator_t)strcmp, 410 (noit_skiplist_comparator_t)strcmp); 411 } 412 feedcopy = strdup(feed); 413 /* No error on failure -- it's already there */ 414 if(noit_skiplist_insert(check->feeds, feedcopy) == NULL) free(feedcopy); 415 } 416 void 417 noit_check_transient_remove_feed(noit_check_t *check, const char *feed) { 418 if(!check->feeds) return; 419 if(feed) noit_skiplist_remove(check->feeds, feed, free); 420 if(check->feeds->size == 0) { 421 noit_skiplist_remove(&watchlist, check, NULL); 422 noit_skiplist_destroy(check->feeds, free); 423 free(check->feeds); 424 check->feeds = NULL; 425 if(check->flags & NP_TRANSIENT) { 426 noitL(noit_debug, "check %s`%s @ %dms has no more listeners.\n", 427 check->target, check->name, check->period); 428 check->flags |= NP_KILLED; 429 } 430 } 325 431 } 326 432 … … 385 491 new_check->flags = (new_check->flags & ~mask) | flags; 386 492 387 /* This remove could fail -- no big deal */ 388 noit_skiplist_remove(&polls_by_name, new_check, NULL); 389 390 /* This insert could fail.. which means we have a conflict on 391 * target`name. That should result in the check being disabled. */ 392 if(!noit_skiplist_insert(&polls_by_name, new_check)) { 393 noitL(noit_stderr, "Check %s`%s disabled due to naming conflict\n", 394 new_check->target, new_check->name); 395 new_check->flags |= NP_DISABLED; 493 if(!(new_check->flags & NP_TRANSIENT)) { 494 /* This remove could fail -- no big deal */ 495 noit_skiplist_remove(&polls_by_name, new_check, NULL); 496 497 /* This insert could fail.. which means we have a conflict on 498 * target`name. That should result in the check being disabled. */ 499 if(!noit_skiplist_insert(&polls_by_name, new_check)) { 500 noitL(noit_stderr, "Check %s`%s disabled due to naming conflict\n", 501 new_check->target, new_check->name); 502 new_check->flags |= NP_DISABLED; 503 } 396 504 } 397 505 noit_check_log_check(new_check); src/noit_check.h
r5e653fe r7180374 14 14 #include "eventer/eventer.h" 15 15 #include "utils/noit_hash.h" 16 #include "utils/noit_skiplist.h" 16 17 #include "noit_conf.h" 17 18 #include "noit_console.h" … … 34 35 */ 35 36 36 #define NP_RUNNING 0x00000001 37 #define NP_KILLED 0x00000002 38 #define NP_DISABLED 0x00000004 39 #define NP_UNCONFIG 0x00000008 37 #define NP_RUNNING 0x00000001 38 #define NP_KILLED 0x00000002 39 #define NP_DISABLED 0x00000004 40 #define NP_UNCONFIG 0x00000008 41 #define NP_TRANSIENT 0x00000010 40 42 41 43 #define NP_UNKNOWN '0' /* stats_t.{available,state} */ … … 98 100 u_int32_t period; /* period of checks in milliseconds */ 99 101 u_int32_t timeout; /* timeout of check in milliseconds */ 100 u_int32_t flags; /* NP_KILLED, NP_RUNNING */102 u_int32_t flags; /* NP_KILLED, NP_RUNNING, NP_TRANSIENT */ 101 103 102 104 dep_list_t *causal_checks; … … 109 111 u_int32_t generation; /* This can roll, we don't care */ 110 112 void *closure; 113 114 noit_skiplist *feeds; 111 115 } noit_check_t; 112 116 … … 152 156 153 157 API_EXPORT(int) 158 noit_check_activate(noit_check_t *check); 159 160 API_EXPORT(int) 154 161 noit_poller_deschedule(uuid_t in); 155 162 … … 178 185 noit_stats_snprint_metric(char *b, int l, metric_t *m); 179 186 187 API_EXPORT(noit_check_t *) 188 noit_check_clone(uuid_t in); 189 API_EXPORT(noit_check_t *) 190 noit_check_watch(uuid_t in, int period); 191 API_EXPORT(noit_check_t *) 192 noit_check_get_watch(uuid_t in, int period); 193 API_EXPORT(void) 194 noit_check_transient_add_feed(noit_check_t *check, const char *feed); 195 API_EXPORT(void) 196 noit_check_transient_remove_feed(noit_check_t *check, const char *feed); 197 180 198 /* These are from noit_check_log.c */ 181 199 API_EXPORT(void) noit_check_log_check(noit_check_t *check); src/noit_check_log.c
r70451c5 r7180374 33 33 #define SECPART(a) ((unsigned long)(a)->tv_sec) 34 34 #define MSECPART(a) ((unsigned long)((a)->tv_usec / 1000)) 35 36 static void 37 handle_extra_feeds(noit_check_t *check, 38 void (*log_f)(noit_log_stream_t ls, noit_check_t *check)) { 39 noit_log_stream_t ls; 40 noit_skiplist_node *curr, *next; 41 const char *feed_name; 42 43 if(!check->feeds) return; 44 curr = next = noit_skiplist_getlist(check->feeds); 45 while(curr) { 46 /* We advance next here (before we try to use curr). 47 * We may need to remove the node we're looking at and that would 48 * disturb the iterator, so advance in advance. */ 49 noit_skiplist_next(check->feeds, &next); 50 feed_name = (char *)curr->data; 51 ls = noit_log_stream_find(feed_name); 52 if(ls) log_f(ls, check); 53 else { 54 noit_skiplisti_remove(check->feeds, curr, free); 55 } 56 curr = next; 57 } 58 /* We're done... we may have destroyed the last feed. 59 * that combined with transience means we should kill the check */ 60 noit_check_transient_remove_feed(check, NULL); 61 } 62 63 static void 64 _noit_check_log_check(noit_log_stream_t ls, 65 noit_check_t *check) { 66 struct timeval __now; 67 char uuid_str[37]; 68 69 uuid_unparse_lower(check->checkid, uuid_str); 70 gettimeofday(&__now, NULL); 71 noitL(ls, "C\t%lu.%03lu\t%s\t%s\t%s\t%s\n", 72 SECPART(&__now), MSECPART(&__now), 73 uuid_str, check->target, check->module, check->name); 74 } 75 35 76 void 36 77 noit_check_log_check(noit_check_t *check) { 37 struct timeval __now; 78 handle_extra_feeds(check, _noit_check_log_check); 79 if(!(check->flags & NP_TRANSIENT)) { 80 SETUP_LOG(check, return); 81 _noit_check_log_check(check_log, check); 82 } 83 } 84 85 static void 86 _noit_check_log_status(noit_log_stream_t ls, 87 noit_check_t *check) { 88 stats_t *c; 38 89 char uuid_str[37]; 39 SETUP_LOG(check, return); 40 41 gettimeofday(&__now, NULL); 90 42 91 uuid_unparse_lower(check->checkid, uuid_str); 43 noitL(check_log, "C\t%lu.%03lu\t%s\t%s\t%s\t%s\n", 44 SECPART(&__now), MSECPART(&__now), uuid_str, 45 check->target, check->module, check->name); 92 c = &check->stats.current; 93 noitL(ls, "S\t%lu.%03lu\t%s\t%c\t%c\t%d\t%s\n", 94 SECPART(&c->whence), MSECPART(&c->whence), uuid_str, 95 (char)c->state, (char)c->available, c->duration, c->status); 46 96 } 47 97 void 48 98 noit_check_log_status(noit_check_t *check) { 49 char uuid_str[37]; 50 stats_t *c; 51 SETUP_LOG(status, return); 52 53 uuid_unparse_lower(check->checkid, uuid_str); 54 c = &check->stats.current; 55 noitL(status_log, "S\t%lu.%03lu\t%s\t%c\t%c\t%d\t%s\n", 56 SECPART(&c->whence), MSECPART(&c->whence), uuid_str, 57 (char)c->state, (char)c->available, c->duration, c->status); 58 } 59 void 60 noit_check_log_metrics(noit_check_t *check) { 99 handle_extra_feeds(check, _noit_check_log_status); 100 if(!(check->flags & NP_TRANSIENT)) { 101 SETUP_LOG(status, return); 102 _noit_check_log_status(status_log, check); 103 } 104 } 105 static void 106 _noit_check_log_metrics(noit_log_stream_t ls, noit_check_t *check) { 61 107 char uuid_str[37]; 62 108 noit_hash_iter iter = NOIT_HASH_ITER_ZERO; … … 65 111 metric_t *m; 66 112 stats_t *c; 67 SETUP_LOG(metrics, return);68 113 69 114 uuid_unparse_lower(check->checkid, uuid_str); … … 74 119 75 120 if(!m->metric_value.s) { /* they are all null */ 76 noitL( metrics_log, "M\t%lu.%03lu\t%s\t%s\t%c\t[[null]]\n",121 noitL(ls, "M\t%lu.%03lu\t%s\t%s\t%c\t[[null]]\n", 77 122 SECPART(&c->whence), MSECPART(&c->whence), uuid_str, 78 123 m->metric_name, m->metric_type); … … 81 126 switch(m->metric_type) { 82 127 case METRIC_INT32: 83 noitL( metrics_log, "M\t%lu.%03lu\t%s\t%s\t%c\t%d\n",128 noitL(ls, "M\t%lu.%03lu\t%s\t%s\t%c\t%d\n", 84 129 SECPART(&c->whence), MSECPART(&c->whence), uuid_str, 85 130 m->metric_name, m->metric_type, *(m->metric_value.i)); 86 131 break; 87 132 case METRIC_UINT32: 88 noitL( metrics_log, "M\t%lu.%03lu\t%s\t%s\t%c\t%u\n",133 noitL(ls, "M\t%lu.%03lu\t%s\t%s\t%c\t%u\n", 89 134 SECPART(&c->whence), MSECPART(&c->whence), uuid_str, 90 135 m->metric_name, m->metric_type, *(m->metric_value.I)); 91 136 break; 92 137 case METRIC_INT64: 93 noitL( metrics_log, "M\t%lu.%03lu\t%s\t%s\t%c\t%lld\n",138 noitL(ls, "M\t%lu.%03lu\t%s\t%s\t%c\t%lld\n", 94 139 SECPART(&c->whence), MSECPART(&c->whence), uuid_str, 95 140 m->metric_name, m->metric_type, *(m->metric_value.l)); 96 141 break; 97 142 case METRIC_UINT64: 98 noitL( metrics_log, "M\t%lu.%03lu\t%s\t%s\t%c\t%llu\n",143 noitL(ls, "M\t%lu.%03lu\t%s\t%s\t%c\t%llu\n", 99 144 SECPART(&c->whence), MSECPART(&c->whence), uuid_str, 100 145 m->metric_name, m->metric_type, *(m->metric_value.L)); 101 146 break; 102 147 case METRIC_DOUBLE: 103 noitL( metrics_log, "M\t%lu.%03lu\t%s\t%s\t%c\t%.12e\n",148 noitL(ls, "M\t%lu.%03lu\t%s\t%s\t%c\t%.12e\n", 104 149 SECPART(&c->whence), MSECPART(&c->whence), uuid_str, 105 150 m->metric_name, m->metric_type, *(m->metric_value.n)); 106 151 break; 107 152 case METRIC_STRING: 108 noitL( metrics_log, "M\t%lu.%03lu\t%s\t%s\t%c\t%s\n",153 noitL(ls, "M\t%lu.%03lu\t%s\t%s\t%c\t%s\n", 109 154 SECPART(&c->whence), MSECPART(&c->whence), uuid_str, 110 155 m->metric_name, m->metric_type, m->metric_value.s); … … 117 162 } 118 163 } 164 void 165 noit_check_log_metrics(noit_check_t *check) { 166 handle_extra_feeds(check, _noit_check_log_metrics); 167 if(!(check->flags & NP_TRANSIENT)) { 168 SETUP_LOG(metrics, return); 169 _noit_check_log_metrics(metrics_log, check); 170 } 171 } 172 119 173 int 120 174 noit_stats_snprint_metric(char *b, int l, metric_t *m) { src/noit_conf_checks.c
r70451c5 r7180374 305 305 } 306 306 goto out; 307 } 308 out: 309 if(pobj) xmlXPathFreeObject(pobj); 310 return 0; 311 } 312 static int 313 noit_console_watch_check(noit_console_closure_t ncct, 314 int argc, char **argv, 315 noit_console_state_t *state, void *closure) { 316 int i, cnt; 317 int adding = (int)closure; 318 int period = 0; 319 char xpath[1024]; 320 xmlXPathObjectPtr pobj = NULL; 321 xmlXPathContextPtr xpath_ctxt = NULL; 322 323 noit_conf_xml_xpath(NULL, &xpath_ctxt); 324 if(argc < 1 || argc > 2) { 325 nc_printf(ncct, "requires one or two arguments\n"); 326 return -1; 327 } 328 /* An alternate period */ 329 if(argc == 2) period = atoi(argv[1]); 330 331 if(noit_console_mkcheck_xpath(xpath, sizeof(xpath), NULL, 332 argc ? argv[0] : NULL)) { 333 nc_printf(ncct, "ERROR: could not find check '%s'\n", argv[0]); 334 return -1; 335 } 336 337 pobj = xmlXPathEval((xmlChar *)xpath, xpath_ctxt); 338 if(!pobj || pobj->type != XPATH_NODESET || 339 xmlXPathNodeSetIsEmpty(pobj->nodesetval)) { 340 nc_printf(ncct, "no checks found\n"); 341 goto out; 342 } 343 cnt = xmlXPathNodeSetGetLength(pobj->nodesetval); 344 for(i=0; i<cnt; i++) { 345 uuid_t checkid; 346 noit_check_t *check; 347 xmlNodePtr node; 348 char *uuid_conf; 349 350 node = (noit_conf_section_t)xmlXPathNodeSetItem(pobj->nodesetval, i); 351 uuid_conf = (char *)xmlGetProp(node, (xmlChar *)"uuid"); 352 if(!uuid_conf || uuid_parse(uuid_conf, checkid)) { 353 nc_printf(ncct, "%s has invalid or missing UUID!\n", 354 (char *)xmlGetNodePath(node) + strlen("/noit")); 355 continue; 356 } 357 if(period == 0) { 358 check = noit_poller_lookup(checkid); 359 if(!check) continue; 360 if(adding) noit_check_transient_add_feed(check, ncct->feed_path); 361 else noit_check_transient_remove_feed(check, ncct->feed_path); 362 } 363 else { 364 if(adding) { 365 check = noit_check_watch(checkid, period); 366 /* This check must be watched from the console */ 367 noit_check_transient_add_feed(check, ncct->feed_path); 368 /* Note the check */ 369 noit_check_log_check(check); 370 /* kick it off, if it isn't running already */ 371 if(!NOIT_CHECK_LIVE(check)) noit_check_activate(check); 372 } 373 else { 374 check = noit_check_get_watch(checkid, period); 375 if(check) noit_check_transient_remove_feed(check, ncct->feed_path); 376 } 377 } 307 378 } 308 379 out: … … 1226 1297 static 1227 1298 void register_console_config_commands() { 1228 cmd_info_t *showcmd ;1299 cmd_info_t *showcmd, *nocmd; 1229 1300 noit_console_state_t *tl, *_conf_state, *_conf_t_state, 1230 1301 *_conf_t_check_state, … … 1276 1347 ADD_CMD(showcmd->dstate, "check", noit_console_show_check, NULL, NULL); 1277 1348 1349 ADD_CMD(tl, "watch", noit_console_watch_check, NULL, (void *)1); 1350 1351 nocmd = noit_console_state_get_cmd(tl, "no"); 1352 ADD_CMD(nocmd->dstate, "watch", noit_console_watch_check, NULL, (void *)0); 1353 1278 1354 DELEGATE_CMD(_conf_t_state, "write", _write_state); 1279 1355 DELEGATE_CMD(_conf_t_state, "attribute", _attr_state); src/noit_console.c
r137f7c6 r7180374 156 156 void 157 157 noit_console_closure_free(noit_console_closure_t ncct) { 158 noit_log_stream_t lf; 158 159 if(ncct->el) el_end(ncct->el); 159 160 if(ncct->hist) history_end(ncct->hist); … … 168 169 ncct->state_stack = tmp->last; 169 170 free(tmp); 171 } 172 lf = noit_log_stream_find(ncct->feed_path); 173 noit_log_stream_remove(ncct->feed_path); 174 if(lf) { 175 noit_log_stream_free(lf); 170 176 } 171 177 free(ncct); … … 234 240 235 241 void 236 noit_console_init() {237 el_multi_init();238 signal(SIGTTOU, SIG_IGN);239 eventer_name_callback("noit_console", noit_console_handler);240 }241 242 void243 242 noit_console_dispatch(eventer_t e, const char *buffer, 244 243 noit_console_closure_t ncct) { … … 313 312 socket_error: 314 313 /* Exceptions cause us to simply snip the connection */ 314 315 /* This removes the log feed which is important to do before calling close */ 315 316 eventer_remove_fd(e->fd); 316 e->opset->close(e->fd, &newmask, e);317 317 if(ncct) noit_console_closure_free(ncct); 318 318 if(ac) acceptor_closure_free(ac); 319 e->opset->close(e->fd, &newmask, e); 319 320 return 0; 320 321 } … … 350 351 noit_console_state_init(ncct); 351 352 } 353 snprintf(ncct->feed_path, sizeof(ncct->feed_path), "console/%d", e->fd); 354 noit_log_stream_new(ncct->feed_path, "noit_console", ncct->feed_path, 355 ncct, NULL); 352 356 noit_console_motd(e, ac, ncct); 353 357 ncct->initialized = 1; … … 416 420 } 417 421 422 static int 423 noit_console_logio_open(noit_log_stream_t ls) { 424 return 0; 425 } 426 static int 427 noit_console_logio_reopen(noit_log_stream_t ls) { 428 /* no op */ 429 return 0; 430 } 431 static int 432 noit_console_logio_write(noit_log_stream_t ls, const void *buf, size_t len) { 433 noit_console_closure_t ncct = ls->op_ctx; 434 int rv, rlen, mask; 435 if(!ncct) return 0; 436 rlen = nc_write(ls->op_ctx, buf, len); 437 while((rv = noit_console_continue_sending(ncct, &mask)) == -1 && errno == EINTR); 438 if(rv == -1 && errno == EAGAIN) { 439 ncct->e->mask = mask | EVENTER_EXCEPTION; 440 eventer_update(ncct->e); 441 } 442 return rlen; 443 } 444 static int 445 noit_console_logio_close(noit_log_stream_t ls) { 446 ls->op_ctx = NULL; 447 return 0; 448 } 449 static logops_t noit_console_logio_ops = { 450 noit_console_logio_open, 451 noit_console_logio_reopen, 452 noit_console_logio_write, 453 noit_console_logio_close, 454 }; 455 456 void 457 noit_console_init() { 458 el_multi_init(); 459 signal(SIGTTOU, SIG_IGN); 460 noit_register_logops("noit_console", &noit_console_logio_ops); 461 eventer_name_callback("noit_console", noit_console_handler); 462 } 463 src/noit_console.h
r4d6b73a r7180374 66 66 typedef struct __noit_console_closure { 67 67 int initialized; 68 char feed_path[128]; 68 69 eventer_t e; /* The event it is attached to. This 69 70 * is needed so it can write itself out */ src/noit_console_state.c
r4d6b73a r7180374 338 338 static noit_console_state_t *_top_level_state = NULL; 339 339 if(!_top_level_state) { 340 static noit_console_state_t * show_state;340 static noit_console_state_t *no_state; 341 341 _top_level_state = noit_console_state_alloc(); 342 342 noit_console_state_add_cmd(_top_level_state, &console_command_exit); 343 show_state = noit_console_state_alloc();344 343 noit_console_state_add_cmd(_top_level_state, 345 NCSCMD("show", noit_console_state_delegate, show_state, NULL)); 344 NCSCMD("show", noit_console_state_delegate, 345 noit_console_state_alloc(), NULL)); 346 no_state = noit_console_state_alloc(); 347 noit_console_state_add_cmd(_top_level_state, 348 NCSCMD("no", noit_console_state_delegate, 349 no_state, NULL)); 350 346 351 noit_console_state_add_cmd(_top_level_state, &console_command_shutdown); 347 352 noit_console_state_add_cmd(_top_level_state, &console_command_restart); src/utils/noit_skiplist.c
r2f47438 r7180374 375 375 while(noit_skiplist_pop(sl->index, noit_skiplisti_destroy) != NULL); 376 376 noit_skiplist_remove_all(sl, myfree); 377 free(sl);378 377 } 379 378 void *noit_skiplist_pop(noit_skiplist * a, noit_freefunc_t myfree)
