From e8d11c2e846ad15b32caacc8a919722b76d00f79 Mon Sep 17 00:00:00 2001 From: kaashoek Date: Tue, 8 Aug 2006 18:07:37 +0000 Subject: mknod,ialloc,iupdate --- syscall.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'syscall.c') diff --git a/syscall.c b/syscall.c index 29ebee8..498078e 100644 --- a/syscall.c +++ b/syscall.c @@ -279,6 +279,41 @@ sys_open(void) return ufd; } +int +sys_mknod(void) +{ + struct proc *cp = curproc[cpu()]; + struct inode *dp, *nip; + uint arg0, arg1, arg2, arg3; + int l; + + if(fetcharg(0, &arg0) < 0 || fetcharg(1, &arg1) < 0 || + fetcharg(2, &arg2) < 0 || fetcharg(3, &arg3) < 0) + return -1; + + if((l = checkstring(arg0)) < 0) + return -1; + + if(l >= DIRSIZ) + return -1; + + dp = iget(rootdev, 1); + + cprintf("root inode type: %d\n", dp->type); + + if (dp->type != T_DIR) + return -1; + + nip = mknod (dp, cp->mem + arg0, (short) arg1, (short) arg2, + (short) arg3); + + if (nip == 0) return -1; + iput(nip); + iput(dp); + + return 0; +} + int sys_exec(void) { @@ -515,6 +550,9 @@ syscall(void) case SYS_open: ret = sys_open(); break; + case SYS_mknod: + ret = sys_mknod(); + break; default: cprintf("unknown sys call %d\n", num); // XXX fault -- cgit v1.2.3