mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 10:53:16 +01:00
Added sys_close() but its not done yet.
close() needs to flush dirty buffers. pager needs to have read/write support properly implemented. open() needs to record mode and access times. The need for access times means we need rtc and time implementation. Also need to add stat() access() etc.
This commit is contained in:
@@ -23,7 +23,6 @@
|
||||
struct pathdata {
|
||||
struct list_head list;
|
||||
struct vnode *vstart;
|
||||
int root;
|
||||
};
|
||||
|
||||
struct pathcomp {
|
||||
|
||||
@@ -136,6 +136,23 @@ int sys_open(l4id_t sender, const char *pathname, int flags, unsigned int mode)
|
||||
|
||||
int sys_close(l4id_t sender, int fd)
|
||||
{
|
||||
struct tcb *task;
|
||||
|
||||
/* Get the task */
|
||||
BUG_ON(!(task = find_task(sender)));
|
||||
|
||||
/* Validate file descriptor */
|
||||
if (fd < 0 || fd > TASK_OFILES_MAX) {
|
||||
l4_ipc_return(-EBADF);
|
||||
return 0;
|
||||
}
|
||||
if (!task->fd[fd]) {
|
||||
l4_ipc_return(-EBADF);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Finish I/O on file */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ struct vnode *vfs_lookup_bypath(struct pathdata *pdata)
|
||||
* This does vfs cache + fs lookup.
|
||||
*/
|
||||
BUG_ON(list_empty(&pdata->list));
|
||||
firstcomp = pathdata_next_component(pdata);
|
||||
firstcomp = pathdata_next_component(pdata);
|
||||
return pdata->vstart->ops.lookup(pdata->vstart, pdata, firstcomp);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user