Esempio n. 1
0
/**
 * Kill everything upon ^C.
 */
static void jump_out(int signum) {
	pounder_fprintf(stdout, "Control-C received; aborting!\n");
	//unlink("pounder_pgrp");
	kill_tests();
	kill_daemons();
	if (is_leader) {
		unlink(pidfile);
	}
	exit(0);
}
Esempio n. 2
0
void init_system(int action)
{
	int index=0;
	char tmpbuf[100];	

	system("echo 0 > /proc/gpio"); //mark_issue , disable gpio anytime ?
    //kill daemon
    kill_daemons();	
	
	//mark_mac , now , we dont support lan reopen
	//bring_down_lan();	
	
	bring_down_wlan();	
	
	// init wlan driver
	if ((action & INIT_WLAN_PHY))
	{
		for(index=0; index<get_vap_num()+1; index++)
			initWlan(index,fecth_wlanmib(index),fecth_hwmib());

		if( get_sys_mode() == REPEATER_AP_MODE ) //mark_issue , to do Client mode??
			initWlan(WLAN_VXD_INDEX,fecth_wlanmib(WLAN_VXD_INDEX),fecth_hwmib());		
	}		
	//-----------------------------------------------
	init_vlan(); 	

	bring_up_wlan();

	sprintf(tmpbuf, "%s %s hw ether %s ", IFCONFG, IF_BR,INBAND_MAC); 
	system(tmpbuf);

#ifdef RTK_WPS_BRIDGE_HACK
	init_host_info();
#endif

	active_daemons();
}
Esempio n. 3
0
File: run.c Progetto: 1587/ltp
/**
 * Main program.  Returns 1 if all programs run successfully, 0 if
 * something failed and -1 if there was an error running programs.
 */
int main(int argc, char *argv[])
{
	int retcode;
	struct sigaction zig;
	pid_t pid;
	char *c;

	/* Check parameters */
	if (argc < 2) {
		fprintf(stderr, "Usage: %s test_prog\n", argv[0]);
		return 1;
	}

	if (argc > 2 && strcmp(argv[2], "--leader") == 0) {
		pounder_fprintf(stdout,
				"Logging this test output to %s/POUNDERLOG.\n",
				getenv("POUNDER_LOGDIR"));
		is_leader = 1;
		record_pid();
	}

	progname = argv[0];

	/* Set up signals */
	memset(&zig, 0x00, sizeof(zig));
	zig.sa_handler = jump_out;
	sigaction(SIGHUP, &zig, NULL);
	sigaction(SIGINT, &zig, NULL);
	sigaction(SIGTERM, &zig, NULL);

	if (is_directory(argv[1])) {
		retcode = process_dir(argv[1]);
	} else {
		if (is_executable(argv[1])) {
			c = rindex(argv[1], '/');
			c++;

			// Start the test
			pid = spawn_test(argv[1]);
			if (pid < 0) {
				perror("fork");
				retcode = -1;
				goto out;
			}
			// Track the test
			note_process(pid, argv[1]);
			if (wait_for_pids() == 0) {
				retcode = 1;
			} else {
				retcode = 0;
			}
		} else {
			pounder_fprintf(stderr,
					"%s: Not a directory or a test.\n",
					argv[1]);
			retcode = -1;
		}
	}

out:
	kill_daemons();
	wait_for_daemons();
	if (is_leader) {
		if (retcode == 0) {
			pounder_fprintf(stdout, "%s: %s.\n", argv[1], pass_msg);
		} else if (retcode < 0 || retcode == 255) {
			pounder_fprintf(stdout, "%s: %s with code %d.\n",
					argv[1], abort_msg, retcode);
		} else {
			pounder_fprintf(stdout, "%s: %s with code %d.\n",
					argv[1], fail_msg, retcode);
		}
		unlink(pidfile);
	}
	exit(retcode);
}