mirror of
https://github.com/drasko/codezero.git
synced 2026-02-21 06:13:14 +01:00
Multiple updates on sleeping, vma dropping and thread suspend.
- Updated sleeping paths such that a task is atomically put into a runqueue and made RUNNABLE, or removed from a runqueue and made SLEEPING. - Modified vma dropping sources to handle both copy_on_write() and exit() cases in a common function. - Added the first infrastructure to have a pager to suspend a task and wait for suspend completion from the scheduler.
This commit is contained in:
@@ -158,8 +158,11 @@ int do_open(struct tcb *task, int fd, unsigned long vnum, unsigned long length)
|
||||
task->files->fd[fd].vmfile = vmfile;
|
||||
vmfile->openers++;
|
||||
|
||||
/* Add to global list */
|
||||
list_add(&vmfile->vm_obj.list, &vm_file_list);
|
||||
/* Add to file list */
|
||||
list_add(&vmfile->list, &vm_file_list);
|
||||
|
||||
/* Add to object list */
|
||||
list_add(&vmfile->vm_obj.list, &vm_object_list);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -399,7 +402,8 @@ int do_close(struct tcb *task, int fd)
|
||||
return err;
|
||||
|
||||
/* Reduce file's opener count */
|
||||
task->files->fd[fd].vmfile->openers--;
|
||||
if (!(--task->files->fd[fd].vmfile->openers))
|
||||
vm_file_delete(task->files->fd[fd].vmfile);
|
||||
|
||||
task->files->fd[fd].vnum = 0;
|
||||
task->files->fd[fd].cursor = 0;
|
||||
|
||||
Reference in New Issue
Block a user