From 60ce2fea72cf5d374bcbd984d08622d8827555e9 Mon Sep 17 00:00:00 2001 From: "Felix Wischke (65278)" Date: Tue, 14 May 2019 15:20:48 +0200 Subject: [PATCH 1/5] {exports,queue}.c: added headers for standard conforming libcs --- src/exports.c | 1 + src/queue.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/exports.c b/src/exports.c index dd6a179..5047a05 100644 --- a/src/exports.c +++ b/src/exports.c @@ -5,6 +5,7 @@ #include #include #include +#include #include "exports.h" #include "utils/config.h" diff --git a/src/queue.c b/src/queue.c index 0d5cc26..e9ebca8 100644 --- a/src/queue.c +++ b/src/queue.c @@ -1,6 +1,7 @@ #include #include #include +#include #include "queue.h" From 163b2b4cb01bbb0383a5b1c1191e5d453b82c981 Mon Sep 17 00:00:00 2001 From: "Felix Wischke (65278)" Date: Wed, 15 May 2019 11:31:33 +0200 Subject: [PATCH 2/5] fixed prctl and endian includes for apple/bsd --- src/exports.c | 2 +- src/utils/endian.h | 15 +++++++++++++++ src/utils/postgres.c | 3 +++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 src/utils/endian.h diff --git a/src/exports.c b/src/exports.c index 5047a05..baf9593 100644 --- a/src/exports.c +++ b/src/exports.c @@ -5,7 +5,6 @@ #include #include #include -#include #include "exports.h" #include "utils/config.h" @@ -13,6 +12,7 @@ #include "utils/logger.h" #include "utils/postgres.h" #include "utils/scalloc.h" +#include "utils/endian.h" typedef struct Needles *Needles; diff --git a/src/utils/endian.h b/src/utils/endian.h new file mode 100644 index 0000000..fd8f45c --- /dev/null +++ b/src/utils/endian.h @@ -0,0 +1,15 @@ +#ifndef _SCHAUFEL_UTILS_ENDIAN_H +#define _SCHAUFEL_UTILS_ENDIAN_H + +#if defined(__linux__) +#include +#elif defined(__APPLE__) +#include +#define htobe32(x) OSSwapHostToBigInt32(x) +#define htobe64(x) OSSwapHostToBigInt64(x) +#elif defined(__FreeBSD__) || defined(__OpenBSD__) \ + || defined(__NetBSD__) || defined(__DragonFly__) +#include +#endif + +#endif diff --git a/src/utils/postgres.c b/src/utils/postgres.c index 4f28dfb..dabc7e4 100644 --- a/src/utils/postgres.c +++ b/src/utils/postgres.c @@ -1,5 +1,8 @@ #include #include +#ifdef __linux__ +#include +#endif #include "utils/logger.h" #include "utils/postgres.h" From 5b88a0090a8f4f26ca29ce4af8001817afa248d6 Mon Sep 17 00:00:00 2001 From: "Felix Wischke (65278)" Date: Wed, 15 May 2019 11:47:43 +0200 Subject: [PATCH 3/5] queue.h: fixed queue_add definition mismatch --- src/queue.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/queue.h b/src/queue.h index 6346879..4c7fcf3 100644 --- a/src/queue.h +++ b/src/queue.h @@ -2,6 +2,7 @@ #define _SCHAUFEL_QUEUE_H_ #include +#include #define MAX_QUEUE_SIZE 100000 @@ -17,7 +18,7 @@ void message_free(Message *msg); typedef struct Queue *Queue; Queue queue_init(); -int queue_add(Queue q, void *data, size_t datalen, long msgtype); +int queue_add(Queue q, void *data, size_t datalen, int64_t msgtype); int queue_get(Queue q, Message msg); long queue_length(Queue q); long queue_added(Queue q); From 78ee0e385dcde6c0c4fe5688d228a401e7137043 Mon Sep 17 00:00:00 2001 From: "Felix Wischke (65278)" Date: Wed, 15 May 2019 16:18:30 +0200 Subject: [PATCH 4/5] Makefile: change standard defines to be more portable --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 446383f..5688226 100644 --- a/Makefile +++ b/Makefile @@ -10,9 +10,9 @@ CC ?= gcc LD = $(CC) CFLAGS += -Wall -Wextra -pedantic CFLAGS += -std=c11 -CFLAGS += -D_POSIX_C_SOURCE=200809L +CFLAGS += -D_XOPEN_SOURCE=700 CFLAGS += -D_SCHAUFEL_VERSION='"$(SCHAUFEL_VERSION)"' -CFLAGS += -D_BSD_SOURCE +CFLAGS += -D_DEFAULT_SOURCE LIB = -lpthread -lhiredis -lrdkafka -lpq -lconfig -ljson-c INC = -Isrc/ From d74718df123ab44fe165da678f550525072a21dc Mon Sep 17 00:00:00 2001 From: "Felix Wischke (65278)" Date: Wed, 15 May 2019 16:40:42 +0200 Subject: [PATCH 5/5] Schaufel 0.6 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5688226..15dfc9b 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ OBJ_BIN_TEST = $(patsubst t/%.c, $(OBJDIR)/%.o, $(TEST_SOURCES)) DOCS = $(patsubst man/%, doc/%.pdf , $(wildcard man/*)) -SCHAUFEL_VERSION ?= 0.5 +SCHAUFEL_VERSION ?= 0.6 all: release