summaryrefslogtreecommitdiff
path: root/syscall.c
diff options
context:
space:
mode:
Diffstat (limited to 'syscall.c')
-rw-r--r--syscall.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/syscall.c b/syscall.c
index eb7ecf3..685fa46 100644
--- a/syscall.c
+++ b/syscall.c
@@ -331,6 +331,30 @@ sys_mknod(void)
}
int
+sys_unlink(void)
+{
+ struct proc *cp = curproc[cpu()];
+ struct inode *ip;
+ uint arg0;
+
+ if(fetcharg(0, &arg0) < 0)
+ return -1;
+
+ if(checkstring(arg0) < 0)
+ return -1;
+
+ ip = namei(cp->mem + arg0);
+ ip->nlink--;
+ if (ip->nlink <= 0) {
+ panic("sys_link: unimplemented\n");
+ }
+ iupdate(ip);
+ iput(ip);
+
+ return 0;
+}
+
+int
sys_exec(void)
{
struct proc *cp = curproc[cpu()];
@@ -561,6 +585,9 @@ syscall(void)
case SYS_mknod:
ret = sys_mknod();
break;
+ case SYS_unlink:
+ ret = sys_unlink();
+ break;
default:
cprintf("unknown sys call %d\n", num);
// XXX fault