diff --git a/include/l4/api/thread.h b/include/l4/api/thread.h index f622c26..4d2761c 100644 --- a/include/l4/api/thread.h +++ b/include/l4/api/thread.h @@ -20,5 +20,6 @@ #define THREAD_RUN 0x0001 #define THREAD_SUSPEND 0x0002 #define THREAD_RESUME 0x0003 +#define THREAD_DESTROY 0x0004 #endif /* __THREAD_H__ */ diff --git a/src/lib/wait.c b/src/lib/wait.c index e76c817..6e52ece 100644 --- a/src/lib/wait.c +++ b/src/lib/wait.c @@ -37,6 +37,7 @@ do { \ spin_unlock(&wqh->slock); \ } while(0); +/* FIXME: Wake up should take the task as an argument, rather than the queue */ /* Wake up single waiter */ void wake_up(struct waitqueue_head *wqh) { diff --git a/tasks/fs0/src/task.c b/tasks/fs0/src/task.c index 291cd7d..ca3f9fb 100644 --- a/tasks/fs0/src/task.c +++ b/tasks/fs0/src/task.c @@ -151,7 +151,7 @@ int pager_notify_fork(struct tcb *sender, l4id_t parid, id_pool_copy(child->fdpool, parent->fdpool, TASK_FILES_MAX); memcpy(child->fd, parent->fd, TASK_FILES_MAX * sizeof(int)); - printf("%s/%s: Exiting...\n", __TASKNAME__, __FUNCTION__); + // printf("%s/%s: Exiting...\n", __TASKNAME__, __FUNCTION__); return 0; } diff --git a/tasks/libl4/include/l4lib/ipcdefs.h b/tasks/libl4/include/l4lib/ipcdefs.h index ec3c725..07ea035 100644 --- a/tasks/libl4/include/l4lib/ipcdefs.h +++ b/tasks/libl4/include/l4lib/ipcdefs.h @@ -59,5 +59,6 @@ #define L4_IPC_TAG_PAGER_CLOSE 44 /* Pager notifies vfs of file close */ #define L4_IPC_TAG_PAGER_UPDATE_STATS 45 /* Pager updates file stats in vfs */ #define L4_IPC_TAG_NOTIFY_FORK 46 /* Pager notifies vfs of process fork */ +#define L4_IPC_TAG_NOTIFY_EXIT 46 /* Pager notifies vfs of process exit */ #endif /* __IPCDEFS_H__ */ diff --git a/tasks/mm0/include/syscalls.h b/tasks/mm0/include/syscalls.h index 2f8bb02..6d17e06 100644 --- a/tasks/mm0/include/syscalls.h +++ b/tasks/mm0/include/syscalls.h @@ -46,6 +46,7 @@ struct sys_shmget_args { int sys_shmget(key_t key, int size, int shmflg); int sys_fork(struct tcb *parent); +void sys_exit(struct tcb *task, int status); #endif /* __MM0_SYSARGS_H__ */ diff --git a/tasks/mm0/include/utcb.h b/tasks/mm0/include/utcb.h index 6e22eda..fb33e1b 100644 --- a/tasks/mm0/include/utcb.h +++ b/tasks/mm0/include/utcb.h @@ -5,6 +5,7 @@ #include void *utcb_vaddr_new(void); int utcb_pool_init(void); +int utcb_vaddr_del(void *utcb_addr); /* IPC to send utcb address information to tasks */ diff --git a/tasks/mm0/src/clone.c b/tasks/mm0/src/clone.c index 7802cb7..5c54e53 100755 --- a/tasks/mm0/src/clone.c +++ b/tasks/mm0/src/clone.c @@ -105,7 +105,6 @@ int sys_fork(struct tcb *parent) task_add_global(child); /* Start forked child. */ - printf("%s/%s: Starting forked child.\n", __TASKNAME__, __FUNCTION__); l4_thread_control(THREAD_RUN, &ids); /* Return child tid to parent */ diff --git a/tasks/mm0/src/file.c b/tasks/mm0/src/file.c index 5eac94d..8fe63bf 100644 --- a/tasks/mm0/src/file.c +++ b/tasks/mm0/src/file.c @@ -371,13 +371,19 @@ int fsync_common(struct tcb *task, int fd) int err; /* Check fd validity */ + if (fd < 0 || fd > TASK_FILES_MAX) + return -EINVAL; + + /* + * If we don't know about the file, even if it was + * opened by the vfs, it is sure that there's no + * pending IO on it. We simply return. + */ if (!task->files->fd[fd].vmfile) - if ((err = file_open(task, fd)) < 0) - return err; + return 0; /* Finish I/O on file */ - BUG_ON(!(f = task->files->fd[fd].vmfile)); - if ((err = flush_file_pages(f)) < 0) + if ((err = flush_file_pages(task->files->fd[fd].vmfile)) < 0) return err; return 0; diff --git a/tasks/mm0/src/utcb.c b/tasks/mm0/src/utcb.c index 39225d2..d201e54 100644 --- a/tasks/mm0/src/utcb.c +++ b/tasks/mm0/src/utcb.c @@ -33,6 +33,11 @@ void *utcb_vaddr_new(void) return address_new(&utcb_vaddr_pool, 1); } +int utcb_vaddr_del(void *utcb_addr) +{ + return address_del(&utcb_vaddr_pool, utcb_addr, 1); +} + /* * Sends utcb address information to requester task, allocates * an address if it doesn't exist and the requester is asking