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