Commit d4b1e13b authored by Jordan Sissel's avatar Jordan Sissel

Move sleep min/max defs to a header

parent d3375db7
...@@ -49,39 +49,40 @@ rpm deb: | build-all ...@@ -49,39 +49,40 @@ rpm deb: | build-all
# install -d -m 755 build/bin/* $(PREFIX)/bin/lumberjack # install -d -m 755 build/bin/* $(PREFIX)/bin/lumberjack
# install -d build/lib/* $(PREFIX)/lib # install -d build/lib/* $(PREFIX)/lib
backoff.c: backoff.h backoff.o: backoff.c backoff.h
harvester.c: harvester.h proto.h str.h harvester.o: harvester.c harvester.h proto.h str.h sleepdefs.h
emitter.c: emitter.h ring.h emitter.o: emitter.c emitter.h ring.h sleepdefs.h
lumberjack.c: backoff.h harvester.h emitter.h lumberjack.o: lumberjack.c backoff.h harvester.h emitter.h
str.c: str.h str.o: str.c str.h
proto.c: proto.h str.h proto.o: proto.c proto.h str.h sleepdefs.h
ring.c: ring.h ring.o: ring.c ring.h
harvester.c: build/include/insist.h
lumberjack.c: build/include/insist.h harvester.o: build/include/insist.h
lumberjack.o: build/include/insist.h
# Vendor'd dependencies # Vendor'd dependencies
# If VENDOR contains 'zeromq' download and build it. # If VENDOR contains 'zeromq' download and build it.
ifeq ($(filter zeromq,$(VENDOR)),zeromq) ifeq ($(filter zeromq,$(VENDOR)),zeromq)
emitter.c: build/include/zmq.h emitter.o: build/include/zmq.h
harvester.c: build/include/zmq.h harvester.o: build/include/zmq.h
lumberjack.c: build/include/zmq.h lumberjack.o: build/include/zmq.h
build/bin/lumberjack: | build/bin build/lib/libzmq.$(LIBEXT) build/bin/lumberjack: | build/bin build/lib/libzmq.$(LIBEXT)
endif # zeromq endif # zeromq
ifeq ($(filter jemalloc,$(VENDOR)),jemalloc) ifeq ($(filter jemalloc,$(VENDOR)),jemalloc)
harvester.c lumberjack.c ring.c str.c: build/include/jemalloc/jemalloc.h harvester.o lumberjack.o ring.o str.o: build/include/jemalloc/jemalloc.h
build/bin/lumberjack: | build/lib/libjemalloc.$(LIBEXT) build/bin/lumberjack: | build/lib/libjemalloc.$(LIBEXT)
endif # jemalloc endif # jemalloc
ifeq ($(filter openssl,$(VENDOR)),openssl) ifeq ($(filter openssl,$(VENDOR)),openssl)
proto.c: build/include/openssl/ssl.h proto.o: build/include/openssl/ssl.h
lumberjack.c: build/include/openssl/ssl.h lumberjack.o: build/include/openssl/ssl.h
build/bin/lumberjack: | build/lib/libssl.$(LIBEXT) build/bin/lumberjack: | build/lib/libssl.$(LIBEXT)
build/bin/lumberjack: | build/lib/libcrypto.$(LIBEXT) build/bin/lumberjack: | build/lib/libcrypto.$(LIBEXT)
endif # openssl endif # openssl
ifeq ($(filter zlib,$(VENDOR)),zlib) ifeq ($(filter zlib,$(VENDOR)),zlib)
proto.c: build/include/zlib.h proto.o: build/include/zlib.h
build/bin/lumberjack: | build/lib/libz.$(LIBEXT) build/bin/lumberjack: | build/lib/libz.$(LIBEXT)
endif # zlib endif # zlib
...@@ -90,13 +91,10 @@ test: | build/test/test_ring ...@@ -90,13 +91,10 @@ test: | build/test/test_ring
build/test/test_ring build/test/test_ring
# Tests # Tests
test_ring.c: ring.h build/include/jemalloc/jemalloc.h build/include/insist.h test_ring.o: ring.h build/include/jemalloc/jemalloc.h build/include/insist.h
build/test/test_ring: test_ring.o ring.o | build/test build/test/test_ring: test_ring.o ring.o | build/test
$(CC) $(LDFLAGS) -o $@ $^ -ljemalloc $(CC) $(LDFLAGS) -o $@ $^ -ljemalloc
proto.o: proto.c
$(CC) $(CFLAGS) -c -o $@ $^
build/bin/lumberjack.sh: lumberjack.sh | build/bin build/bin/lumberjack.sh: lumberjack.sh | build/bin
install -m 755 $^ $@ install -m 755 $^ $@
......
...@@ -12,8 +12,7 @@ ...@@ -12,8 +12,7 @@
#include <sys/resource.h> #include <sys/resource.h>
static struct timespec MIN_SLEEP = { 0, 10000000 }; /* 10ms */ #include "sleepdefs.h"
static struct timespec MAX_SLEEP = { 15, 0 }; /* 15 */
void *emitter(void *arg) { void *emitter(void *arg) {
struct emitter_config *config = arg; struct emitter_config *config = arg;
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "harvester.h" #include "harvester.h"
#include "backoff.h" #include "backoff.h"
#include "insist.h" #include "insist.h"
#include "sleepdefs.h"
#ifdef __MACH__ #ifdef __MACH__
/* OS X is dumb, or I am dumb, or we are both dumb. I don't know anymore, /* OS X is dumb, or I am dumb, or we are both dumb. I don't know anymore,
...@@ -26,9 +27,6 @@ extern int gethostname(char *name, size_t namelen); ...@@ -26,9 +27,6 @@ extern int gethostname(char *name, size_t namelen);
#define EMITTER_SOCKET "inproc://emitter" #define EMITTER_SOCKET "inproc://emitter"
#define BUFFERSIZE 16384 #define BUFFERSIZE 16384
static struct timespec MIN_SLEEP = { 0, 10000000 }; /* 10ms */
static struct timespec MAX_SLEEP = { 15, 0 }; /* 15 */
/* A free function that simply calls free(3) for zmq_msg */ /* A free function that simply calls free(3) for zmq_msg */
//static inline void free2(void *data, void __attribute__((__unused__)) *hint) { //static inline void free2(void *data, void __attribute__((__unused__)) *hint) {
//free(data); //free(data);
......
...@@ -20,8 +20,7 @@ ...@@ -20,8 +20,7 @@
#include "openssl/ssl.h" #include "openssl/ssl.h"
#include "openssl/err.h" #include "openssl/err.h"
static struct timespec MIN_SLEEP = { 0, 10000000 }; /* 10ms */ #include "sleepdefs.h"
static struct timespec MAX_SLEEP = { 15, 0 }; /* 15 */
static void lumberjack_init(void); static void lumberjack_init(void);
static int lumberjack_tcp_connect(struct lumberjack *lumberjack); static int lumberjack_tcp_connect(struct lumberjack *lumberjack);
......
#ifndef _SLEEPDEFS_H_
#define _SLEEPDEFS_H_
static struct timespec MIN_SLEEP = { 0, 10000000 }; /* 10ms */
static struct timespec MAX_SLEEP = { 1, 0 }; /* 15 */
#endif /* _SLEEPDEFS_H_ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment