From: Matthias Kruk Date: Tue, 4 Feb 2020 11:21:01 +0000 (+0900) Subject: Fix compiler errors and warnings in lazy scheduler X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=6186b0f252cf5d1f76058a65c00d8ac10e53ef8a;p=corax Fix compiler errors and warnings in lazy scheduler --- diff --git a/kernel/include/sched.h b/kernel/include/sched.h index 2caf701..f4cd417 100644 --- a/kernel/include/sched.h +++ b/kernel/include/sched.h @@ -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); diff --git a/kernel/sched/lazy.c b/kernel/sched/lazy.c index 06a672c..ec45800 100644 --- a/kernel/sched/lazy.c +++ b/kernel/sched/lazy.c @@ -1,5 +1,7 @@ #include +#include #include +#include #include #include #include @@ -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); }