Initial changes for execve() support

This commit is contained in:
Bahadir Balban
2008-11-13 21:45:30 +02:00
parent 44c34026b2
commit d182b5b35a
21 changed files with 618 additions and 9 deletions

View File

@@ -15,7 +15,7 @@ int sys_mkdir(struct tcb *sender, const char *pathname, unsigned int mode);
int sys_chdir(struct tcb *sender, const char *pathname);
/* Calls from pager that completes a posix call */
int pager_open_bypath(struct tcb *pager, char *pathname);
int pager_sys_open(struct tcb *sender, l4id_t opener, int fd);
int pager_sys_read(struct tcb *sender, unsigned long vnum, unsigned long f_offset,
unsigned long npages, void *pagebuf);

View File

@@ -98,6 +98,9 @@ void handle_fs_requests(void)
case L4_IPC_TAG_PAGER_OPEN:
ret = pager_sys_open(sender, (l4id_t)mr[0], (int)mr[1]);
break;
case L4_IPC_TAG_PAGER_OPEN_BYPATH:
ret = pager_open_bypath(sender, (char *)mr[0]);
break;
case L4_IPC_TAG_PAGER_WRITE:
ret = pager_sys_write(sender, (unsigned long)mr[0], (unsigned long)mr[1],
(unsigned long)mr[2], (void *)mr[3]);

View File

@@ -64,6 +64,48 @@ int pager_sys_open(struct tcb *pager, l4id_t opener, int fd)
return 0;
}
/* This is called when the pager needs to open a vfs file via its path */
int pager_open_bypath(struct tcb *pager, char *pathname)
{
struct pathdata *pdata;
struct tcb *task;
struct vnode *v;
int retval;
// printf("%s/%s\n", __TASKNAME__, __FUNCTION__);
if (pager->tid != PAGER_TID)
return -EINVAL;
// printf("%s/%s\n", __TASKNAME__, __FUNCTION__);
/* Parse path data */
if (IS_ERR(pdata = pathdata_parse(pathname,
alloca(strlen(pathname) + 1),
task)))
return (int)pdata;
/* Search the vnode by that path */
if (IS_ERR(v = vfs_lookup_bypath(pdata))) {
retval = (int)v;
goto out;
}
/*
* Write file information, they will
* be sent via the return reply.
*/
write_mr(L4SYS_ARG0, v->vnum);
write_mr(L4SYS_ARG1, v->size);
return 0;
out:
pathdata_destroy(pdata);
return retval;
}
/* Directories only for now */
void print_vnode(struct vnode *v)
{