Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GNU/Hurd build fixes #316

Merged
merged 3 commits into from
Jul 21, 2024
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
4 changes: 2 additions & 2 deletions qjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <time.h>
#if defined(__APPLE__)
#include <malloc/malloc.h>
#elif defined(__linux__)
#elif defined(__linux__) || defined(__GLIBC__)
#include <malloc.h>
#elif defined(__FreeBSD__)
#include <malloc_np.h>
Expand Down Expand Up @@ -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 */
Expand Down
8 changes: 6 additions & 2 deletions quickjs-libc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <math.h>
#if defined(__APPLE__)
#include <malloc/malloc.h>
#elif defined(__linux__)
#elif defined(__linux__) || defined(__GLIBC__)
#include <malloc.h>
#elif defined(__FreeBSD__)
#include <malloc_np.h>
Expand Down Expand Up @@ -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 */
Expand Down