pgpool2.git / summary / log / commit / refs

commit    4a4810e11346964b6dfdce2ee22df2c63bf025d4
Author:   Tatsuo Ishii <ishii at sraoss.co.jp>
Date:     Wed Jul 14 07:40:22 2010 +0000

    pgpool links shared memory version of pool_config.l
    On the other hand pg_md5 links private memory version of
    pool_config.l.
    This commit does some dirty tricks by creating a fake source file.


Makefile.am | 4 +--- Makefile.in | 11 ++++++----- pool_config.c | 8 ++++---- pool_config.l | 8 ++++---- pool_config_md5.c | 29 +++++++++++++++++++++++++++++ 5 files changed, 44 insertions(+), 16 deletions(-) diff --git a/Makefile.am b/Makefile.am index 1d6dece3f..7329bb926 100644 --- a/Makefile.am +++ b/Makefile.am @@ -21,11 +21,9 @@ pgpool_SOURCES = pool.h pool_type.h version.h pgpool.conf.sample \ pool_passwd.c pool_passwd.h \ pool_globals.c -pgpool_DEFS = -DPGPOOL_MAIN - pg_md5_SOURCES = pg_md5.c md5.c md5.h \ pool.h \ - pool_config.l pool_config.h \ + pool_config_md5.c pool_config.h \ pool_error.c \ pool_signal.h pool_signal.c \ pool_passwd.c pool_passwd.h \ diff --git a/Makefile.in b/Makefile.in index cc168f3db..d7a3aa437 100644 --- a/Makefile.in +++ b/Makefile.in @@ -61,7 +61,7 @@ am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man8dir)" \ binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) am_pg_md5_OBJECTS = pg_md5.$(OBJEXT) md5.$(OBJEXT) \ - pool_config.$(OBJEXT) pool_error.$(OBJEXT) \ + pool_config_md5.$(OBJEXT) pool_error.$(OBJEXT) \ pool_signal.$(OBJEXT) pool_passwd.$(OBJEXT) \ pool_globals.$(OBJEXT) pg_md5_OBJECTS = $(am_pg_md5_OBJECTS) @@ -98,7 +98,6 @@ LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS) LTLEXCOMPILE = $(LIBTOOL) --mode=compile $(LEX) $(LFLAGS) $(AM_LFLAGS) -YLWRAP = $(top_srcdir)/ylwrap SOURCES = $(pg_md5_SOURCES) $(pgpool_SOURCES) DIST_SOURCES = $(pg_md5_SOURCES) $(pgpool_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ @@ -261,10 +260,9 @@ pgpool_SOURCES = pool.h pool_type.h version.h pgpool.conf.sample \ pool_passwd.c pool_passwd.h \ pool_globals.c -pgpool_DEFS = -DPGPOOL_MAIN pg_md5_SOURCES = pg_md5.c md5.c md5.h \ pool.h \ - pool_config.l pool_config.h \ + pool_config_md5.c pool_config.h \ pool_error.c \ pool_signal.h pool_signal.c \ pool_passwd.c pool_passwd.h \ @@ -423,6 +421,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pg_md5.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pool_auth.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pool_config.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pool_config_md5.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pool_connection_pool.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pool_error.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pool_globals.Po@am__quote@ @@ -477,7 +476,9 @@ distclean-compile: @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< .l.c: - $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE) + $(LEXCOMPILE) $< + sed '/^#/ s|$(LEX_OUTPUT_ROOT)\.c|$@|' $(LEX_OUTPUT_ROOT).c >$@ + rm -f $(LEX_OUTPUT_ROOT).c mostlyclean-libtool: -rm -f *.lo diff --git a/pool_config.c b/pool_config.c index 880092df1..b6c332fee 100644 --- a/pool_config.c +++ b/pool_config.c @@ -1838,7 +1838,7 @@ int pool_init_config(void) memset(pool_config, 0, sizeof(POOL_CONFIG)); -#ifdef PGPOOL_MAIN +#ifndef POOL_PRIVATE pool_config->backend_desc = pool_shared_memory_create(sizeof(BackendDesc)); if (pool_config->backend_desc == NULL) { @@ -3206,7 +3206,7 @@ int pool_get_config(char *confpath, POOL_CONFIG_CONTEXT context) if (pool_config->parallel_mode || pool_config->enable_query_cache) { -#ifdef PGPOOL_MAIN +#ifndef POOL_PRIVATE int dist_num; #endif SystemDBInfo *info; @@ -3219,7 +3219,7 @@ int pool_get_config(char *confpath, POOL_CONFIG_CONTEXT context) } memset(system_db_info, 0, sizeof(*system_db_info)); -#ifdef PGPOOL_MAIN +#ifndef POOL_PRIVATE system_db_info->system_db_status = pool_shared_memory_create(sizeof(BACKEND_STATUS)); #else system_db_info->system_db_status = malloc(sizeof(BACKEND_STATUS)); @@ -3249,7 +3249,7 @@ int pool_get_config(char *confpath, POOL_CONFIG_CONTEXT context) info->dist_def_num = 0; info->dist_def_slot = NULL; -#ifdef PGPOOL_MAIN +#ifndef POOL_PRIVATE if (pool_config->parallel_mode) { diff --git a/pool_config.l b/pool_config.l index 625e2baa0..c1cca5fb7 100644 --- a/pool_config.l +++ b/pool_config.l @@ -113,7 +113,7 @@ int pool_init_config(void) memset(pool_config, 0, sizeof(POOL_CONFIG)); -#ifdef PGPOOL_MAIN +#ifndef POOL_PRIVATE pool_config->backend_desc = pool_shared_memory_create(sizeof(BackendDesc)); if (pool_config->backend_desc == NULL) { @@ -1481,7 +1481,7 @@ int pool_get_config(char *confpath, POOL_CONFIG_CONTEXT context) if (pool_config->parallel_mode || pool_config->enable_query_cache) { -#ifdef PGPOOL_MAIN +#ifndef POOL_PRIVATE int dist_num; #endif SystemDBInfo *info; @@ -1494,7 +1494,7 @@ int pool_get_config(char *confpath, POOL_CONFIG_CONTEXT context) } memset(system_db_info, 0, sizeof(*system_db_info)); -#ifdef PGPOOL_MAIN +#ifndef POOL_PRIVATE system_db_info->system_db_status = pool_shared_memory_create(sizeof(BACKEND_STATUS)); #else system_db_info->system_db_status = malloc(sizeof(BACKEND_STATUS)); @@ -1524,7 +1524,7 @@ int pool_get_config(char *confpath, POOL_CONFIG_CONTEXT context) info->dist_def_num = 0; info->dist_def_slot = NULL; -#ifdef PGPOOL_MAIN +#ifndef POOL_PRIVATE if (pool_config->parallel_mode) { diff --git a/pool_config_md5.c b/pool_config_md5.c new file mode 100644 index 000000000..6c7a8b256 --- /dev/null +++ b/pool_config_md5.c @@ -0,0 +1,29 @@ +/* -*-pgsql-c-*- */ +/* + * + * $Header$ + * + * pgpool: a language independent connection pool server for PostgreSQL + * written by Tatsuo Ishii + * + * Copyright (c) 2003-2010 PgPool Global Development Group + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. The author makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * pool_config_md5.c: Stub file to import pool_config.c. + * This file is intended to be linked against pg_md5. Thus + * it needs not to use shared memory staffs. + * + */ + +#define POOL_PRIVATE +#include "pool_config.c" [parent: 63546e97a7b3]