aboutsummaryrefslogtreecommitdiff
path: root/databases/pgpool-II/files
diff options
context:
space:
mode:
authorJun Kuriyama <kuriyama@FreeBSD.org>2008-03-07 01:58:15 +0000
committerJun Kuriyama <kuriyama@FreeBSD.org>2008-03-07 01:58:15 +0000
commitc21b0af0b5670d6e839e5aae6c6e24e77fd39bf3 (patch)
treef35040b7975ad68925ffb81287050de1c10f4b75 /databases/pgpool-II/files
parentaf2645c57ae7c2147016208a4c6f506e143ba478 (diff)
downloadports-c21b0af0b5670d6e839e5aae6c6e24e77fd39bf3.tar.gz
ports-c21b0af0b5670d6e839e5aae6c6e24e77fd39bf3.zip
Notes
Diffstat (limited to 'databases/pgpool-II/files')
-rw-r--r--databases/pgpool-II/files/patch-main.c53
-rw-r--r--databases/pgpool-II/files/pgpool.in19
2 files changed, 71 insertions, 1 deletions
diff --git a/databases/pgpool-II/files/patch-main.c b/databases/pgpool-II/files/patch-main.c
new file mode 100644
index 000000000000..769cba9502cf
--- /dev/null
+++ b/databases/pgpool-II/files/patch-main.c
@@ -0,0 +1,53 @@
+--- main.c.orig 2007-11-09 13:37:35.000000000 +0900
++++ main.c 2008-03-03 10:24:27.651654702 +0900
+@@ -836,7 +836,13 @@
+ status = bind(fd, (struct sockaddr *)&addr, len);
+ if (status == -1)
+ {
+- pool_error("bind() failed. reason: %s", strerror(errno));
++ char *host = "", *serv = "";
++ char hostname[NI_MAXHOST], servname[NI_MAXSERV];
++ if (getnameinfo(&addr, len, hostname, sizeof(hostname), servname, sizeof(servname), 0) == 0) {
++ host = hostname;
++ serv = servname;
++ }
++ pool_error("bind(%s:%s) failed. reason: %s", host, serv, strerror(errno));
+ myexit(1);
+ }
+
+@@ -872,7 +878,7 @@
+ status = bind(fd, (struct sockaddr *)&addr, len);
+ if (status == -1)
+ {
+- pool_error("bind() failed. reason: %s", strerror(errno));
++ pool_error("bind(%s) failed. reason: %s", addr.sun_path, strerror(errno));
+ myexit(1);
+ }
+
+@@ -891,6 +897,12 @@
+ return fd;
+ }
+
++static void myunlink(const char* path)
++{
++ if (unlink(path) == 0) return;
++ pool_error("unlink(%s) failed: %s", path, strerror(errno));
++}
++
+ static void myexit(int code)
+ {
+ char path[POOLMAXPATHLEN];
+@@ -917,10 +929,10 @@
+ POOL_SETMASK(&UnBlockSig);
+ }
+
+- unlink(un_addr.sun_path);
+- unlink(pcp_un_addr.sun_path);
++ myunlink(un_addr.sun_path);
++ myunlink(pcp_un_addr.sun_path);
+ snprintf(path, sizeof(path), "%s/%s", pool_config->logdir, PID_FILE_NAME);
+- unlink(path);
++ myunlink(path);
+
+ pool_shmem_exit(code);
+ exit(code);
diff --git a/databases/pgpool-II/files/pgpool.in b/databases/pgpool-II/files/pgpool.in
index 012accf2b7f3..058b531550c4 100644
--- a/databases/pgpool-II/files/pgpool.in
+++ b/databases/pgpool-II/files/pgpool.in
@@ -13,6 +13,9 @@
# Set it to YES to enable pgpool.
# pgpool_conf (file): Set location of your config.
# Default is "%%PREFIX%%/etc/pgpool.conf"
+# pgpool_flags (string): Default is "-f $pgpool_conf"
+# pgpool_looger (bool): Use logger for logging.
+# pgpool_looger_pri (string): logger priority (default "local0.info").
# pgpool_user (uid): User ID to run as (default nobody)
#
@@ -25,12 +28,26 @@ load_rc_config $name
: ${pgpool_enable="NO"}
: ${pgpool_conf="%%PREFIX%%/etc/pgpool.conf"}
+: ${pgpool_flags="-f ${pgpool_conf}"}
: ${pgpool_user="nobody"}
+: ${pgpool_logger="YES"}
+: ${pgpool_logger_pri="local0.info"}
command="%%PREFIX%%/bin/pgpool"
-command_args="-f ${pgpool_conf}"
+command_args="${pgpool_flags}"
+start_cmd="pgpool_start"
stop_cmd="${command} ${command_args} stop"
required_files="${pgpool_conf}"
+pgpool_start()
+{
+ if checkyesno pgpool_logger; then
+ su -m $pgpool_user -c "sh -c \"$command $command_args -n 2>&1 | logger -t $name -p $pgpool_logger_pri &\""
+ else
+ unset start_cmd
+ run_rc_command start
+ fi
+}
+
run_rc_command "$1"