summaryrefslogtreecommitdiff
path: root/sysfile.c
diff options
context:
space:
mode:
authorrsc <rsc>2007-08-24 22:17:54 +0000
committerrsc <rsc>2007-08-24 22:17:54 +0000
commit8d2e9a4867c21f1ff84b78cd82f386394d768b3a (patch)
treedfd1fe01a481434fa247d6ad587a05f5b80dd7ae /sysfile.c
parentd7b44dbcfc6c0eec97c60832409f75fc64444d1d (diff)
downloadxv6-labs-8d2e9a4867c21f1ff84b78cd82f386394d768b3a.tar.gz
xv6-labs-8d2e9a4867c21f1ff84b78cd82f386394d768b3a.tar.bz2
xv6-labs-8d2e9a4867c21f1ff84b78cd82f386394d768b3a.zip
shuffle for formatting
Diffstat (limited to 'sysfile.c')
-rw-r--r--sysfile.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/sysfile.c b/sysfile.c
index e05defe..1182e17 100644
--- a/sysfile.c
+++ b/sysfile.c
@@ -74,14 +74,17 @@ sys_write(void)
}
int
-sys_fstat(void)
+sys_dup(void)
{
struct file *f;
- struct stat *st;
+ int fd;
- if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0)
+ if(argfd(0, 0, &f) < 0)
return -1;
- return filestat(f, st);
+ if((fd=fdalloc(f)) < 0)
+ return -1;
+ fileincref(f);
+ return fd;
}
int
@@ -97,6 +100,17 @@ sys_close(void)
return 0;
}
+int
+sys_fstat(void)
+{
+ struct file *f;
+ struct stat *st;
+
+ if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0)
+ return -1;
+ return filestat(f, st);
+}
+
// Create the path new as a link to the same inode as old.
int
sys_link(void)
@@ -152,6 +166,7 @@ isdirempty(struct inode *dp)
return 1;
}
+//PAGEBREAK!
int
sys_unlink(void)
{
@@ -345,20 +360,6 @@ sys_chdir(void)
}
int
-sys_dup(void)
-{
- struct file *f;
- int fd;
-
- if(argfd(0, 0, &f) < 0)
- return -1;
- if((fd=fdalloc(f)) < 0)
- return -1;
- fileincref(f);
- return fd;
-}
-
-int
sys_exec(void)
{
char *path, *argv[20];