示例#1
0
/*
 * This utility will do a brute force clean of a node.  It will
 * attempt to clean up any files in the user's session directory.
 * It will also look for any orted and orterun processes that are
 * not part of this job, and kill them off.
*/
int
main(int argc, char *argv[])
{
    int ret = ORTE_SUCCESS;
#if OPAL_ENABLE_FT_CR == 1
    char *tmp_env_var;
#endif

    /* This is needed so we can print the help message */
    if (ORTE_SUCCESS != (ret = opal_init_util(&argc, &argv))) {
        return ret;
    }

    if (ORTE_SUCCESS != (ret = parse_args(argc, argv))) {
        return ret;
    }

#if OPAL_ENABLE_FT_CR == 1
    /* Disable the checkpoint notification routine for this
     * tool. As we will never need to checkpoint this tool.
     * Note: This must happen before opal_init().
     */
    opal_cr_set_enabled(false);
    
    /* Select the none component, since we don't actually use a checkpointer */
    (void) mca_base_var_env_name("crs", &tmp_env_var);
    opal_setenv(tmp_env_var,
                "none",
                true, &environ);
    free(tmp_env_var);
    tmp_env_var = NULL;

    (void) mca_base_var_env_name("opal_cr_is_tool", &tmp_env_var);
    opal_setenv(tmp_env_var,
                "1", true, NULL);
    free(tmp_env_var);
#endif

    if (ORTE_SUCCESS != (ret = orte_init(&argc, &argv, ORTE_PROC_TOOL))) {
        return ret;
    }

    /*
     * Clean out all session directories - we don't have to protect
     * our own session directory because (since we are a tool) we
     * didn't create one!
     */
    if (orte_clean_globals.verbose) {
        fprintf(stderr, "orte-clean: cleaning session dir tree %s\n", 
                orte_process_info.top_session_dir);
    }
    opal_os_dirpath_destroy(orte_process_info.top_session_dir, true, NULL);
    
    /* now kill any lingering procs, if we can */
    kill_procs();

    orte_finalize();

    return ORTE_SUCCESS;
}
示例#2
0
/*
 * not really used yet..
 */
void
kill_system(int sig)  {
    signal(SIGHUP, SIG_IGN);
    signal(SIGTERM, SIG_IGN);

    kill_procs();
    exit(-1);
}
示例#3
0
/*
 * for HUP.
 */
void
restart_system(int sig)  {
    signal(SIGHUP, SIG_IGN);
    signal(SIGTERM, SIG_IGN);

    kill_procs();
    start_system();

    signal(SIGHUP, restart_system);
    signal(SIGTERM, kill_system);
}
示例#4
0
文件: misc.c 项目: OPSF/uClinux
/*
 * Quit the program.
 */
void die(int loglevel, const char *lmessage,
	 int mcode, const char *message, int exitcode)
{
	if(message)
		send_cmessage(mcode, message);
	if(lmessage)
		write_log(loglevel, lmessage);
	write_log(INFO, "Closing session");
	kill_procs();
	vscan_abort();
	exit(exitcode);
}
示例#5
0
/*
 * This utility will do a brute force clean of a node.  It will
 * attempt to clean up any files in the user's session directory.
 * It will also look for any orted and orterun processes that are
 * not part of this job, and kill them off.
*/
int
main(int argc, char *argv[])
{
    int ret = ORTE_SUCCESS;

    /* This is needed so we can print the help message */
    if (ORTE_SUCCESS != (ret = opal_init_util(&argc, &argv))) {
        return ret;
    }

    if (ORTE_SUCCESS != (ret = parse_args(argc, argv))) {
        return ret;
    }

    if (ORTE_SUCCESS != (ret = orte_init(&argc, &argv, ORTE_PROC_TOOL))) {
        return ret;
    }

    /*
     * Clean out all session directories - we don't have to protect
     * our own session directory because (since we are a tool) we
     * didn't create one!
     */
    if (orte_clean_globals.verbose) {
        fprintf(stderr, "orte-clean: cleaning session dir tree %s\n",
                orte_process_info.top_session_dir);
    }
    opal_os_dirpath_destroy(orte_process_info.top_session_dir, true, NULL);

    /* now kill any lingering procs, if we can */
    kill_procs();

    orte_finalize();

    return ORTE_SUCCESS;
}
示例#6
0
文件: tc.c 项目: flok99/tcpconsole
void serve_client(int fd, parameters_t *pars)
{
	sockprint(fd, "Enter 'h' for help\r\n");

	for(;;)
	{
		int key;

		if (sockprint(fd, "emergency console > ") == -1)
			break;

		if ((key = readchar(fd)) == -1)
			break;

		if (key < 32 || key > 126)
		{
			if (sockprint(fd, "\r") == -1)
				break;
			continue;
		}

		if (sockprint(fd, "%c\r\n", key) == -1)
			break;

		switch(key)
		{
			case '1':
			case '2':
			case '3':
			case '4':
			case '5':
			case '6':
			case '7':
			case '8':
				if (set_dmesg_loglevel(fd, key - '0') == -1)
					return;
				break;

			case 'd':
				if (dump_virtual_console(fd, pars -> vcsa0_fd) == -1)
					return;
				break;

			case '?':
			case 'h':
				if (ec_help(fd) == -1)
					return;
				break;

			case 'i':
				if (dump_loadavg(fd) == -1)
					return;
				break;

			case 'j':
				if (kill_one_proc(fd) == -1)
					return;
				break;

			case 'k':
				if (kill_procs(fd) == -1)
					return;
				break;

			case 'l':
				if (dump_dmesg(fd, pars -> dmesg_buffer, pars -> dmesg_buffer_size, 0) == -1)
					return;
				break;

			case 'm':
				if (dump_dmesg(fd, pars -> dmesg_buffer, pars -> dmesg_buffer_size, 1) == -1)
					return;
				break;

			case 'p':
				if (dump_ps(fd) == -1)
					return;
				break;

			case 'q':
				return;

			case 10:
			case 13:
				break;
			default:
				if (isupper(key))
					do_sysreq(fd, tolower(key), pars -> sysrq_fd);
				else
					sockprint(fd, "'%c' is not understood\r\n", key);
				break;
		}
	}
}