Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use sysconfdir & localstatedir for conf/pid/logs #123

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Makefile.am
@@ -1,4 +1,11 @@
MAINTAINERCLEANFILES = Makefile.in
BUILT_SOURCES = cfg-options.h
CLEANFILES = cfg-options.h

cfg-options.h: Makefile
$(AM_V_GEN)echo '#define NC_CONF_PATH "$(sysconfdir)/nutcracker/nutcracker.yml"' >$@
@echo '#define NC_LOG_PATH "$(localstatedir)/log/nutcracker/nutcracker.log"' >>$@
@echo '#define NC_PID_FILE "$(localstatedir)/run/nutcracker/nutcracker.pid"' >>$@

AM_CPPFLAGS = -D_GNU_SOURCE -D_XOPEN_SOURCE
AM_CPPFLAGS += -I $(top_srcdir)/src/hashkit
Expand Down
7 changes: 2 additions & 5 deletions src/nc.c
Expand Up @@ -27,19 +27,16 @@
#include <nc_conf.h>
#include <nc_signal.h>

#define NC_CONF_PATH "conf/nutcracker.yml"
#include "cfg-options.h"

#define NC_LOG_DEFAULT LOG_NOTICE
#define NC_LOG_MIN LOG_EMERG
#define NC_LOG_MAX LOG_PVERB
#define NC_LOG_PATH NULL

#define NC_STATS_PORT STATS_PORT
#define NC_STATS_ADDR STATS_ADDR
#define NC_STATS_INTERVAL STATS_INTERVAL

#define NC_PID_FILE NULL

#define NC_MBUF_SIZE MBUF_SIZE
#define NC_MBUF_MIN_SIZE MBUF_MIN_SIZE
#define NC_MBUF_MAX_SIZE MBUF_MAX_SIZE
Expand Down Expand Up @@ -287,7 +284,7 @@ nc_set_default_options(struct instance *nci)
nci->mbuf_chunk_size = NC_MBUF_SIZE;

nci->pid = (pid_t)-1;
nci->pid_filename = NULL;
nci->pid_filename = NC_PID_FILE;
nci->pidfile = 0;
}

Expand Down