Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
AVX
OSKernel2023-AVX
Commits
4bbd88f5
Commit
4bbd88f5
authored
1 year ago
by
刘弈成
Browse files
Options
Download
Patches
Plain Diff
add syscall fsync
parent
a4b349e2
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
kernel/include/sysnum.h
+1
-0
kernel/include/sysnum.h
kernel/syscall.c
+3
-0
kernel/syscall.c
kernel/sysfile.c
+18
-0
kernel/sysfile.c
with
22 additions
and
0 deletions
+22
-0
kernel/include/sysnum.h
+
1
−
0
View file @
4bbd88f5
...
...
@@ -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
This diff is collapsed.
Click to expand it.
kernel/syscall.c
+
3
−
0
View file @
4bbd88f5
...
...
@@ -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"
,
};
...
...
This diff is collapsed.
Click to expand it.
kernel/sysfile.c
+
18
−
0
View file @
4bbd88f5
...
...
@@ -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
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets