]> git.corax.cc Git - corax/commitdiff
Fix compiler errors and warnings in lazy scheduler
authorMatthias Kruk <m@m10k.eu>
Tue, 4 Feb 2020 11:21:01 +0000 (20:21 +0900)
committerMatthias Kruk <m@m10k.eu>
Tue, 4 Feb 2020 11:21:01 +0000 (20:21 +0900)
kernel/include/sched.h
kernel/sched/lazy.c

index 2caf701133ae19c494380d348811b58812493e05..f4cd4175e5c6ac5a1d7dd8c1725dab25f1a22917 100644 (file)
@@ -13,7 +13,7 @@ typedef enum {
 } sched_task_state_t;
 
 struct sched {
-       void (*tick)(struct sched*);
+       int (*tick)(struct sched*);
 
        int (*sleep)(struct sched*, struct task*);
        int (*wakeup)(struct sched*, struct task*, int);
index 06a672cf7c32dc5ae3b1445c5b771f56d28b72a3..ec45800c9e4bdb7f2a57783b495623e48bf2cde9 100644 (file)
@@ -1,5 +1,7 @@
 #include <config.h>
+#include <corax/types.h>
 #include <corax/errno.h>
+#include <corax/heap.h>
 #include <arch.h>
 #include <sched.h>
 #include <kq.h>
@@ -100,8 +102,8 @@ static int _lazy_sleep(struct sched_lazy *lazy, struct task *task)
 
        task_lock(task);
 
-       if(t->t_state != TASK_STATE_WAITING) {
-               t->t_state = TASK_STATE_WAITING;
+       if(task->t_state != TASK_STATE_WAITING) {
+               task->t_state = TASK_STATE_WAITING;
                ret_val = 0;
        }
 
@@ -138,8 +140,8 @@ static int _lazy_wakeup(struct sched_lazy *lazy, struct task *task, int flags)
        task_lock(task);
 
        /* don't resume tasks that aren't waiting to be resumed */
-       if(t->t_state == TASK_STATE_WAITING) {
-               t->t_state = flags ? TASK_STATE_SIGNAL : TASK_STATE_READY;
+       if(task->t_state == TASK_STATE_WAITING) {
+               task->t_state = flags ? TASK_STATE_SIGNAL : TASK_STATE_READY;
                ret_val = 0;
        } else {
                ret_val = -EBUSY;
@@ -151,7 +153,7 @@ static int _lazy_wakeup(struct sched_lazy *lazy, struct task *task, int flags)
        if(!ret_val) {
                _LOCK(lazy);
 
-               ret_val = kq_rm(&(lazy->waitq, task));
+               ret_val = kq_rm(&(lazy->waitq), task);
 
                /* don't enqueue the task if it wasn't on the wait queue */
                if(!ret_val) {
@@ -222,7 +224,7 @@ int sched_lazy_init(struct sched **sch)
        sched = kmalloc(sizeof(*sched));
 
        if(sched) {
-               sched->parent.tick = (void(*)(struct sched*))_lazy_tick;
+               sched->parent.tick = (int(*)(struct sched*))_lazy_tick;
                sched->parent.sleep = (int(*)(struct sched*, struct task*))_lazy_sleep;
                sched->parent.wakeup = (int(*)(struct sched*, struct task*, int))_lazy_wakeup;
                sched->parent.schedule = (int(*)(struct sched*, struct task*))_lazy_schedule;
@@ -238,5 +240,5 @@ int sched_lazy_init(struct sched **sch)
 
 int sched_lazy_free(struct sched *sched, struct sched *other)
 {
-
+       return(-ENOSYS);
 }