File tree Expand file tree Collapse file tree 5 files changed +30
-23
lines changed Expand file tree Collapse file tree 5 files changed +30
-23
lines changed Original file line number Diff line number Diff line change @@ -386,3 +386,18 @@ jobs:
386
386
run : |
387
387
cd $GITHUB_WORKSPACE
388
388
make --debug test
389
+
390
+ openbsd :
391
+ runs-on : ubuntu-latest
392
+ steps :
393
+ - uses : actions/checkout@v3
394
+ - name : build + test
395
+ uses : vmactions/openbsd-vm@v1
396
+ with :
397
+ usesh : true
398
+ prepare : |
399
+ pkg_add cmake
400
+ run : |
401
+ cmake -B build
402
+ cmake --build build -j $(sysctl -n hw.ncpu)
403
+ ./build/qjs -qd
Original file line number Diff line number Diff line change @@ -145,10 +145,7 @@ if(BUILD_QJS_LIBC)
145
145
list (APPEND qjs_sources quickjs-libc.c )
146
146
endif ()
147
147
list (APPEND qjs_defines _GNU_SOURCE )
148
- list (APPEND qjs_libs qjs )
149
- if (NOT WIN32 )
150
- list (APPEND qjs_libs dl )
151
- endif ()
148
+ list (APPEND qjs_libs qjs ${CMAKE_DL_LIBS} )
152
149
if (NOT MSVC )
153
150
list (APPEND qjs_libs m pthread )
154
151
endif ()
Original file line number Diff line number Diff line change @@ -135,13 +135,10 @@ static inline size_t js_trace_malloc_usable_size(void *ptr)
135
135
return malloc_size (ptr );
136
136
#elif defined(_WIN32 )
137
137
return _msize (ptr );
138
- #elif defined(EMSCRIPTEN )
139
- return 0 ;
140
138
#elif defined(__linux__ )
141
139
return malloc_usable_size (ptr );
142
140
#else
143
- /* change this to `return 0;` if compilation fails */
144
- return malloc_usable_size (ptr );
141
+ return 0 ;
145
142
#endif
146
143
}
147
144
@@ -257,13 +254,10 @@ static const JSMallocFunctions trace_mf = {
257
254
malloc_size ,
258
255
#elif defined(_WIN32 )
259
256
(size_t (* )(const void * ))_msize ,
260
- #elif defined(EMSCRIPTEN )
261
- NULL ,
262
257
#elif defined(__linux__ ) || defined (__CYGWIN__ )
263
258
(size_t (* )(const void * ))malloc_usable_size ,
264
259
#else
265
- /* change this to `NULL,` if compilation fails */
266
- malloc_usable_size ,
260
+ NULL ,
267
261
#endif
268
262
};
269
263
Original file line number Diff line number Diff line change @@ -73,12 +73,15 @@ typedef sig_t sighandler_t;
73
73
#endif
74
74
#endif /* __APPLE__ */
75
75
76
+ #if defined(__OpenBSD__ )
77
+ typedef sig_t sighandler_t ;
78
+ extern char * * environ ;
76
79
#endif
77
80
78
- #if !defined(_WIN32 )
79
81
/* enable the os.Worker API. IT relies on POSIX threads */
80
82
#define USE_WORKER
81
- #endif
83
+
84
+ #endif /* _WIN32 */
82
85
83
86
#ifdef USE_WORKER
84
87
#include <pthread.h>
@@ -3584,8 +3587,12 @@ void js_std_set_worker_new_context_func(JSContext *(*func)(JSRuntime *rt))
3584
3587
#define OS_PLATFORM "js"
3585
3588
#elif defined(__CYGWIN__ )
3586
3589
#define OS_PLATFORM "cygwin"
3587
- #else
3590
+ #elif defined( __linux__ )
3588
3591
#define OS_PLATFORM "linux"
3592
+ #elif defined(__OpenBSD__ )
3593
+ #define OS_PLATFORM "openbsd"
3594
+ #else
3595
+ #define OS_PLATFORM "unknown"
3589
3596
#endif
3590
3597
3591
3598
#define OS_FLAG (x ) JS_PROP_INT32_DEF(#x, x, JS_PROP_CONFIGURABLE )
Original file line number Diff line number Diff line change @@ -1646,13 +1646,10 @@ static inline size_t js_def_malloc_usable_size(void *ptr)
1646
1646
return malloc_size(ptr);
1647
1647
#elif defined(_WIN32)
1648
1648
return _msize(ptr);
1649
- #elif defined(EMSCRIPTEN)
1650
- return 0;
1651
1649
#elif defined(__linux__)
1652
1650
return malloc_usable_size(ptr);
1653
1651
#else
1654
- /* change this to `return 0;` if compilation fails */
1655
- return malloc_usable_size(ptr);
1652
+ return 0;
1656
1653
#endif
1657
1654
}
1658
1655
@@ -1720,13 +1717,10 @@ static const JSMallocFunctions def_malloc_funcs = {
1720
1717
malloc_size,
1721
1718
#elif defined(_WIN32)
1722
1719
(size_t (*)(const void *))_msize,
1723
- #elif defined(EMSCRIPTEN)
1724
- NULL,
1725
1720
#elif defined(__linux__) || defined (__CYGWIN__)
1726
1721
(size_t (*)(const void *))malloc_usable_size,
1727
1722
#else
1728
- /* change this to `NULL,` if compilation fails */
1729
- malloc_usable_size,
1723
+ NULL,
1730
1724
#endif
1731
1725
};
1732
1726
You can’t perform that action at this time.
0 commit comments