9ns: Fix dangling negative TFs
[akaros.git] / kern / src / manager.c
index c9b8a0e..a5d5766 100644 (file)
@@ -10,7 +10,6 @@
 #include <arch/init.h>
 #include <mm.h>
 #include <elf.h>
-#include <frontend.h>
 
 #include <kmalloc.h>
 #include <assert.h>
 #include <schedule.h>
 #include <syscall.h>
 #include <ktest.h>
-#include <kfs.h>
 #include <stdio.h>
 #include <time.h>
 #include <monitor.h>
-#include <colored_caches.h>
 #include <string.h>
 #include <pmap.h>
 #include <arch/console.h>
 #include <time.h>
-#include <ros/arch/membar.h>
 
 /*
  * Currently, if you leave this function by way of proc_run (process_workqueue
 void manager(void)
 {
        // LoL
-       #define PASTE(s1,s2) s1 ## s2
        #define MANAGER_FUNC(dev) PASTE(manager_,dev)
 
        #if !defined(DEVELOPER_NAME) && \
-           (defined(CONFIG_KERNEL_POSTBOOT_TESTING) || \
+           (defined(CONFIG_KERNEL_TESTING) || \
             defined(CONFIG_USERSPACE_TESTING))
                #define DEVELOPER_NAME jenkins
        #endif
@@ -59,7 +54,7 @@ char *p_argv[] = {0, 0, 0};
 /* Helper macro for quickly running a process.  Pass it a string, *file, and a
  * *proc. */
 #define quick_proc_run(x, p, f)                                                  \
-       (f) = do_file_open((x), 0, 0);                                               \
+       (f) = do_file_open((x), O_READ, 0);                                          \
        assert((f));                                                                 \
        p_argv[0] = file_name((f));                                                  \
        (p) = proc_create((f), p_argv, NULL);                                        \
@@ -71,7 +66,7 @@ char *p_argv[] = {0, 0, 0};
        proc_decref((p));
 
 #define quick_proc_create(x, p, f)                                               \
-       (f) = do_file_open((x), 0, 0);                                               \
+       (f) = do_file_open((x), O_READ, 0);                                          \
        assert((f));                                                                 \
        p_argv[0] = file_name((f));                                                  \
        (p) = proc_create((f), p_argv, NULL);                                        \
@@ -81,7 +76,7 @@ char *p_argv[] = {0, 0, 0};
        spin_unlock(&(p)->proc_lock);
 
 #define quick_proc_color_run(x, p, c, f)                                         \
-       (f) = do_file_open((x), 0, 0);                                               \
+       (f) = do_file_open((x), O_READ, 0);                                          \
        assert((f));                                                                 \
        p_argv[0] = file_name((f));                                                  \
        (p) = proc_create((f), p_argv, NULL);                                        \
@@ -96,7 +91,7 @@ char *p_argv[] = {0, 0, 0};
        proc_decref((p));
 
 #define quick_proc_color_create(x, p, c, f)                                      \
-       (f) = do_file_open((x), 0, 0);                                               \
+       (f) = do_file_open((x), O_READ, 0);                                          \
        assert((f));                                                                 \
        p_argv[0] = file_name((f));                                                  \
        (p) = proc_create((f), p_argv, NULL);                                        \
@@ -113,7 +108,7 @@ void manager_brho(void)
        static bool first = TRUE;
        struct per_cpu_info *pcpui = &per_cpu_info[core_id()];
 
-       if (first) {    
+       if (first) {
                printk("*** IRQs must be enabled for input emergency codes ***\n");
                #ifdef CONFIG_X86
                printk("*** Hit ctrl-g to enter the monitor. ***\n");
@@ -135,7 +130,7 @@ void manager_brho(void)
 
 #if 0 /* ancient tests below: (keeping around til we ditch the manager) */
        // for testing taking cores, check in case 1 for usage
-       uint32_t corelist[MAX_NUM_CPUS];
+       uint32_t corelist[MAX_NUM_CORES];
        uint32_t num = 3;
        struct file *temp_f;
        static struct proc *p;
@@ -181,7 +176,6 @@ void manager_brho(void)
                                spin_unlock(&p->proc_lock);
                                udelay(5000000);
                                printk("Killing p\n");
-                               enable_irq();
                                proc_destroy(p);
                                printk("Killed p\n");
                        panic("This is okay");
@@ -223,7 +217,7 @@ void manager_brho(void)
 }
 
 void manager_jenkins()
-{ 
+{
        #ifdef CONFIG_KERNEL_TESTING
                printk("<-- BEGIN_KERNEL_TESTS -->\n");
                run_registered_ktest_suites();
@@ -236,7 +230,7 @@ void manager_jenkins()
                char exec[] = "/bin/ash";
                char *p_argv[] = {exec, CONFIG_USERSPACE_TESTING_SCRIPT, 0};
 
-               struct file *program = do_file_open(exec, 0, 0);
+               struct file *program = do_file_open(exec, O_READ, 0);
                struct proc *p = proc_create(program, p_argv, NULL);
                proc_wakeup(p);
                proc_decref(p); /* let go of the reference created in proc_create() */
@@ -273,19 +267,19 @@ void manager_waterman()
 {
        static bool first = true;
        if (first)
-               mon_bb(0, 0, 0);
+               mon_shell(0, 0, 0);
        smp_idle();
        assert(0);
 }
 
 void manager_yuzhu()
 {
-       
+
        static uint8_t progress = 0;
        static struct proc *p;
 
        // for testing taking cores, check in case 1 for usage
-       uint32_t corelist[MAX_NUM_CPUS];
+       uint32_t corelist[MAX_NUM_CORES];
        uint32_t num = 3;
 
        //create_server(init_num_cores, loop);