/* * Close the sockets, shutdown the server and exit. * Does not return. * */ static void server_shutdown(struct nsd *nsd) { size_t i; close_all_sockets(nsd->udp, nsd->ifs); close_all_sockets(nsd->tcp, nsd->ifs); /* CHILD: close command channel to parent */ if(nsd->this_child && nsd->this_child->parent_fd != -1) { close(nsd->this_child->parent_fd); nsd->this_child->parent_fd = -1; } /* SERVER: close command channels to children */ if(!nsd->this_child) { for(i=0; i < nsd->child_count; ++i) if(nsd->children[i].child_fd != -1) { close(nsd->children[i].child_fd); nsd->children[i].child_fd = -1; } } log_finalize(); tsig_finalize(); nsd_options_destroy(nsd->options); region_destroy(nsd->region); exit(0); }
void adam_finalize(void) { cesk_finalize(); dalvik_finalize(); stringpool_fianlize(); log_finalize(); }
int main() { log_init(); log_printf("hi"); log_normalize(); log_printf("ok"); sleep(2); log_printf("bye"); log_finalize(); }