예제 #1
0
void quit_cb (int i)
{
	procclean();
	if ((!tracemode) && (!DEBUG))
		exit_ui();
	exit(0);
}
예제 #2
0
int main(int argc, char *argv[])
{
        if (2 != argc) {
                errx(EXIT_FAILURE, "Usage: %s [CONFIGURATION FILE]", argv[0]);
        }

        pw_client_bst = bst_init();

        if (0 != atexit(clean_up)) {
                bst_destroy(&pw_client_bst, (enum bst_type)PW_CLIENT_BST);
                errx(EXIT_FAILURE, "atexit() : failed to register clean_up()");
        }

        configname = argv[1];
        struct sigaction sa = {
                .sa_handler = signal_handle,
                /*.sa_flags = SA_RESTART,*/
        };
        sigemptyset_or_die(&sa.sa_mask);
        sigaction_or_die(SIGINT, &sa, NULL);
        sigaction_or_die(SIGHUP, &sa, NULL);
        setbuf(stdout, NULL); /*Make stdout unbuffered.*/
        procclean((enum pw_clean_type)PW_SERVER_CLEAN);
        procserver();

        return EXIT_SUCCESS;
}
예제 #3
0
파일: main.cpp 프로젝트: nxtreaming/nethugs
void clean_up()
{
	//close file descriptors
	for(std::vector<int>::const_iterator it=pc_loop_fd_list.begin();
		it != pc_loop_fd_list.end(); ++it)
	{
		close(*it);
	}
	
	procclean();
	if ((!tracemode) && (!DEBUG))
		exit_ui();	
}
예제 #4
0
static void nethogsmonitor_clean_up() {
  // clean up
  handle *current_handle = handles;
  while (current_handle != NULL) {
    pcap_close(current_handle->content->pcap_handle);
    current_handle = current_handle->next;
  }

  // close file descriptors
  for (std::vector<int>::const_iterator it = pc_loop_fd_list.begin();
       it != pc_loop_fd_list.end(); ++it) {
    close(*it);
  }

  procclean();
}