File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
system/lib/libc/musl/include Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change 1616#define _XOPEN_SOURCE 700
1717#endif
1818
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+
1926#if __STDC_VERSION__ >= 199901L
2027#define __restrict restrict
2128#elif !defined(__GNUC__ )
Original file line number Diff line number Diff line change 55 * found in the LICENSE file.
66 */
77
8+ // For LFS functions (e.g. stat64)
9+ #define _GNU_SOURCE 1
10+
811#include <assert.h>
912#include <dirent.h>
1013#include <errno.h>
@@ -60,6 +63,12 @@ void test() {
6063 assert (err == -1 );
6164 assert (errno == ENOENT );
6265
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+
6372 // stat a folder
6473 memset (& s , 0 , sizeof (s ));
6574 err = stat ("folder" , & s );
@@ -208,7 +217,7 @@ void test() {
208217 );
209218
210219 symlink ("folder/file" , "folder/symlinkfile" );
211-
220+
212221 EM_ASM (
213222 var linkStats = FS .lstat ("folder/symlinkfile" );
214223 assert (linkStats .dev == 1 );
@@ -224,7 +233,7 @@ void test() {
224233 assert (linkStats .atime );
225234 assert (linkStats .mtime );
226235 assert (linkStats .ctime );
227-
236+
228237 var ex ;
229238 try {
230239 FS .stat ("nonexistent" );
You can’t perform that action at this time.
0 commit comments