Modified Makefiles so that liblog_manager.so can be linked in in compilation of core/gateway.c modules/protocol/mysql_backend.c and in modules/routing readconnroute.c.
Modified source files by adding a few logging commands (skygw_log_write) to them, and by adding includes of necessary header files.
This commit is contained in:
@ -19,28 +19,40 @@
|
|||||||
# 13/06/13 Mark Riddoch Addition of -rdynamic to allow libraries
|
# 13/06/13 Mark Riddoch Addition of -rdynamic to allow libraries
|
||||||
# to resolve symbols in the main executable
|
# to resolve symbols in the main executable
|
||||||
# 17/06/13 Mark Riddoch Addition of dependency generation
|
# 17/06/13 Mark Riddoch Addition of dependency generation
|
||||||
# 24/06/13 Massimiliano Pinto Addition of libmysqlclient and its includes
|
# 24/06/13 Massimiliano Pinto Addition of libmysqlclient and its
|
||||||
# do this for launching the gateway:
|
# includes do this for launching the
|
||||||
# export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH:/packages/mariadb-5.5.25/libmysql
|
# gateway: export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH:/packages/mariadb-5.5.25/libmysql
|
||||||
|
# 27/06/13 Vilho Raatikka Added logmanager-related libs and
|
||||||
|
# headers so that liblog_manager.so can
|
||||||
|
# be linked in.
|
||||||
|
include ../../build_gateway.inc
|
||||||
|
|
||||||
|
LOGPATH := $(ROOT_PATH)/log_manager
|
||||||
|
UTILSPATH := $(ROOT_PATH)/utils
|
||||||
|
|
||||||
CC=cc
|
CC=cc
|
||||||
CFLAGS=-c -I/usr/include -I../include -I../inih -I/usr/include/mysql -Wall -g
|
CFLAGS=-c -I/usr/include -I../include -I../inih -I/usr/include/mysql \
|
||||||
LDFLAGS=-rdynamic
|
-I$(LOGPATH) -I$(UTILSPATH) -Wall -g
|
||||||
SRCS= atomic.c buffer.c spinlock.c gateway.c gateway_mysql_protocol.c gw_utils.c \
|
|
||||||
utils.c dcb.c load_utils.c session.c service.c server.c poll.c config.c \
|
LDFLAGS=-rdynamic -L$(LOGPATH) -Wl,-rpath,$(LOGPATH) -Wl,-rpath,$(UTILSPATH)
|
||||||
users.c hashtable.c dbusers.c thread.c
|
|
||||||
|
SRCS= atomic.c buffer.c spinlock.c gateway.c gateway_mysql_protocol.c \
|
||||||
|
gw_utils.c utils.c dcb.c load_utils.c session.c service.c server.c \
|
||||||
|
poll.c config.c users.c hashtable.c dbusers.c thread.c
|
||||||
|
|
||||||
HDRS= ../include/atomic.h ../include/buffer.h ../include/dcb.h \
|
HDRS= ../include/atomic.h ../include/buffer.h ../include/dcb.h \
|
||||||
../include/gateway_mysql.h ../include/gw.h ../include/mysql_protocol.h \
|
../include/gateway_mysql.h ../include/gw.h ../include/mysql_protocol.h \
|
||||||
../include/session.h ../include/spinlock.h ../include/thread.h \
|
../include/session.h ../include/spinlock.h ../include/thread.h \
|
||||||
../include/modules.h ../include/poll.h ../include/config.h ../include/users.h \
|
../include/modules.h ../include/poll.h ../include/config.h \
|
||||||
../include/hashtable.h
|
../include/users.h ../include/hashtable.h
|
||||||
OBJ=$(SRCS:.c=.o)
|
OBJ=$(SRCS:.c=.o)
|
||||||
|
|
||||||
LIBS=-L../inih/extra -linih -lssl -lstdc++ \
|
LIBS=-L../inih/extra -linih -lssl -lstdc++ \
|
||||||
-L/packages/mariadb-5.5.25/libmysql -lmysqlclient \
|
-L/packages/mariadb-5.5.25/libmysql -lmysqlclient \
|
||||||
-lz -lm -lcrypto -ldl -pthread
|
-lz -lm -lcrypto -ldl -pthread -llog_manager
|
||||||
|
|
||||||
gateway: $(OBJ)
|
gateway: $(OBJ)
|
||||||
$(CC) $(LDFLAGS) $(OBJ) $(LIBS) -o $@
|
$(CC) $(LDFLAGS) $(OBJ) $(UTILSPATH)/skygw_utils.o $(LIBS) -o $@
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
$(CC) $(CFLAGS) $< -o $@
|
$(CC) $(CFLAGS) $< -o $@
|
||||||
|
@ -44,6 +44,10 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <skygw_utils.h>
|
||||||
|
#include <log_manager.h>
|
||||||
|
|
||||||
/* basic signal handling */
|
/* basic signal handling */
|
||||||
static void sighup_handler (int i) {
|
static void sighup_handler (int i) {
|
||||||
fprintf(stderr, "Signal SIGHUP %i received ...\n", i);
|
fprintf(stderr, "Signal SIGHUP %i received ...\n", i);
|
||||||
@ -170,11 +174,16 @@ int
|
|||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int daemon_mode = 1;
|
int daemon_mode = 1;
|
||||||
sigset_t sigset;
|
sigset_t sigset;
|
||||||
int n, n_threads;
|
int n, n_threads;
|
||||||
void **threads;
|
void **threads;
|
||||||
char buf[1024], *home, *cnf_file = NULL;
|
char buf[1024], *home, *cnf_file = NULL;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
i = atexit(skygw_logmanager_done);
|
||||||
|
if (i != 0) {
|
||||||
|
fprintf(stderr, "Couldn't register exit function.\n");
|
||||||
|
}
|
||||||
if ((home = getenv("GATEWAY_HOME")) != NULL)
|
if ((home = getenv("GATEWAY_HOME")) != NULL)
|
||||||
{
|
{
|
||||||
sprintf(buf, "%s/etc/gateway.cnf", home);
|
sprintf(buf, "%s/etc/gateway.cnf", home);
|
||||||
@ -201,6 +210,14 @@ char buf[1024], *home, *cnf_file = NULL;
|
|||||||
|
|
||||||
if (cnf_file == NULL)
|
if (cnf_file == NULL)
|
||||||
{
|
{
|
||||||
|
skygw_log_write(
|
||||||
|
NULL,
|
||||||
|
LOGFILE_ERROR,
|
||||||
|
strdup("Unable to find a gateway configuration file, either "
|
||||||
|
"install one in /etc/gateway.cnf, "
|
||||||
|
"$GATEWAY_HOME/etc/gateway.cnf or use the -c "
|
||||||
|
"option.\n"));
|
||||||
|
|
||||||
fprintf(stderr, "Unable to find a gateway configuration file, either install one in\n");
|
fprintf(stderr, "Unable to find a gateway configuration file, either install one in\n");
|
||||||
fprintf(stderr, "/etc/gateway.cnf, $GATEWAY_HOME/etc/gateway.cnf or use the -c option.\n");
|
fprintf(stderr, "/etc/gateway.cnf, $GATEWAY_HOME/etc/gateway.cnf or use the -c option.\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -208,6 +225,9 @@ char buf[1024], *home, *cnf_file = NULL;
|
|||||||
|
|
||||||
if (!config_load(cnf_file))
|
if (!config_load(cnf_file))
|
||||||
{
|
{
|
||||||
|
skygw_log_write(NULL,
|
||||||
|
LOGFILE_ERROR,
|
||||||
|
"Failed to load gateway configuration file %s\n");
|
||||||
fprintf(stderr, "Failed to load gateway configuration file %s\n", cnf_file);
|
fprintf(stderr, "Failed to load gateway configuration file %s\n", cnf_file);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,17 @@
|
|||||||
# Date Who Description
|
# Date Who Description
|
||||||
# 13/06/2013 Mark Riddoch Initial protocol module development
|
# 13/06/2013 Mark Riddoch Initial protocol module development
|
||||||
# 17/06/2013 Massimiliano Pinto Added mysql_common top both libraries
|
# 17/06/2013 Massimiliano Pinto Added mysql_common top both libraries
|
||||||
|
# 27/06/13 Vilho Raatikka Added logmanager-related libs and
|
||||||
|
# headers so that liblog_manager.so can
|
||||||
|
# be linked in.
|
||||||
|
include ../../../build_gateway.inc
|
||||||
|
LOGPATH := $(ROOT_PATH)/log_manager
|
||||||
|
UTILSPATH := $(ROOT_PATH)/utils
|
||||||
|
|
||||||
CC=cc
|
CC=cc
|
||||||
CFLAGS=-c -fPIC -I/usr/include -I../include -I../../include -Wall -g
|
CFLAGS=-c -fPIC -I/usr/include -I../include -I../../include -I$(LOGPATH) \
|
||||||
LDFLAGS=-shared
|
-I$(UTILSPATH) -Wall -g
|
||||||
|
LDFLAGS=-shared -L$(LOGPATH) -Wl,-rpath,$(LOGPATH) -Wl,-rpath,$(UTILSPATH)
|
||||||
MYSQLCLIENTSRCS=mysql_client.c mysql_common.c
|
MYSQLCLIENTSRCS=mysql_client.c mysql_common.c
|
||||||
MYSQLCLIENTOBJ=$(MYSQLCLIENTSRCS:.c=.o)
|
MYSQLCLIENTOBJ=$(MYSQLCLIENTSRCS:.c=.o)
|
||||||
MYSQLBACKENDSRCS=mysql_backend.c mysql_common.c
|
MYSQLBACKENDSRCS=mysql_backend.c mysql_common.c
|
||||||
@ -30,7 +37,7 @@ TELNETDSRCS=telnetd.c
|
|||||||
TELNETDOBJ=$(TELNETDSRCS:.c=.o)
|
TELNETDOBJ=$(TELNETDSRCS:.c=.o)
|
||||||
SRCS=$(MYSQLCLIENTSRCS) $(MYSQLBACKENDSRCS) $(TELNETDSRCS)
|
SRCS=$(MYSQLCLIENTSRCS) $(MYSQLBACKENDSRCS) $(TELNETDSRCS)
|
||||||
OBJ=$(SRCS:.c=.o)
|
OBJ=$(SRCS:.c=.o)
|
||||||
LIBS=
|
LIBS=$(UTILSPATH)/skygw_utils.o
|
||||||
MODULES=libMySQLClient.so libMySQLBackend.so libtelnetd.so
|
MODULES=libMySQLClient.so libMySQLBackend.so libtelnetd.so
|
||||||
|
|
||||||
all: $(MODULES)
|
all: $(MODULES)
|
||||||
|
@ -17,7 +17,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mysql_client_server_protocol.h"
|
#include "mysql_client_server_protocol.h"
|
||||||
|
#include <skygw_types.h>
|
||||||
|
#include <skygw_utils.h>
|
||||||
|
|
||||||
|
#include <log_manager.h>
|
||||||
/*
|
/*
|
||||||
* MySQL Protocol module for handling the protocol between the gateway
|
* MySQL Protocol module for handling the protocol between the gateway
|
||||||
* and the backend MySQL database.
|
* and the backend MySQL database.
|
||||||
@ -26,6 +29,8 @@
|
|||||||
* Date Who Description
|
* Date Who Description
|
||||||
* 14/06/2013 Mark Riddoch Initial version
|
* 14/06/2013 Mark Riddoch Initial version
|
||||||
* 17/06/2013 Massimiliano Pinto Added Gateway To Backends routines
|
* 17/06/2013 Massimiliano Pinto Added Gateway To Backends routines
|
||||||
|
* 27/06/13 Vilho Raatikka Added skygw_log_write command as an example
|
||||||
|
* and necessary headers.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *version_str = "V1.0.0";
|
static char *version_str = "V1.0.0";
|
||||||
@ -68,6 +73,9 @@ version()
|
|||||||
void
|
void
|
||||||
ModuleInit()
|
ModuleInit()
|
||||||
{
|
{
|
||||||
|
skygw_log_write(NULL,
|
||||||
|
LOGFILE_MESSAGE,
|
||||||
|
"Initial MySQL Client Protcol module.");
|
||||||
fprintf(stderr, "Initial MySQL Client Protcol module.\n");
|
fprintf(stderr, "Initial MySQL Client Protcol module.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,10 +17,17 @@
|
|||||||
# Revision History
|
# Revision History
|
||||||
# Date Who Description
|
# Date Who Description
|
||||||
# 13/06/13 Mark Riddoch Initial routing module development
|
# 13/06/13 Mark Riddoch Initial routing module development
|
||||||
|
# 27/06/13 Vilho Raatikka Added logmanager-related libs and
|
||||||
|
# headers so that liblog_manager.so can
|
||||||
|
# be linked in.
|
||||||
|
include ../../../build_gateway.inc
|
||||||
|
LOGPATH := $(ROOT_PATH)/log_manager
|
||||||
|
UTILSPATH := $(ROOT_PATH)/utils
|
||||||
|
|
||||||
CC=cc
|
CC=cc
|
||||||
CFLAGS=-c -fPIC -I/usr/include -I../include -I../../include -Wall -g
|
CFLAGS=-c -fPIC -I/usr/include -I../include -I../../include -I$(LOGPATH) \
|
||||||
LDFLAGS=-shared
|
-I$(UTILSPATH) -Wall -g
|
||||||
|
LDFLAGS=-shared -L$(LOGPATH) -Wl,-rpath,$(LOGPATH) -Wl,-rpath,$(UTILSPATH)
|
||||||
TESTSRCS=testroute.c
|
TESTSRCS=testroute.c
|
||||||
TESTOBJ=$(TESTSRCS:.c=.o)
|
TESTOBJ=$(TESTSRCS:.c=.o)
|
||||||
READCONSRCS=readconnroute.c
|
READCONSRCS=readconnroute.c
|
||||||
@ -29,7 +36,7 @@ DEBUGCLISRCS=debugcli.c debugcmd.c
|
|||||||
DEBUGCLIOBJ=$(DEBUGCLISRCS:.c=.o)
|
DEBUGCLIOBJ=$(DEBUGCLISRCS:.c=.o)
|
||||||
SRCS=$(TESTSRCS) $(READCONSRCS) $(DEBUGCLISRCS)
|
SRCS=$(TESTSRCS) $(READCONSRCS) $(DEBUGCLISRCS)
|
||||||
OBJ=$(SRCS:.c=.o)
|
OBJ=$(SRCS:.c=.o)
|
||||||
LIBS=-lssl
|
LIBS=$(UTILSPATH)/skygw_utils.o -lssl -llog_manager
|
||||||
MODULES=libtestroute.so libreadconnroute.so libdebugcli.so
|
MODULES=libtestroute.so libreadconnroute.so libdebugcli.so
|
||||||
|
|
||||||
all: $(MODULES)
|
all: $(MODULES)
|
||||||
|
@ -48,6 +48,8 @@
|
|||||||
* startup if the number of current
|
* startup if the number of current
|
||||||
* connections is the same for two servers
|
* connections is the same for two servers
|
||||||
* Addition of master and slave options
|
* Addition of master and slave options
|
||||||
|
* 27/06/13 Vilho Raatikka Added skygw_log_write command as an example
|
||||||
|
* and necessary headers.
|
||||||
*
|
*
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
@ -63,6 +65,10 @@
|
|||||||
#include <dcb.h>
|
#include <dcb.h>
|
||||||
#include <spinlock.h>
|
#include <spinlock.h>
|
||||||
|
|
||||||
|
#include <skygw_types.h>
|
||||||
|
#include <skygw_utils.h>
|
||||||
|
#include <log_manager.h>
|
||||||
|
|
||||||
static char *version_str = "V1.0.1";
|
static char *version_str = "V1.0.1";
|
||||||
|
|
||||||
/* The router entry points */
|
/* The router entry points */
|
||||||
@ -96,6 +102,7 @@ version()
|
|||||||
void
|
void
|
||||||
ModuleInit()
|
ModuleInit()
|
||||||
{
|
{
|
||||||
|
skygw_log_write(NULL, LOGFILE_MESSAGE, "Initial test router module.\n");
|
||||||
fprintf(stderr, "Initial test router module.\n");
|
fprintf(stderr, "Initial test router module.\n");
|
||||||
spinlock_init(&instlock);
|
spinlock_init(&instlock);
|
||||||
instances = NULL;
|
instances = NULL;
|
||||||
|
Reference in New Issue
Block a user