diff options
author | Lars Koeller <lkoeller@FreeBSD.org> | 2004-05-11 17:02:45 +0000 |
---|---|---|
committer | Lars Koeller <lkoeller@FreeBSD.org> | 2004-05-11 17:02:45 +0000 |
commit | 41726bea73e42c927d3156ed1056886576a62fd8 (patch) | |
tree | 679cd0c538b427aee77f5e45f2cf780a61a7b6da /sysutils/apcupsd | |
parent | USE_RC_SUBR'ify. (diff) |
o) Upgrade to version 3.10.13
Notes
Notes:
svn path=/head/; revision=108933
Diffstat (limited to 'sysutils/apcupsd')
-rw-r--r-- | sysutils/apcupsd/Makefile | 4 | ||||
-rw-r--r-- | sysutils/apcupsd/distinfo | 4 | ||||
-rw-r--r-- | sysutils/apcupsd/files/patch-pthreads | 172 | ||||
-rw-r--r-- | sysutils/apcupsd/pkg-plist | 2 |
4 files changed, 5 insertions, 177 deletions
diff --git a/sysutils/apcupsd/Makefile b/sysutils/apcupsd/Makefile index 96d605bd1baf..37500d9de659 100644 --- a/sysutils/apcupsd/Makefile +++ b/sysutils/apcupsd/Makefile @@ -6,8 +6,8 @@ # PORTNAME= apcupsd -PORTVERSION= 3.10.11 -PORTREVISION= 3 +PORTVERSION= 3.10.13 +#PORTREVISION= 1 CATEGORIES= sysutils MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= ${PORTNAME} diff --git a/sysutils/apcupsd/distinfo b/sysutils/apcupsd/distinfo index 0417f9dad6f6..cb185e5c645c 100644 --- a/sysutils/apcupsd/distinfo +++ b/sysutils/apcupsd/distinfo @@ -1,2 +1,2 @@ -MD5 (apcupsd-3.10.11.tar.gz) = 81ed03c8691a93e8502319c2e9945b71 -SIZE (apcupsd-3.10.11.tar.gz) = 3765625 +MD5 (apcupsd-3.10.13.tar.gz) = b201f70b0c066ff1bee86106e9ee5b6a +SIZE (apcupsd-3.10.13.tar.gz) = 3809317 diff --git a/sysutils/apcupsd/files/patch-pthreads b/sysutils/apcupsd/files/patch-pthreads deleted file mode 100644 index f8aff8794ee0..000000000000 --- a/sysutils/apcupsd/files/patch-pthreads +++ /dev/null @@ -1,172 +0,0 @@ ---- ./src/apcnis.c Fri Jul 18 05:32:19 2003 -+++ ./apcupsd-3.10.11-debug3/src/apcnis.c Fri Feb 6 21:19:14 2004 -@@ -197,7 +197,6 @@ - int newsockfd, sockfd, childpid; - struct sockaddr_in cli_addr; /* client's address */ - struct sockaddr_in serv_addr; /* our address */ -- socklen_t clilen; - int tlog; - int turnon = 1; - struct s_arg *arg; -@@ -269,11 +268,7 @@ - /* - * Wait for a connection from a client process. - */ -- clilen = sizeof(cli_addr); -- for (tlog=0; (newsockfd = accept(sockfd, (struct sockaddr *)&cli_addr, &clilen)) < 0; tlog -= 5*60 ) { -- if (errno == EINTR) { -- continue; -- } -+ for (tlog=0; (newsockfd = net_accept(sockfd, &cli_addr)) < 0; tlog -= 5*60 ) { - if (tlog <= 0) { - tlog = 60*60; - log_event(ups, LOG_ERR, "apcserver: accept error. ERR=%s", ---- ./src/lib/apclibnis.c Sat Aug 3 18:49:45 2002 -+++ ./apcupsd-3.10.11-debug3/src/lib/apclibnis.c -Fri Feb 6 21:38:58 2004 -@@ -71,12 +71,50 @@ - - static int read_nbytes(int fd, char *ptr, int nbytes) - { -- int nleft, nread; -- -+ int nleft, nread, rc; -+ -+#if defined HAVE_PTHREADS && (defined HAVE_OPENBSD_OS || defined HAVE_FREEBSD_OS) -+ fd_set fds; -+#endif -+ - nleft = nbytes; -- errno = 0; -+ - while (nleft > 0) { -+ - do { -+ -+#if defined HAVE_PTHREADS && (defined HAVE_OPENBSD_OS || defined HAVE_FREEBSD_OS) -+ /* -+ * Work around a bug in OpenBSD & FreeBSD userspace pthreads -+ * implementations. -+ * -+ * The pthreads implementation under the hood sets O_NONBLOCK -+ * implicitly on all fds. This setting is not visible to the user -+ * application but is relied upon by the pthreads library to prevent -+ * blocking syscalls in one thread from halting all threads in the -+ * process. When a process exit()s or exec()s, the implicit -+ * O_NONBLOCK flags are removed from all fds, EVEN THOSE IT INHERITED. -+ * If another process is still using the inherited fds, there will -+ * soon be trouble. -+ * -+ * apcupsd is bitten by this issue after fork()ing a child process to -+ * run apccontrol. -+ * -+ * select() is conveniently immune to the O_NONBLOCK issue so we use -+ * that to make sure the following read() will not block. -+ */ -+ do { -+ FD_ZERO(&fds); -+ FD_SET(fd, &fds); -+ rc = select(fd+1, &fds, NULL, NULL, NULL); -+ } while (rc == -1 && (errno == EINTR || errno == EAGAIN)); -+ if (rc < 0) -+ { -+ net_errno = errno; -+ return(-1); /* error */ -+ } -+#endif -+ - nread = read(fd, ptr, nleft); - } while (nread == -1 && (errno == EINTR || errno == EAGAIN)); - if (nread <= 0) { -@@ -100,6 +138,15 @@ - - nleft = nbytes; - while (nleft > 0) { -+#if defined HAVE_PTHREADS && (defined HAVE_OPENBSD_OS || defined HAVE_FREEBSD_OS) -+ /* -+ * Work around a bug in OpenBSD & FreeBSD userspace pthreads -+ * implementations. Rationale is the same as described above. -+ * This seemingly-pointless fcntl() call causes the pthreads -+ * library to reapply the O_NONBLOCK flag appropriately. -+ */ -+ fcntl(fd, F_SETFL, fcntl(fd, F_GETFL)); -+#endif - nwritten = write(fd, ptr, nleft); - if (nwritten <= 0) { - net_errno = errno; -@@ -225,6 +272,13 @@ - return -1; - } - /* connect to server */ -+#if defined HAVE_PTHREADS && (defined HAVE_OPENBSD_OS || defined HAVE_FREEBSD_OS) -+ /* -+ * Work around a bug in OpenBSD & FreeBSD userspace pthreads -+ * implementations. Rationale is the same as described above. -+ */ -+ fcntl(sockfd, F_SETFL, fcntl(sockfd, F_GETFL)); -+#endif - if (connect(sockfd, (struct sockaddr *) &tcp_serv_addr, sizeof(tcp_serv_addr)) < 0) { - sprintf(net_errbuf, "tcp_open: cannot connect to server %s on port %d.\n\ - ERR=%s\n", host, port, strerror(errno)); -@@ -243,6 +297,50 @@ - close(sockfd); - } - -+/* -+ * Accept a TCP connection. -+ * Returns -1 on error. -+ * Returns file descriptor of new connection otherwise. -+ */ -+int net_accept(int fd, struct sockaddr_in *cli_addr) -+{ -+ socklen_t clilen = sizeof(*cli_addr); -+ int newfd, rc; -+ -+#if defined HAVE_PTHREADS && (defined HAVE_OPENBSD_OS || defined HAVE_FREEBSD_OS) -+ fd_set fds; -+#endif -+ -+ do { -+ -+#if defined HAVE_PTHREADS && (defined HAVE_OPENBSD_OS || defined HAVE_FREEBSD_OS) -+ /* -+ * Work around a bug in OpenBSD & FreeBSD userspace pthreads -+ * implementations. Rationale is the same as described above. -+ */ -+ do { -+ FD_ZERO(&fds); -+ FD_SET(fd, &fds); -+ rc = select(fd+1, &fds, NULL, NULL, NULL); -+ } while (rc == -1 && (errno == EINTR || errno == EAGAIN)); -+ if (rc < 0) -+ { -+ net_errno = errno; -+ return(-1); /* error */ -+ } -+#endif -+ -+ newfd = accept(fd, (struct sockaddr*)cli_addr, &clilen); -+ } while (newfd == -1 && (errno == EINTR || errno == EAGAIN)); -+ -+ if (newfd < 0) -+ { -+ net_errno = errno; -+ return(-1); /* error */ -+ } -+ -+ return newfd; -+} - - int upserror, syserrno; - ---- ./include/apc_nis.h Tue May 28 09:34:24 2002 -+++ ./apcupsd-3.10.11-debug3/include/apc_nis.h -Fri Feb 6 21:19:14 2004 -@@ -40,4 +40,7 @@ - /* Close the network connection */ - void net_close(int sockfd); - -+/* Wait for and accept a new TCP connection */ -+int net_accept(int fd, struct sockaddr_in *cli_addr); -+ - extern int upserror, syserrno; diff --git a/sysutils/apcupsd/pkg-plist b/sysutils/apcupsd/pkg-plist index 6e834baf8468..6bbde2246ea9 100644 --- a/sysutils/apcupsd/pkg-plist +++ b/sysutils/apcupsd/pkg-plist @@ -13,8 +13,8 @@ etc/apcupsd/mainsback etc/apcupsd/masterconnect etc/apcupsd/mastertimeout etc/apcupsd/onbattery +%%CGI%%etc/apcupsd/cgi/apcupsd.css %%CGI%%etc/apcupsd/cgi/multimon.cgi -%%CGI%%etc/apcupsd/cgi/multimoncss.cgi %%CGI%%etc/apcupsd/cgi/upsfstats.cgi %%CGI%%etc/apcupsd/cgi/upsimage.cgi %%CGI%%etc/apcupsd/cgi/upsstats.cgi |