diff options
author | kaashoek <kaashoek> | 2006-08-23 01:09:24 +0000 |
---|---|---|
committer | kaashoek <kaashoek> | 2006-08-23 01:09:24 +0000 |
commit | 8b58e81077abf4e843873f16c03077e2fafce52d (patch) | |
tree | 9613a801fc9b3421ee79725782e3ef9bb4650574 /syscall.c | |
parent | f18ab5c04e5380e0fb27f63e8335e5d621315c1d (diff) | |
download | xv6-labs-8b58e81077abf4e843873f16c03077e2fafce52d.tar.gz xv6-labs-8b58e81077abf4e843873f16c03077e2fafce52d.tar.bz2 xv6-labs-8b58e81077abf4e843873f16c03077e2fafce52d.zip |
i/o redirection in sh
better parsing of sh commands (copied from jos sh)
cat: read from 1 if no args
sbrk system call, but untested
getpid system call
moved locks in keyboard intr, but why do we get intr w. null characters from keyboard?
Diffstat (limited to 'syscall.c')
-rw-r--r-- | syscall.c | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -140,6 +140,7 @@ sys_write(void) return -1; if(addr + n > p->sz) return -1; + ret = fd_write(p->fds[fd], p->mem + addr, n); return ret; } @@ -421,6 +422,7 @@ sys_dup(void) fd_close(fd1); return -1; } + cp->fds[ufd1] = fd1; fd1->type = cp->fds[fd]->type; fd1->readable = cp->fds[fd]->readable; fd1->writeable = cp->fds[fd]->writeable; @@ -450,6 +452,27 @@ sys_link(void) } int +sys_getpid(void) +{ + struct proc *cp = curproc[cpu()]; + return cp->pid; +} + + +int +sys_sbrk(void) +{ + int r, n; + struct proc *cp = curproc[cpu()]; + + if(fetcharg(0, &n) < 0) + return -1; + r = growproc(n); + setupsegs(cp); + return r; +} + +int sys_exec(void) { struct proc *cp = curproc[cpu()]; @@ -638,6 +661,12 @@ syscall(void) case SYS_dup: ret = sys_dup(); break; + case SYS_getpid: + ret = sys_getpid(); + break; + case SYS_sbrk: + ret = sys_sbrk(); + break; default: cprintf("unknown sys call %d\n", num); // XXX fault |