Beispiel #1
0
/*
 * Dump debugging state to log file
 */
bool_t
rcmd_debug_dump_1_svc(void *result, struct svc_req *rqstp)
{
	notice_msg("received debug dump request, "
		   "dumping the state to log file (%s) ...",
		   membalanced_log_path);
	show_debugging_info();
	notice_msg("debug dump completed.");
	return true;
}
Beispiel #2
0
/*
 * Process expected signals
 */
static void handle_signals(struct pollfd *pollfds, bool *p_recheck_time)
{
	struct signalfd_siginfo fdsi;
	ssize_t sz;

	/* SIGTERM - exit gracefully */
	if (pollfds[NPFD_SIGTERM].revents & (POLLIN|POLLPRI))
	{
		shutdown_xs();
		notice_msg("terminating...");
		exit(EXIT_SUCCESS);
	}

	/* SIGHUP - reload configuration */
	if (pollfds[NPFD_SIGHUP].revents & (POLLIN|POLLPRI))
	{
		sz = read(fd_sighup, &fdsi, sizeof(fdsi));
		if (sz < 0)
			fatal_perror("read signalfd");
		if (sz != sizeof(fdsi))
			fatal_msg("read signalfd");
		/* reload configuration -- currently none for memprobed */
		if (p_recheck_time)
			*p_recheck_time = true;
	}
}
Beispiel #3
0
/*
 * Set logging level.
 * If parameter is -1, do not change logging level.
 * Returns previous logging level.
 */
bool_t
rcmd_set_debug_level_1_svc(int arg1, int *result,  struct svc_req *rqstp)
{
	*result = debug_level;
	if (arg1 >= 0)
	{
		debug_level = arg1;
		notice_msg("Setting logging level to %d", debug_level);
	}
	return true;
}
Beispiel #4
0
//=============================================================================
void Metaserver::Interrupted()
{
  notice_msg("Interrupted.  Shutting down.");
  notice_msg("Received %d datagrams", mPacketCount);
  notice_msg("There were %d active servers.", mActiveServers.size());
  notice_msg("There were %d pending server handshakes.", 
             mServerHandshakes.size());
  notice_msg("There were %d pending client handshakes.",
             mClientHandshakes.size());
  notice_msg("There were %d peak active servers", mPeakActiveServers);
  notice_msg("There were %d peak active clients", mPeakActiveClients);
  notice_msg("There were %d peak pending server handshakes", 
             mPeakPendingServerHandshakes);
  notice_msg("There were %d peak pending client handshakes", 
             mPeakPendingClientHandshakes);
  exit(0);
}
Beispiel #5
0
/*
 * Open connection to xenstore.
 *
 * @pollfds defines of signal-handling descriptors to be watched
 * if has to wait.
 *
 * Will not touch pollfds[NPFD_XS].
 */
static void open_xs_connection(struct pollfd *pollfds)
{
	struct timespec ts0;
	int64_t wsec;
	bool displayed_msg = false;
	int k;

	/*
	 * If we are running as a daemon during system startup, there
	 * can be a race condition with continuing Xen initialization
	 * (/proc/xen including /proc/xen/privcmd may be unavailable yet,
	 * still to be created even though Xen service startup completion
	 * has already been signalled), so wait for a while if necessary.
	 */
	for (ts0 = getnow();;)
	{
		if (!xs)
			xs = xs_open(0);
		if (xs)
			break;

		/* time since the start */
		wsec = timespec_diff_ms(getnow(), ts0) / MSEC_PER_SEC;

		if (run_as_daemon && wsec < max_xen_init_retries)
		{
			if (wsec >= xen_init_retry_msg && !displayed_msg)
			{
				notice_msg("waiting for Xen to initialize");
				displayed_msg = true;
			}

			if (pollfds != NULL)
			{
				int npollfds = NPFD_COUNT - 1;
				for (k = 0;  k < npollfds;  k++)
					pollfds[k].revents = 0;
				if (poll(pollfds, npollfds, 1 * MSEC_PER_SEC) < 0)
					fatal_perror("poll");
				handle_signals(pollfds, NULL);
			}
			else
			{
				sleep(1);
			}
		}
		else
		{
			fatal_perror("unable to open connection to xenstore");
		}
	}
}
Beispiel #6
0
int mkdir_report(char *path)
{
	struct stat buf;
	if(stat(path, &buf) != 0){
		warning_msg("There is no directory [%s], will be created!\n",path);
		if(mkdir(path, 10705) != 0){
			error_msg("Directory [%s] can not be created!\n",path);
			return -1;
		}else{
			notice_msg("Directory has been created successfully!\n");
		}
	}else if(!S_ISDIR(buf.st_mode)){
			error_msg("%s is not dir\n",path);
			return -1;
	}
	return 0;
}
Beispiel #7
0
void report_filetype(int type)
{
	char file_format[20] = "";
	char seq_format[50] = "";
	if(type & FILE_FASTQ){
		if(type & FILE_PHRED33)		strcpy(seq_format, "FASTQ with phred+33 quality score");
		if(type & FILE_PHRED64)		strcpy(seq_format, "FASTQ with phred+64 quality score");
	}else if(type & FILE_FASTA){
		strcpy(seq_format, "FASTA with no quality score");
		if(type & FILE_PHRED33)		strcpy(seq_format, "FASTA with phred+33 quality score");
		if(type & FILE_PHRED64)		strcpy(seq_format, "FASTA with phred+64 qualtiy score");
	}
	if(type & FILE_GZ)		sprintf(file_format, "compressed in GZIP");
	if(type & FILE_BZ2)		sprintf(file_format, "compressed in BZIP");

	notice_msg("%s %s\n", seq_format,file_format);

}