Skip to content

Commit 98abfe0

Browse files
committed
avoid syscall on openBSD, issue #821 by @blackgnezdo
1 parent d21f60f commit 98abfe0

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/prim/unix/prim.c

+3-6
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ terms of the MIT license. A copy of the license can be found in the file
2727

2828
#include <sys/mman.h> // mmap
2929
#include <unistd.h> // sysconf
30-
30+
#include <fcntl.h> // open, close, read, access
31+
3132
#if defined(__linux__)
3233
#include <features.h>
33-
#include <fcntl.h>
3434
#if defined(__GLIBC__)
3535
#include <linux/mman.h> // linux mmap flags
3636
#else
@@ -51,7 +51,7 @@ terms of the MIT license. A copy of the license can be found in the file
5151
#include <sys/sysctl.h>
5252
#endif
5353

54-
#if !defined(__HAIKU__) && !defined(__APPLE__) && !defined(__CYGWIN__)
54+
#if !defined(__HAIKU__) && !defined(__APPLE__) && !defined(__CYGWIN__) && !defined(__OpenBSD__)
5555
#define MI_HAS_SYSCALL_H
5656
#include <sys/syscall.h>
5757
#endif
@@ -81,8 +81,6 @@ static int mi_prim_access(const char *fpath, int mode) {
8181

8282
#elif (!defined(__APPLE__) || MAC_OS_X_VERSION_MIN_REQUIRED < 1070) // avoid unused warnings on macOS
8383

84-
#include <fcntl.h>
85-
8684
static int mi_prim_open(const char* fpath, int open_flags) {
8785
return open(fpath,open_flags);
8886
}
@@ -761,7 +759,6 @@ bool _mi_prim_random_buf(void* buf, size_t buf_len) {
761759

762760
#include <sys/types.h>
763761
#include <sys/stat.h>
764-
#include <fcntl.h>
765762
#include <errno.h>
766763

767764
bool _mi_prim_random_buf(void* buf, size_t buf_len) {

0 commit comments

Comments
 (0)