diff --git a/adjust_defaults.sh b/adjust_defaults.sh new file mode 100755 index 00000000..c7313d14 --- /dev/null +++ b/adjust_defaults.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# +# script to alter the default socket directory path +# in sample configuration files +# +# usage: adjust_defaults.sh new_path + + NEW_DEFAULT="'$1'" + echo "changing default socket path to ${NEW_DEFAULT}" + dirlist=(`ls src/sample/pgpool.conf*`) + for filename in ${dirlist[*]}; do + echo "modifying $filename" + sed -i.bak "s#^pcp_socket_dir = .*#pcp_socket_dir = ${NEW_DEFAULT}#" $filename && rm -- "${filename}.bak" + sed -i.bak "s#^wd_ipc_socket_dir = .*#wd_ipc_socket_dir = ${NEW_DEFAULT}#" $filename && rm -- "${filename}.bak" + sed -i.bak "s#^socket_dir = .*#socket_dir = ${NEW_DEFAULT}#" $filename && rm -- "${filename}.bak" + done diff --git a/configure b/configure index 395d8bc3..e8d1a875 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for pgpool-II 4.1devel. +# Generated by GNU Autoconf 2.69 for pgpool-II 4.2devel. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='pgpool-II' PACKAGE_TARNAME='pgpool-II' -PACKAGE_VERSION='4.1devel' -PACKAGE_STRING='pgpool-II 4.1devel' +PACKAGE_VERSION='4.2devel' +PACKAGE_STRING='pgpool-II 4.2devel' PACKAGE_BUGREPORT='pgpool-hackers@pgpool.net' PACKAGE_URL='' @@ -792,6 +792,7 @@ with_pgsql with_pgsql_includedir with_pgsql_libdir with_sunifdef +with_default_socket_dir with_openssl with_pam with_memcached @@ -1352,7 +1353,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures pgpool-II 4.1devel to adapt to many kinds of systems. +\`configure' configures pgpool-II 4.2devel to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1422,7 +1423,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of pgpool-II 4.1devel:";; + short | recursive ) echo "Configuration of pgpool-II 4.2devel:";; esac cat <<\_ACEOF @@ -1461,6 +1462,7 @@ Optional Packages: --with-pgsql-includedir=DIR site header files for PostgreSQL in DIR --with-pgsql-libdir=DIR site library files for PostgreSQL in DIR --with-sunifdef=DIR install path for sunifdef utility + --with-default-socket-dir=DIR default directory for BSD socket files --with-openssl build with OpenSSL support --with-pam build with PAM support --with-memcached=DIR site header files for libmemcached in DIR @@ -1549,7 +1551,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -pgpool-II configure 4.1devel +pgpool-II configure 4.2devel generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2212,7 +2214,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by pgpool-II $as_me 4.1devel, which was +It was created by pgpool-II $as_me 4.2devel, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3866,7 +3868,7 @@ fi # Define the identity of the package. PACKAGE='pgpool-II' - VERSION='4.1devel' + VERSION='4.2devel' cat >>confdefs.h <<_ACEOF @@ -14594,7 +14596,7 @@ cat >>confdefs.h <<_ACEOF _ACEOF -for ac_func in setsid select socket sigprocmask strdup strerror strftime strtok asprintf vasprintf gai_strerror hstrerror pstat setproctitle vsyslog +for ac_func in setsid select socket sigprocmask strdup strerror strftime strtok asprintf vasprintf gai_strerror hstrerror pstat setproctitle syslog do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -14748,6 +14750,35 @@ fi + +# Check whether --with-default-socket-dir was given. +if test "${with_default_socket_dir+set}" = set; then : + withval=$with_default_socket_dir; + case "$withval" in + "" | y | ye | yes | n | no) + as_fn_error $? "*** You must supply an argument to the --with-default-socket-dir option." "$LINENO" 5 + ;; + esac + DEFAULT_SOCKET_DIR="$withval" + +cat >>confdefs.h <<_ACEOF +#define DEFAULT_SOCKET_DIR "${withval}" +_ACEOF + + ac_config_commands="$ac_config_commands ADJUST_DEFAULT_VALUES" + + +else + + cat >>confdefs.h <<_ACEOF +#define DEFAULT_SOCKET_DIR "/tmp" +_ACEOF + + +fi + + + # Check whether --with-openssl was given. if test "${with_openssl+set}" = set; then : withval=$with_openssl; @@ -14755,7 +14786,6 @@ else openssl=no fi - if test "$with_openssl" = yes || test "$with_openssl" = auto; then for ac_header in openssl/ssl.h do : @@ -15801,7 +15831,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by pgpool-II $as_me 4.1devel, which was +This file was extended by pgpool-II $as_me 4.2devel, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15867,7 +15897,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -pgpool-II config.status 4.1devel +pgpool-II config.status 4.2devel configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -16263,6 +16293,7 @@ fi +DEFAULT_SOCKET_DIR=$DEFAULT_SOCKET_DIR _ACEOF @@ -16273,6 +16304,7 @@ for ac_config_target in $ac_config_targets do case $ac_config_target in "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; + "ADJUST_DEFAULT_VALUES") CONFIG_COMMANDS="$CONFIG_COMMANDS ADJUST_DEFAULT_VALUES" ;; "src/include/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/include/config.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; @@ -17518,6 +17550,7 @@ fi chmod +x "$ofile" ;; + "ADJUST_DEFAULT_VALUES":C) sh adjust_defaults.sh $DEFAULT_SOCKET_DIR ;; esac done # for ac_tag diff --git a/configure.ac b/configure.ac index 77451165..196a56b1 100644 --- a/configure.ac +++ b/configure.ac @@ -327,11 +327,28 @@ AC_ARG_WITH(sunifdef, SUNIFDEF="$withval"/sunifdef ]) + +AC_ARG_WITH(default-socket-dir, + [ --with-default-socket-dir=DIR default directory for BSD socket files], + [ + case "$withval" in + "" | y | ye | yes | n | no) + AC_MSG_ERROR([*** You must supply an argument to the --with-default-socket-dir option.]) + ;; + esac + DEFAULT_SOCKET_DIR="$withval" + AC_DEFINE_UNQUOTED([DEFAULT_SOCKET_DIR], "${withval}", + [change default unix domain socket directory. (--with-default-socket-dir)]) + AC_CONFIG_COMMANDS([ADJUST_DEFAULT_VALUES], [sh adjust_defaults.sh $DEFAULT_SOCKET_DIR],[DEFAULT_SOCKET_DIR=$DEFAULT_SOCKET_DIR]) + ], + [ + AC_DEFINE_UNQUOTED([DEFAULT_SOCKET_DIR], "/tmp",[]) + ]) + AC_ARG_WITH(openssl, [ --with-openssl build with OpenSSL support], [], [openssl=no]) - if test "$with_openssl" = yes || test "$with_openssl" = auto; then AC_CHECK_HEADERS(openssl/ssl.h, [AC_DEFINE([USE_SSL], 1, diff --git a/src/include/config.h.in b/src/include/config.h.in index 76e52c29..958307ae 100644 --- a/src/include/config.h.in +++ b/src/include/config.h.in @@ -12,6 +12,9 @@ /* Define to the return type of 'accept' */ #undef ACCEPT_TYPE_RETURN +/* change default unix domain socket directory. (--with-default-socket-dir) */ +#undef DEFAULT_SOCKET_DIR + /* float4 values are passed by value if 'true', by reference if 'false' */ #undef FLOAT4PASSBYVAL @@ -197,6 +200,9 @@ /* Define to 1 if `__ss_len' is a member of `struct sockaddr_storage'. */ #undef HAVE_STRUCT_SOCKADDR_STORAGE___SS_LEN +/* Define to 1 if you have the `syslog' function. */ +#undef HAVE_SYSLOG + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PARAM_H @@ -248,9 +254,6 @@ /* Define to 1 if you have the `vsnprintf' function. */ #undef HAVE_VSNPRINTF -/* Define to 1 if you have the `vsyslog' function. */ -#undef HAVE_VSYSLOG - /* Define to 1 if you have the `wait3' system call. Deprecated, you should no longer depend upon `wait3'. */ #undef HAVE_WAIT3 diff --git a/src/include/pcp/pcp_stream.h b/src/include/pcp/pcp_stream.h index b1f9efb5..bad4ee87 100644 --- a/src/include/pcp/pcp_stream.h +++ b/src/include/pcp/pcp_stream.h @@ -49,6 +49,4 @@ extern int pcp_read(PCP_CONNECTION * pc, void *buf, int len); extern int pcp_write(PCP_CONNECTION * pc, void *buf, int len); extern int pcp_flush(PCP_CONNECTION * pc); -#define UNIX_DOMAIN_PATH "/tmp" - #endif /* PCP_STREAM_H */ diff --git a/src/include/pool.h b/src/include/pool.h index 8995b961..3394d237 100644 --- a/src/include/pool.h +++ b/src/include/pool.h @@ -76,12 +76,6 @@ /* pid file directory */ #define DEFAULT_LOGDIR "/tmp" -/* Unix domain socket directory */ -#define DEFAULT_SOCKET_DIR "/tmp" - -/* Unix domain socket directory for watchdog IPC */ -#define DEFAULT_WD_IPC_SOCKET_DIR "/tmp" - /* pid file name */ #define DEFAULT_PID_FILE_NAME "/var/run/pgpool/pgpool.pid" diff --git a/src/libs/pcp/pcp.c b/src/libs/pcp/pcp.c index 8a982ad4..d62c30df 100644 --- a/src/libs/pcp/pcp.c +++ b/src/libs/pcp/pcp.c @@ -130,7 +130,7 @@ pcp_connect(char *hostname, int port, char *username, char *password, FILE *Pfde if (hostname == NULL || *hostname == '\0') { - path = UNIX_DOMAIN_PATH; + path = DEFAULT_SOCKET_DIR; hostname = path; } else @@ -1864,7 +1864,7 @@ PasswordFromFile(PCPConnInfo * pcpConn, char *hostname, char *port, char *userna if (hostname == NULL) hostname = DefaultHost; - else if (strcmp(hostname, UNIX_DOMAIN_PATH) == 0) + else if (strcmp(hostname, DEFAULT_SOCKET_DIR) == 0) hostname = DefaultHost; if (!getPoolPassFilename(pgpassfile))