Fix multiple definition of global variables

parent 5b00968b
...@@ -87,6 +87,32 @@ ...@@ -87,6 +87,32 @@
#define MAX_IDLE_PAUSE 0.01 #define MAX_IDLE_PAUSE 0.01
/* global variables, see varnishevent.h */
struct sigaction default_action;
int tag2idx[MAX_VSL_TAG];
int max_idx;
chunk_t *chunks;
unsigned nchunks;
rec_t *records;
unsigned nrecords;
rec_node_t *rec_nodes;
tx_t *txn;
unsigned tx_occ, rec_occ, chunk_occ, tx_occ_hi, rec_occ_hi, chunk_occ_hi,
global_nfree_tx, global_nfree_rec, global_nfree_chunk;
struct hdrt_node *hdr_trie[MAX_VSL_TAG];
int nonrecs_wanted[VSL_t__MAX];
struct vbitmap *tag_no_hdr[VSL_t__MAX];
pthread_cond_t spscq_ready_cond;
pthread_mutex_t spscq_ready_lock;
pthread_cond_t data_ready_cond;
pthread_mutex_t data_ready_lock;
struct config config;
struct logconf logconf;
/* static */
const char *version = PACKAGE_TARNAME "-" PACKAGE_VERSION " revision " \ const char *version = PACKAGE_TARNAME "-" PACKAGE_VERSION " revision " \
VCS_Version " branch " VCS_Branch; VCS_Version " branch " VCS_Branch;
......
...@@ -77,10 +77,10 @@ ...@@ -77,10 +77,10 @@
#define thread_setname(thr,name) do { (void)(thr); (void)(name); } while(0) #define thread_setname(thr,name) do { (void)(thr); (void)(name); } while(0)
#endif #endif
struct sigaction default_action; extern struct sigaction default_action;
int tag2idx[MAX_VSL_TAG]; extern int tag2idx[MAX_VSL_TAG];
int max_idx; extern int max_idx;
typedef struct chunk_t { typedef struct chunk_t {
unsigned magic; unsigned magic;
...@@ -93,8 +93,8 @@ typedef struct chunk_t { ...@@ -93,8 +93,8 @@ typedef struct chunk_t {
typedef VSTAILQ_HEAD(chunkhead_s, chunk_t) chunkhead_t; typedef VSTAILQ_HEAD(chunkhead_s, chunk_t) chunkhead_t;
chunk_t *chunks; extern chunk_t *chunks;
unsigned nchunks; extern unsigned nchunks;
typedef struct rec_t { typedef struct rec_t {
unsigned magic; unsigned magic;
...@@ -106,8 +106,8 @@ typedef struct rec_t { ...@@ -106,8 +106,8 @@ typedef struct rec_t {
VSTAILQ_ENTRY(rec_t) freelist; VSTAILQ_ENTRY(rec_t) freelist;
} rec_t; } rec_t;
rec_t *records; extern rec_t *records;
unsigned nrecords; extern unsigned nrecords;
typedef VSTAILQ_HEAD(rechead_s, rec_t) rechead_t; typedef VSTAILQ_HEAD(rechead_s, rec_t) rechead_t;
...@@ -118,7 +118,7 @@ typedef struct rec_node_t { ...@@ -118,7 +118,7 @@ typedef struct rec_node_t {
rec_t **hdrs; rec_t **hdrs;
} rec_node_t; } rec_node_t;
rec_node_t *rec_nodes; extern rec_node_t *rec_nodes;
enum tx_state_e { enum tx_state_e {
TX_FREE, TX_FREE,
...@@ -152,31 +152,31 @@ typedef struct tx_t { ...@@ -152,31 +152,31 @@ typedef struct tx_t {
VSTAILQ_ENTRY(tx_t) spscq; VSTAILQ_ENTRY(tx_t) spscq;
} tx_t; } tx_t;
tx_t *txn; extern tx_t *txn;
typedef VSTAILQ_HEAD(txhead_s, tx_t) txhead_t; typedef VSTAILQ_HEAD(txhead_s, tx_t) txhead_t;
#define OCCUPIED(p) ((p)->occupied == 1) #define OCCUPIED(p) ((p)->occupied == 1)
unsigned tx_occ, rec_occ, chunk_occ, tx_occ_hi, rec_occ_hi, chunk_occ_hi, extern unsigned tx_occ, rec_occ, chunk_occ, tx_occ_hi, rec_occ_hi,
global_nfree_tx, global_nfree_rec, global_nfree_chunk; chunk_occ_hi, global_nfree_tx, global_nfree_rec, global_nfree_chunk;
struct hdrt_node *hdr_trie[MAX_VSL_TAG]; extern struct hdrt_node *hdr_trie[MAX_VSL_TAG];
/* non-zero if vxid or pvxid outputs are requested for a transaction type */ /* non-zero if vxid or pvxid outputs are requested for a transaction type */
int nonrecs_wanted[VSL_t__MAX]; extern int nonrecs_wanted[VSL_t__MAX];
struct vbitmap *tag_no_hdr[VSL_t__MAX]; extern struct vbitmap *tag_no_hdr[VSL_t__MAX];
/* Writer (consumer) waits for this condition when the SPSC queue is empty. /* Writer (consumer) waits for this condition when the SPSC queue is empty.
Reader (producer) signals the condition after enqueue. */ Reader (producer) signals the condition after enqueue. */
pthread_cond_t spscq_ready_cond; extern pthread_cond_t spscq_ready_cond;
pthread_mutex_t spscq_ready_lock; extern pthread_mutex_t spscq_ready_lock;
/* Reader waits for this condition if any of the freelists are exhausted. /* Reader waits for this condition if any of the freelists are exhausted.
Writer signals the condition when it returns freelists. */ Writer signals the condition when it returns freelists. */
pthread_cond_t data_ready_cond; extern pthread_cond_t data_ready_cond;
pthread_mutex_t data_ready_lock; extern pthread_mutex_t data_ready_lock;
struct config { struct config {
char log_file[PATH_MAX + 1]; char log_file[PATH_MAX + 1];
...@@ -198,15 +198,17 @@ struct config { ...@@ -198,15 +198,17 @@ struct config {
char syslog_facility_name[sizeof("LOCAL0")]; char syslog_facility_name[sizeof("LOCAL0")];
struct vsb *syslog_ident; struct vsb *syslog_ident;
unsigned monitor_interval; unsigned monitor_interval;
/* varnishd param vsl_reclen */ /* varnishd param vsl_reclen */
unsigned max_reclen; unsigned max_reclen;
unsigned chunk_size; unsigned chunk_size;
unsigned max_data; unsigned max_data;
size_t output_bufsiz; size_t output_bufsiz;
} config; };
extern struct config config;
/* varnishevent.c */ /* varnishevent.c */
void RDR_Stats(void); void RDR_Stats(void);
...@@ -231,7 +233,8 @@ struct logconf { ...@@ -231,7 +233,8 @@ 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);
/* XXX: __VA_ARGS__ can't be empty ... */ /* XXX: __VA_ARGS__ can't be empty ... */
......
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