diff --git a/qjs.c b/qjs.c index 033289598..7103e11de 100644 --- a/qjs.c +++ b/qjs.c @@ -34,7 +34,7 @@ #include #if defined(__APPLE__) #include -#elif defined(__linux__) +#elif defined(__linux__) || defined(__GLIBC__) #include #elif defined(__FreeBSD__) #include @@ -151,7 +151,7 @@ static size_t js_trace_malloc_usable_size(const void *ptr) return _msize((void *)ptr); #elif defined(EMSCRIPTEN) return 0; -#elif defined(__linux__) +#elif defined(__linux__) || defined(__GLIBC__) return malloc_usable_size((void *)ptr); #else /* change this to `return 0;` if compilation fails */ diff --git a/quickjs-libc.c b/quickjs-libc.c index 81371507f..141f79f3c 100644 --- a/quickjs-libc.c +++ b/quickjs-libc.c @@ -78,6 +78,10 @@ typedef sig_t sighandler_t; #include "list.h" #include "quickjs-libc.h" +#if !defined(PATH_MAX) +#define PATH_MAX 4096 +#endif + /* TODO: - add socket calls */ @@ -1090,7 +1094,7 @@ static JSValue js_std_file_tell(JSContext *ctx, JSValueConst this_val, int64_t pos; if (!f) return JS_EXCEPTION; -#if defined(__linux__) +#if defined(__linux__) || defined(__GLIBC__) pos = ftello(f); #else pos = ftell(f); @@ -1113,7 +1117,7 @@ static JSValue js_std_file_seek(JSContext *ctx, JSValueConst this_val, return JS_EXCEPTION; if (JS_ToInt32(ctx, &whence, argv[1])) return JS_EXCEPTION; -#if defined(__linux__) +#if defined(__linux__) || defined(__GLIBC__) ret = fseeko(f, pos, whence); #else ret = fseek(f, pos, whence); diff --git a/quickjs.c b/quickjs.c index 3cb264390..642ae3429 100644 --- a/quickjs.c +++ b/quickjs.c @@ -34,7 +34,7 @@ #include #if defined(__APPLE__) #include -#elif defined(__linux__) +#elif defined(__linux__) || defined(__GLIBC__) #include #elif defined(__FreeBSD__) #include @@ -1708,7 +1708,7 @@ static size_t js_def_malloc_usable_size(const void *ptr) return _msize((void *)ptr); #elif defined(EMSCRIPTEN) return 0; -#elif defined(__linux__) +#elif defined(__linux__) || defined(__GLIBC__) return malloc_usable_size((void *)ptr); #else /* change this to `return 0;` if compilation fails */