From f971a5d8ed58547f01325611c0189745a904c9cc Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Tue, 29 Sep 2020 13:52:13 +0100 Subject: [PATCH] Add support for Haiku OS (#7435) --- src/Makefile | 7 +++++++ src/config.h | 4 ++++ src/memtest.c | 5 +++++ 3 files changed, 16 insertions(+) diff --git a/src/Makefile b/src/Makefile index 9b8083c06..54dda1ae9 100644 --- a/src/Makefile +++ b/src/Makefile @@ -155,6 +155,12 @@ else ifeq ($(uname_S),NetBSD) # NetBSD FINAL_LIBS+= -lpthread -lexecinfo +else +ifeq ($(uname_S),Haiku) + # Haiku + FINAL_CFLAGS+= -DBSD_SOURCE + FINAL_LDFLAGS+= -lbsd -lnetwork + FINAL_LIBS+= -lpthread else # All the other OSes (notably Linux) FINAL_LDFLAGS+= -rdynamic @@ -168,6 +174,7 @@ endif endif endif endif +endif # Include paths to dependencies FINAL_CFLAGS+= -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src -I../deps/hdr_histogram diff --git a/src/config.h b/src/config.h index d391508fa..320837b7e 100644 --- a/src/config.h +++ b/src/config.h @@ -124,6 +124,10 @@ #define USE_SETPROCTITLE #endif +#if defined(__HAIKU__) +#define ESOCKTNOSUPPORT 0 +#endif + #if ((defined __linux && defined(__GLIBC__)) || defined __APPLE__) #define USE_SETPROCTITLE #define INIT_SETPROCTITLE_REPLACEMENT diff --git a/src/memtest.c b/src/memtest.c index a455430f5..cb4d35e83 100644 --- a/src/memtest.c +++ b/src/memtest.c @@ -347,10 +347,15 @@ void memtest_alloc_and_test(size_t megabytes, int passes) { } void memtest(size_t megabytes, int passes) { +#if !defined(__HAIKU__) if (ioctl(1, TIOCGWINSZ, &ws) == -1) { ws.ws_col = 80; ws.ws_row = 20; } +#else + ws.ws_col = 80; + ws.ws_row = 20; +#endif memtest_alloc_and_test(megabytes,passes); printf("\nYour memory passed this test.\n"); printf("Please if you are still in doubt use the following two tools:\n");