scheduler: fix newproc() unitialized variable

This commit is contained in:
Matheus
2023-06-12 21:13:33 -03:00
parent f2b76caa84
commit 1256960e78
2 changed files with 7 additions and 4 deletions
+2 -1
View File
@@ -82,6 +82,7 @@ proc_t *sched_newproc();
vnode_t *sched_getcwd();
vnode_t *sched_getroot();
thread_t *sched_newthread(void *ip, size_t kstacksize, int priority, proc_t *proc, void *ustack);
void sched_destroyproc(proc_t *);
void sched_destroythread(thread_t *);
#endif
+5 -3
View File
@@ -40,7 +40,9 @@ proc_t *sched_newproc() {
slab_free(processcache, proc);
return NULL;
}
// TODO move this to slab
proc->state = SCHED_PROC_STATE_NORMAL;
proc->threadtablesize = 1;
proc->runningthreadcount = 1;
SPINLOCK_INIT(proc->lock);
@@ -97,9 +99,9 @@ void sched_destroythread(thread_t *thread) {
}
void sched_destroyproc(proc_t *proc) {
//free(proc->threads);
//free(proc->fd);
//slab_free(processcache, proc);
free(proc->threads);
free(proc->fd);
slab_free(processcache, proc);
}
static thread_t *runqueuenext(int minprio) {