Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,7 @@ int js_exepath(char *buffer, size_t *size) {

return 0;
}
#elif defined(__linux__)
#elif defined(__linux__) || defined(__GNU__)
int js_exepath(char *buffer, size_t *size) {
ssize_t n;

Expand Down
4 changes: 2 additions & 2 deletions cutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ extern "C" {
#endif
#if defined(__APPLE__)
#include <malloc/malloc.h>
#elif defined(__linux__) || defined(__ANDROID__) || defined(__CYGWIN__)
#elif defined(__linux__) || defined(__ANDROID__) || defined(__CYGWIN__) || defined(__GLIBC__)
#include <malloc.h>
#elif defined(__FreeBSD__)
#include <malloc_np.h>
Expand Down Expand Up @@ -586,7 +586,7 @@ static inline size_t js__malloc_usable_size(const void *ptr)
return malloc_size(ptr);
#elif defined(_WIN32)
return _msize((void *)ptr);
#elif defined(__linux__) || defined(__ANDROID__) || defined(__CYGWIN__) || defined(__FreeBSD__)
#elif defined(__linux__) || defined(__ANDROID__) || defined(__CYGWIN__) || defined(__FreeBSD__) || defined(__GLIBC__)
return malloc_usable_size((void *)ptr);
#else
return 0;
Expand Down
18 changes: 10 additions & 8 deletions quickjs-libc.c
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ int js_module_set_import_meta(JSContext *ctx, JSValueConst func_val,
bool use_realpath, bool is_main)
{
JSModuleDef *m;
char buf[PATH_MAX + 16];
char buf[JS__PATH_MAX + 16];
JSValue meta_obj;
JSAtom module_name_atom;
const char *module_name;
Expand Down Expand Up @@ -1321,7 +1321,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);
Expand All @@ -1344,7 +1344,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);
Expand Down Expand Up @@ -2756,7 +2756,7 @@ static JSValue make_string_error(JSContext *ctx,
static JSValue js_os_getcwd(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv)
{
char buf[PATH_MAX];
char buf[JS__PATH_MAX];
int err;

if (!getcwd(buf, sizeof(buf))) {
Expand Down Expand Up @@ -3039,7 +3039,7 @@ static JSValue js_os_realpath(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv)
{
const char *path;
char buf[PATH_MAX], *res;
char buf[JS__PATH_MAX], *res;
int err;

path = JS_ToCString(ctx, argv[0]);
Expand Down Expand Up @@ -3083,7 +3083,7 @@ static JSValue js_os_readlink(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv)
{
const char *path;
char buf[PATH_MAX];
char buf[JS__PATH_MAX];
int err;
ssize_t res;

Expand Down Expand Up @@ -3165,7 +3165,7 @@ static char **build_envp(JSContext *ctx, JSValue obj)
static int my_execvpe(const char *filename, char **argv, char **envp)
{
char *path, *p, *p_next, *p1;
char buf[PATH_MAX];
char buf[JS__PATH_MAX];
size_t filename_len, path_len;
bool eacces_error;

Expand All @@ -3192,7 +3192,7 @@ static int my_execvpe(const char *filename, char **argv, char **envp)
path_len = p1 - p;
}
/* path too long */
if ((path_len + 1 + filename_len + 1) > PATH_MAX)
if ((path_len + 1 + filename_len + 1) > JS__PATH_MAX)
continue;
memcpy(buf, p, path_len);
buf[path_len] = '/';
Expand Down Expand Up @@ -4029,6 +4029,8 @@ void js_std_set_worker_new_context_func(JSContext *(*func)(JSRuntime *rt))
#define OS_PLATFORM "freebsd"
#elif defined(__wasi__)
#define OS_PLATFORM "wasi"
#elif defined(__GNU__)
#define OS_PLATFORM "hurd"
#else
#define OS_PLATFORM "unknown"
#endif
Expand Down
Loading