Commit 4bbd88f5 authored by 刘弈成's avatar 刘弈成
Browse files

add syscall fsync

parent a4b349e2
No related merge requests found
Showing with 22 additions and 0 deletions
+22 -0
......@@ -81,6 +81,7 @@
#define SYS_umask 166
#define SYS_readlinkat 78
#define SYS_sync 81
#define SYS_fsync 82
#define SYS_ftruncate 46
#endif
\ No newline at end of file
......@@ -174,6 +174,7 @@ extern uint64 sys_gettid();
extern uint64 sys_umask();
extern uint64 sys_readlinkat();
extern uint64 sys_sync();
extern uint64 sys_fsync();
extern uint64 sys_ftruncate();
static uint64 (*syscalls[])(void) = {
......@@ -253,6 +254,7 @@ static uint64 (*syscalls[])(void) = {
[SYS_umask] sys_umask,
[SYS_readlinkat] sys_readlinkat,
[SYS_sync] sys_sync,
[SYS_fsync] sys_fsync,
[SYS_ftruncate] sys_ftruncate,
};
......@@ -332,6 +334,7 @@ static char *sysnames[] = {
[SYS_umask] "umask",
[SYS_readlinkat] "readlinkat",
[SYS_sync] "sync",
[SYS_fsync] "fsync",
[SYS_ftruncate] "ftruncate",
};
......
......@@ -1342,7 +1342,25 @@ sys_sync(void)
return 0;
}
uint64
sys_fsync(void)
{
return 0;
}
uint64
sys_ftruncate(void)
{
struct file *fp;
int len, fd;
if (argfd(0,&fd,&fp) < 0 && fd != AT_FDCWD)
return -24; // 打开文件太多
if (argint(1, &len) < 0)
{
return -1;
}
return 0;
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment