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:
Bahadir Balban
2008-04-17 21:47:37 +01:00
parent 58033e7927
commit 73058dc249
3 changed files with 18 additions and 2 deletions

View File

@@ -23,7 +23,6 @@
struct pathdata {
struct list_head list;
struct vnode *vstart;
int root;
};
struct pathcomp {

View File

@@ -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;
}

View File

@@ -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);
}