shuffle for formatting
This commit is contained in:
parent
d7b44dbcfc
commit
8d2e9a4867
2 changed files with 37 additions and 30 deletions
37
sysfile.c
37
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)
|
||||
{
|
||||
|
|
@ -344,20 +359,6 @@ sys_chdir(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue