Commit d4e9b175 authored by Geoff Simmons's avatar Geoff Simmons

Properly declare global variables.

Declared in C sources, and as extern in header files. This had always
been invalid, but earlier version of the compiler appear to have
forgiven it.
parent 87c58fd4
...@@ -94,7 +94,9 @@ ...@@ -94,7 +94,9 @@
#define MAX_IDLE_PAUSE 0.01 #define MAX_IDLE_PAUSE 0.01
const char *version = PACKAGE_TARNAME "-" PACKAGE_VERSION " revision " \ char cli_config_filename[PATH_MAX + 1];
const char *version = PACKAGE_TARNAME "-" PACKAGE_VERSION " revision " \
VCS_Version " branch " VCS_Branch; VCS_Version " branch " VCS_Branch;
static unsigned len_hi = 0, debug = 0, data_exhausted = 0, restart = 0; static unsigned len_hi = 0, debug = 0, data_exhausted = 0, restart = 0;
......
...@@ -50,6 +50,8 @@ ...@@ -50,6 +50,8 @@
#define DEFAULT_USER "nobody" #define DEFAULT_USER "nobody"
struct config config;
static const int facilitynum[8] = static const int facilitynum[8] =
{ LOG_LOCAL0, LOG_LOCAL1, LOG_LOCAL2, LOG_LOCAL3, LOG_LOCAL4, LOG_LOCAL5, { LOG_LOCAL0, LOG_LOCAL1, LOG_LOCAL2, LOG_LOCAL3, LOG_LOCAL4, LOG_LOCAL5,
LOG_LOCAL6, LOG_LOCAL7 }; LOG_LOCAL6, LOG_LOCAL7 };
......
...@@ -55,6 +55,13 @@ ...@@ -55,6 +55,13 @@
VSTAILQ_INIT((head2)); \ VSTAILQ_INIT((head2)); \
} while (0) } while (0)
unsigned global_nfree_rec, global_nfree_chunk;
struct rechead_s freerechead;
chunkhead_t freechunkhead;
dataentry *entrytbl;
chunk_t *chunktbl;
static pthread_mutex_t freerec_lock, freechunk_lock; static pthread_mutex_t freerec_lock, freechunk_lock;
static char *buf, *keybuf; static char *buf, *keybuf;
......
...@@ -31,9 +31,9 @@ ...@@ -31,9 +31,9 @@
*/ */
/* Heads of the global free lists */ /* Heads of the global free lists */
struct rechead_s freerechead; extern struct rechead_s freerechead;
chunkhead_t freechunkhead; extern chunkhead_t freechunkhead;
/* Tables of records and chunks */ /* Tables of records and chunks */
dataentry *entrytbl; extern dataentry *entrytbl;
chunk_t *chunktbl; extern chunk_t *chunktbl;
...@@ -75,6 +75,8 @@ struct symbols { ...@@ -75,6 +75,8 @@ struct symbols {
VTAILQ_ENTRY(symbols) list; VTAILQ_ENTRY(symbols) list;
}; };
struct sigaction ignore_action, stacktrace_action, default_action;
static VTAILQ_HEAD(,symbols) symbols = VTAILQ_HEAD_INITIALIZER(symbols); static VTAILQ_HEAD(,symbols) symbols = VTAILQ_HEAD_INITIALIZER(symbols);
static int static int
......
...@@ -39,6 +39,8 @@ ...@@ -39,6 +39,8 @@
#include "trackrdrd.h" #include "trackrdrd.h"
struct logconf logconf;
static const char *level2name[LOG_DEBUG+1]; static const char *level2name[LOG_DEBUG+1];
static void static void
......
...@@ -39,6 +39,20 @@ ...@@ -39,6 +39,20 @@
#include "mq_kafka.h" #include "mq_kafka.h"
char topic[LINE_MAX];
int loglvl;
char logpath[PATH_MAX];
char zookeeper[LINE_MAX];
char brokerlist[LINE_MAX];
char zoolog[PATH_MAX];
unsigned zoo_timeout;
unsigned stats_interval;
unsigned wrk_shutdown_timeout;
unsigned log_error_data;
rd_kafka_topic_conf_t *topic_conf;
rd_kafka_conf_t *conf;
static int static int
conf_getUnsignedInt(const char *rval, unsigned *i) conf_getUnsignedInt(const char *rval, unsigned *i)
{ {
......
...@@ -60,6 +60,9 @@ ...@@ -60,6 +60,9 @@
#define SO_VERSION "unknown version" #define SO_VERSION "unknown version"
#endif #endif
kafka_wrk_t **workers;
unsigned nwrk;
static char errmsg[LINE_MAX]; static char errmsg[LINE_MAX];
static char _version[LINE_MAX]; static char _version[LINE_MAX];
......
...@@ -55,23 +55,23 @@ typedef struct kafka_wrk { ...@@ -55,23 +55,23 @@ typedef struct kafka_wrk {
unsigned long nodata; unsigned long nodata;
} kafka_wrk_t; } kafka_wrk_t;
kafka_wrk_t **workers; extern kafka_wrk_t **workers;
unsigned nwrk; extern unsigned nwrk;
/* configuration */ /* configuration */
char topic[LINE_MAX]; extern char topic[LINE_MAX];
int loglvl; extern int loglvl;
char logpath[PATH_MAX]; extern char logpath[PATH_MAX];
char zookeeper[LINE_MAX]; extern char zookeeper[LINE_MAX];
char brokerlist[LINE_MAX]; extern char brokerlist[LINE_MAX];
char zoolog[PATH_MAX]; extern char zoolog[PATH_MAX];
unsigned zoo_timeout; extern unsigned zoo_timeout;
unsigned stats_interval; extern unsigned stats_interval;
unsigned wrk_shutdown_timeout; extern unsigned wrk_shutdown_timeout;
unsigned log_error_data; extern unsigned log_error_data;
rd_kafka_topic_conf_t *topic_conf; extern rd_kafka_topic_conf_t *topic_conf;
rd_kafka_conf_t *conf; extern rd_kafka_conf_t *conf;
/* log.c */ /* log.c */
int MQ_LOG_Open(const char *path); int MQ_LOG_Open(const char *path);
......
...@@ -41,6 +41,10 @@ ...@@ -41,6 +41,10 @@
#include "vas.h" #include "vas.h"
#include "vqueue.h" #include "vqueue.h"
pthread_cond_t spmcq_datawaiter_cond;
pthread_mutex_t spmcq_datawaiter_lock;
int spmcq_datawaiter;
static volatile unsigned long enqs = 0, deqs = 0; static volatile unsigned long enqs = 0, deqs = 0;
static pthread_mutex_t spmcq_lock; static pthread_mutex_t spmcq_lock;
static pthread_mutex_t spmcq_deq_lock; static pthread_mutex_t spmcq_deq_lock;
......
...@@ -64,7 +64,9 @@ struct mqf { ...@@ -64,7 +64,9 @@ struct mqf {
reconnect_f *reconnect; reconnect_f *reconnect;
worker_shutdown_f *worker_shutdown; worker_shutdown_f *worker_shutdown;
global_shutdown_f *global_shutdown; global_shutdown_f *global_shutdown;
} mqf; };
extern struct mqf mqf;
/* handler.c */ /* handler.c */
...@@ -80,7 +82,7 @@ struct mqf { ...@@ -80,7 +82,7 @@ struct mqf {
strerror(errno)); \ strerror(errno)); \
} while(0) } while(0)
struct sigaction ignore_action, stacktrace_action, default_action; extern struct sigaction ignore_action, stacktrace_action, default_action;
void HNDL_Init(const char *a0); void HNDL_Init(const char *a0);
void HNDL_Abort(int sig); void HNDL_Abort(int sig);
...@@ -92,7 +94,7 @@ void PRIV_Sandbox(void); ...@@ -92,7 +94,7 @@ void PRIV_Sandbox(void);
/* worker.c */ /* worker.c */
/* stats */ /* stats */
unsigned abandoned; extern unsigned abandoned;
/** /**
* Initializes resources for worker threads -- allocates memory, * Initializes resources for worker threads -- allocates memory,
...@@ -113,7 +115,7 @@ void WRK_Shutdown(void); ...@@ -113,7 +115,7 @@ void WRK_Shutdown(void);
#define OCCUPIED(e) ((e)->occupied == 1) #define OCCUPIED(e) ((e)->occupied == 1)
unsigned global_nfree_rec, global_nfree_chunk; extern unsigned global_nfree_rec, global_nfree_chunk;
typedef struct chunk_t { typedef struct chunk_t {
unsigned magic; unsigned magic;
...@@ -161,9 +163,9 @@ unsigned SPMCQ_NeedWorker(int running); ...@@ -161,9 +163,9 @@ unsigned SPMCQ_NeedWorker(int running);
/* Consumers wait for this condition when the spmc queue is empty. /* Consumers wait for this condition when the spmc queue is empty.
Producer signals this condition after enqueue. */ Producer signals this condition after enqueue. */
pthread_cond_t spmcq_datawaiter_cond; extern pthread_cond_t spmcq_datawaiter_cond;
pthread_mutex_t spmcq_datawaiter_lock; extern pthread_mutex_t spmcq_datawaiter_lock;
int spmcq_datawaiter; extern int spmcq_datawaiter;
/* child.c */ /* child.c */
void RDR_Stats(void); void RDR_Stats(void);
...@@ -174,7 +176,7 @@ int RDR_Exhausted(void); ...@@ -174,7 +176,7 @@ int RDR_Exhausted(void);
#define EMPTY(s) (s[0] == '\0') #define EMPTY(s) (s[0] == '\0')
#define DEFAULT_CONFIG "/etc/trackrdrd.conf" #define DEFAULT_CONFIG "/etc/trackrdrd.conf"
char cli_config_filename[PATH_MAX + 1]; extern char cli_config_filename[PATH_MAX + 1];
struct config { struct config {
char pid_file[PATH_MAX]; char pid_file[PATH_MAX];
...@@ -227,7 +229,9 @@ struct config { ...@@ -227,7 +229,9 @@ struct config {
#define MIN_CHUNK_SIZE 64 #define MIN_CHUNK_SIZE 64
unsigned tx_limit; unsigned tx_limit;
} config; };
extern struct config config;
void CONF_Init(void); void CONF_Init(void);
int CONF_Add(const char *lval, const char *rval); int CONF_Add(const char *lval, const char *rval);
...@@ -252,7 +256,9 @@ struct logconf { ...@@ -252,7 +256,9 @@ struct logconf {
log_close_t *close; log_close_t *close;
FILE *out; FILE *out;
int level; int level;
} logconf; };
extern struct logconf logconf;
int LOG_Open(const char *progname); int LOG_Open(const char *progname);
int LOG_GetLevel(void); int LOG_GetLevel(void);
......
...@@ -99,7 +99,11 @@ typedef struct { ...@@ -99,7 +99,11 @@ typedef struct {
pthread_t worker; pthread_t worker;
worker_data_t *wrk_data; worker_data_t *wrk_data;
} thread_data_t; } thread_data_t;
unsigned abandoned;
struct mqf mqf;
static unsigned run, cleaned = 0, rec_thresh, chunk_thresh; static unsigned run, cleaned = 0, rec_thresh, chunk_thresh;
static thread_data_t *thread_data; static thread_data_t *thread_data;
......
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