File tree 4 files changed +36
-0
lines changed
4 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -285,6 +285,11 @@ __wasi_errno_t __wasi_fd_sync(__wasi_fd_t fd) {
285
285
return __WASI_ERRNO_SUCCESS;
286
286
}
287
287
288
+ int __syscall_fdatasync (int fd) {
289
+ // TODO: Optimize this to avoid unnecessarily flushing unnecessary metadata.
290
+ return __wasi_fd_sync (fd);
291
+ }
292
+
288
293
backend_t wasmfs_get_backend_by_fd (int fd) {
289
294
auto openFile = wasmFS.getFileTable ().locked ().getEntry (fd);
290
295
if (!openFile) {
Original file line number Diff line number Diff line change @@ -11616,6 +11616,11 @@ def test_unistd_create(self):
11616
11616
self .set_setting ('WASMFS' )
11617
11617
self .do_run_in_out_file_test ('wasmfs/wasmfs_create.c' )
11618
11618
11619
+ def test_unistd_fdatasync (self ):
11620
+ # TODO: Remove this test in favor of unistd/misc.c
11621
+ self .set_setting ('WASMFS' )
11622
+ self .do_run_in_out_file_test ('wasmfs/wasmfs_fdatasync.c' )
11623
+
11619
11624
@also_with_wasmfs
11620
11625
def test_unistd_seek (self ):
11621
11626
self .do_run_in_out_file_test ('wasmfs/wasmfs_seek.c' )
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2022 The Emscripten Authors. All rights reserved.
3
+ * Emscripten is available under two separate licenses, the MIT license and the
4
+ * University of Illinois/NCSA Open Source License. Both these licenses can be
5
+ * found in the LICENSE file.
6
+ */
7
+
8
+ #include <assert.h>
9
+ #include <fcntl.h>
10
+ #include <stdio.h>
11
+ #include <sys/stat.h>
12
+ #include <sys/types.h>
13
+ #include <unistd.h>
14
+
15
+ int main () {
16
+ int fd = creat ("foo.txt" , 0777 );
17
+ assert (fd > 0 );
18
+
19
+ int err = fdatasync (fd );
20
+ assert (err == 0 );
21
+
22
+ close (fd );
23
+
24
+ printf ("ok\n" );
25
+ }
Original file line number Diff line number Diff line change
1
+ ok
You can’t perform that action at this time.
0 commit comments