File tree 2 files changed +18
-2
lines changed
system/lib/libc/musl/include
2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change 16
16
#define _XOPEN_SOURCE 700
17
17
#endif
18
18
19
+ #if defined(__EMSCRIPTEN__ ) && defined(_GNU_SOURCE )
20
+ // In emscripten the LFS functions are kept around when _GNU_SOURCE is
21
+ // defined, for increased compatabiliy. This is also what glibc does.
22
+ #undef _LARGEFILE64_SOURCE
23
+ #define _LARGEFILE64_SOURCE 1
24
+ #endif
25
+
19
26
#if __STDC_VERSION__ >= 199901L
20
27
#define __restrict restrict
21
28
#elif !defined(__GNUC__ )
Original file line number Diff line number Diff line change 5
5
* found in the LICENSE file.
6
6
*/
7
7
8
+ // For LFS functions (e.g. stat64)
9
+ #define _GNU_SOURCE 1
10
+
8
11
#include <assert.h>
9
12
#include <dirent.h>
10
13
#include <errno.h>
@@ -60,6 +63,12 @@ void test() {
60
63
assert (err == -1 );
61
64
assert (errno == ENOENT );
62
65
66
+ // test stat64 LFS functions
67
+ struct stat64 s64 ;
68
+ err = stat ("does_not_exist" , & s64 );
69
+ assert (err == -1 );
70
+ assert (errno == ENOENT );
71
+
63
72
// stat a folder
64
73
memset (& s , 0 , sizeof (s ));
65
74
err = stat ("folder" , & s );
@@ -208,7 +217,7 @@ void test() {
208
217
);
209
218
210
219
symlink ("folder/file" , "folder/symlinkfile" );
211
-
220
+
212
221
EM_ASM (
213
222
var linkStats = FS .lstat ("folder/symlinkfile" );
214
223
assert (linkStats .dev == 1 );
@@ -224,7 +233,7 @@ void test() {
224
233
assert (linkStats .atime );
225
234
assert (linkStats .mtime );
226
235
assert (linkStats .ctime );
227
-
236
+
228
237
var ex ;
229
238
try {
230
239
FS .stat ("nonexistent" );
You can’t perform that action at this time.
0 commit comments