/** * This function contains the main check machinery for monit. The * validate function check services in the service list to see if * they will pass all defined tests. */ void validate() { Service_T s; sigset_t ns, os; if(! update_loadavg()) log("Update of loadavg has failed!\n"); if(Run.doprocess) initprocesstree(); for(s= servicelist; s; s= s->next) { if(s->visited) continue; LOCK(s->mutex) set_signal_block(&ns, &os); if(s->do_monitor && !check_skip(s) && !check_timeout(s)) s->check(s); unset_signal_block(&os); END_LOCK; } if(Run.doprocess) delprocesstree(); reset_depend(); }
static void *thread_wrapper(void *arg) { sigset_t ns; /* Block collective signals in the http thread. The http server is * taken down gracefully by signaling the main monit thread */ set_signal_block(&ns, NULL); start_httpd(Run.httpdport, 1024, Run.bind_addr); return NULL; }