int main() { init_task(&task); signal(SIGPIPE,SIG_IGN); signal(SIGINT,signal_quit); create_listen_thread(); create_worker_thread(); while(1) { } }
int main(int argc, char **argv) { int sock, port; void *status; char addr[INET_ADDRSTRLEN]; pthread_t *ptr_th; memcpy(addr, BIND_ADDR, INET_ADDRSTRLEN); port = PORT; sock = create_listen_sock(port, addr); while(1) { create_listen_thread(port, addr, sock); } pthread_exit(NULL); return 0; }
/* add a console */ static void do_add_cons(vntsd_t *vntsdp, int cons_no) { vcc_console_t console; vntsd_group_t *groupp; int rv; char err_msg[VNTSD_LINE_LEN]; (void) snprintf(err_msg, sizeof (err_msg), "do_add_cons():Can not add console=%d", cons_no); /* get console configuration from vcc */ if ((rv = vntsd_vcc_ioctl(VCC_CONS_INFO, cons_no, (void *)&console)) != VNTSD_SUCCESS) { vntsd_log(rv, err_msg); return; } /* clean up the console if console was deleted and added again */ delete_cons_before_add(vntsdp, console.tcp_port, console.cons_no); /* initialize console */ if ((rv = alloc_cons_with_group(vntsdp, &console, &groupp)) != VNTSD_SUCCESS) { /* no memory to add this new console */ vntsd_log(rv, err_msg); return; } if (groupp != NULL) { /* new group */ /* create listen thread for this console */ if (create_listen_thread(groupp)) { vntsd_log(VNTSD_ERR_CREATE_LISTEN_THR, err_msg); (void) cond_destroy(&groupp->cvp); (void) mutex_destroy(&groupp->lock); free(groupp); } } }