示例#1
0
static int sys_kshell(int ttyid)
{
    kshell_t *ksh;
    int       err;
    
    /* Create a kshell on tty */
    ksh = kshell_create(ttyid);
    if (NULL == ksh) {
        curthr->kt_errno = ENODEV;
        return -1;
    }
    
    while ((err = kshell_execute_next(ksh)) > 0);
    kshell_destroy(ksh);
    if (err < 0) {
        curthr->kt_errno = -err;
        return -1;
    }
    
    return 0;
}
示例#2
0
/**
 * The init thread's function changes depending on how far along your Weenix is
 * developed. Before VM/FI, you'll probably just want to have this run whatever
 * tests you've written (possibly in a new process). After VM/FI, you'll just
 * exec "/sbin/init".
 *
 * Both arguments are unused.
 *
 * @param arg1 the first argument (unused)
 * @param arg2 the second argument (unused)
 */
static void *
initproc_run(int arg1, void *arg2)
{
	 #ifdef __DRIVERS__
        /*All Kshell commands*/
        kshell_add_command("faber", faberTest, "Run faber_thread_test().");
        kshell_add_command("sunghan", sunghanTest, "Run sunghan_test().");
        kshell_add_command("deadlock", sunghandeadlocktest, "Run sunghan_deadlock_test().");
      
          kshell_t *kshell = kshell_create(0);
             
if (NULL == kshell) panic("init: Couldn't create kernel shell\n");

dbg(DBG_PRINT,"(GRADING1B) Kshell created successfully") ;
while (kshell_execute_next(kshell));

kshell_destroy(kshell);
dbg(DBG_PRINT,"(GRADING1B) Kshell destroyed") ;
#endif /* __DRIVERS__ */ 
    return NULL;
}
示例#3
0
文件: kmain.c 项目: dan-boa/kernel2
/**
 * The init thread's function changes depending on how far along your Weenix is
 * developed. Before VM/FI, you'll probably just want to have this run whatever
 * tests you've written (possibly in a new process). After VM/FI, you'll just
 * exec "/bin/init".
 *
 * Both arguments are unused.
 *
 * @param arg1 the first argument (unused)
 * @param arg2 the second argument (unused)
 */
static void *
initproc_run(int arg1, void *arg2)
{
       
#ifdef __DRIVERS__
	
        kshell_add_command("Sunghan test", Sunghantest, "\n");
	kshell_add_command("Faber Test",fabertest,"\n");
	kshell_add_command("deadlock test",Sunghandeadlock,"\n");
	kshell_add_command("vfstest_main", vfstestmain,"\n");

        kshell_t *kshell = kshell_create(0);
        if (NULL == kshell) panic("init: Couldn't create kernel shell\n");
        while(kshell_execute_next(kshell));
        kshell_destroy(kshell);

#endif /* __DRIVERS__ */
	
    /*   dbg(DBG_INIT, "\n..........RUNNING INITPROC AWESOMELY .......\n");*/
        return NULL;
}
示例#4
0
文件: kmain.c 项目: lee4sj/brown
/**
 * The init thread's function changes depending on how far along your Weenix is
 * developed. Before VM/FI, you'll probably just want to have this run whatever
 * tests you've written (possibly in a new process). After VM/FI, you'll just
 * exec "/bin/init".
 *
 * Both arguments are unused.
 *
 * @param arg1 the first argument (unused)
 * @param arg2 the second argument (unused)
 */
static void *
initproc_run(int arg1, void *arg2)
{
	dbg(DBG_CORE, "running initproc_run\n");

	/* TESTS */
	my_proctest();
	my_drivertest();
	my_s5fstest();
	my_vmtest();

	vfstest_main(1, NULL);

#ifdef __VM__
	int status;
	char *const argv[] = { "hello", NULL };
	char *const envp[] = { "world", NULL };

	do_open("/dev/tty0", O_RDONLY);
	do_open("/dev/tty0", O_WRONLY);
	do_open("/dev/tty0", O_WRONLY);

	kernel_execve("/sbin/init", argv, envp);

	while (!do_waitpid(-1, 0, &status));
	do_exit(0);
#endif

	/* KSHELL */
	int err = 0;
	kshell_t *ksh = kshell_create(0);
	KASSERT(ksh && "did not create a kernel shell as expected");

	while ((err = kshell_execute_next(ksh)) > 0);
	KASSERT(err == 0 && "kernel shell exited with an error\n");
	kshell_destroy(ksh);

        return NULL;
}
示例#5
0
文件: kmain.c 项目: BarFox/gitDir
/**
 * The init thread's function changes depending on how far along your Weenix is
 * developed. Before VM/FI, you'll probably just want to have this run whatever
 * tests you've written (possibly in a new process). After VM/FI, you'll just
 * exec "/sbin/init".
 *
 * Both arguments are unused.
 *
 * @param arg1 the first argument (unused)
 * @param arg2 the second argument (unused)
 */
static void *
initproc_run(int arg1, void *arg2)
{
        /* do nothing for now -- shuts down the kernel 
           run the kshell -- infinite loop, prompt user for command -- exit = return */
        dbg(DBG_PRINT, "(GRADING1B)\n");
#ifdef __DRIVERS__

        kshell_add_command("faber", do_faber, "invock do_faber()");
        kshell_add_command("sunghan", do_sunghan, "invock do_sunghan()");
        kshell_add_command("deadlock", do_deadlock, "invock do_deadlock()");

        kshell_t *kshell = kshell_create(0);
        if (NULL == kshell) panic("init: Couldn't create kernel shell\n");
        while (kshell_execute_next(kshell));
        kshell_destroy(kshell);

#endif /* __DRIVERS__ */

     /*   NOT_YET_IMPLEMENTED("PROCS: initproc_run"); */

        return NULL;
}