Example #1
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)
{

  /*     NOT_YET_IMPLEMENTED("PROCS: initproc_run");


        return NULL; */

#ifdef __DRIVERS__

  kshell_add_command("faber",faber,"faber tests");
  kshell_add_command("sunghan",sunghan,"Sunghan tests");
  kshell_add_command("sunghan_deadlock",sunghan_deadlock,"Sunghan Deadlock tests");
  /*kshell_add_command("foo", do_foo, "invoke do_foo() to print a message...");

*/
  kshell_t *kshell = kshell_create(0);

  if (NULL == kshell) panic("init: Couldn't create kernel shell\n");
  dbg(DBG_PRINT,"(GRADING1B)\n");
  while (kshell_execute_next(kshell));
  kshell_destroy(kshell);


#endif

return NULL;




}
Example #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)
{
        /*NOT_YET_IMPLEMENTED("PROCS: initproc_run");*/
        kshell_add_command("fabertest", do_fabertest, "invoke do_fabertest() to test.");
        kshell_add_command("sunghan", do_sunghan, "invoke sunghan_test() to test.");
        kshell_add_command("deadlock", do_deadlock, "invoke sunghan_deadlock_test() to test.");
        kshell_t *kshell = kshell_create(0);
        if (NULL == kshell) panic("init: Couldn't create kernel shell\n");
        while (kshell_execute_next(kshell))
        {
            while(!list_empty(&curproc->p_children))
                do_waitpid(-1,0,0);
        }
        kshell_destroy(kshell);
        return NULL;
}
Example #3
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 "/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)
{
        /* PROCS {{{ */
#ifdef __VM__
        int status;

        dbg(DBG_INIT, "do_init!\n");

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

        char *const argvec[] = { "foo", NULL };
        char *const envvec[] = { "bar", NULL };
        kernel_execve("/sbin/init", argvec, envvec);

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

#ifdef __DRIVERS__

        /* If we do not have VM yet, run the kernel shell */
        kshell_t *kshell;

        /* Create kernel shell on TTY 0 */
        kshell = kshell_create(0);
        if (NULL == kshell)
                panic("init: Couldn't create kernel shell\n");

        while (kshell_execute_next(kshell));
        kshell_destroy(kshell);
#endif
        /* PROCS }}} */
    
    
#ifdef __VFS__
        /*TEST VFS*/
        vfstest_main(1,NULL);
        do_exit(0);
#endif

        return NULL;
}
Example #4
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;
}
Example #5
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;
}
Example #6
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 "/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;
}
Example #7
0
File: kmain.c Project: 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;
}
Example #8
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)
{
        /* 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;
}