ent* LOOKUP_R(ent* e, const char* fmt, ...) { char buf[128]; va_list va; va_start(va, fmt); vprintf(buf, 128, fmt, va, false); va_end(va); vector* v = ksplit_to_vector(buf, "/"); ent * ret = LOOKUP(e, v, 0); cleanup_vector(v); return ret; }
err_t LINK_R(ent* e, ent* child, const char* fmt, ...) { char buf[128]; va_list va; va_start(va, fmt); vprintf(buf, 128, fmt, va, false); va_end(va); vector* v = ksplit_to_vector(buf, "/"); err_t ret = LINK(e, child, v, 0); if (ret != SUCCESS) printk("LINK_R err %d", ret); cleanup_vector(v); return ret; }
int cleanup(int how) { LOG("pid %d cleaning up.is_main=%d is_udp=%d is_tls=%d is_timer=%d\n",getpid(),is_main,is_udp,is_tls,is_timer); cleanup_vector(); #ifdef USE_TLS destroy_shm(); #endif if (is_main) { if (how == 0) cleanup_childs(); if (how == 0) if (pid_file) LOG("unlink returned %d\n",unlink(pid_file)); } //closing sockets if (bind_address) { if (bind_address->socket > 0) close(bind_address->socket); free(bind_address); } if (bind_address_port) { if (bind_address_port->socket > 0) close(bind_address_port->socket); free(bind_address_port); } if (alternate_address) { //close socket if (alternate_address->socket > 0) close(alternate_address->socket); free(alternate_address); } if (alternate_address_port) { //close socket if (alternate_address_port->socket > 0) close(alternate_address_port->socket); free(alternate_address_port); } #ifdef USE_TLS if (tls_bind_address) { if (tls_bind_address->socket > 0) close(tls_bind_address->socket); free(tls_bind_address); } #endif return 0; }