rpms/rsyslog/F-12 rsyslog-4.4.2-unlimited-select.patch, NONE, 1.1 .cvsignore, 1.33, 1.34 rsyslog.spec, 1.64, 1.65 sources, 1.35, 1.36

Tomas Heinrich theinric at fedoraproject.org
Thu Dec 3 11:45:32 UTC 2009


Author: theinric

Update of /cvs/extras/rpms/rsyslog/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv13249

Modified Files:
	.cvsignore rsyslog.spec sources 
Added Files:
	rsyslog-4.4.2-unlimited-select.patch 
Log Message:
- rebase to rsyslog-4.4.2
- add rsyslog-4.4.2-unlimited-select.patch




rsyslog-4.4.2-unlimited-select.patch:
 configure.ac                |   16 +++++++++++++
 gss-misc.c                  |   25 +++++++++++++++++----
 plugins/imgssapi/imgssapi.c |   16 ++++++++++---
 plugins/imudp/imudp.c       |   20 ++++++++++++-----
 plugins/imuxsock/imuxsock.c |   20 ++++++++++++-----
 runtime/Makefile.am         |    1 
 runtime/glbl.c              |   12 ++++++++++
 runtime/glbl.h              |    3 +-
 runtime/nsdsel_ptcp.c       |   51 +++++++++++++++++++++++++++++++++++---------
 runtime/nsdsel_ptcp.h       |    5 ++++
 runtime/unlimited_select.h  |   45 ++++++++++++++++++++++++++++++++++++++
 tools/syslogd.c             |    3 ++
 12 files changed, 185 insertions(+), 32 deletions(-)

--- NEW FILE rsyslog-4.4.2-unlimited-select.patch ---
diff -up rsyslog-4.4.2.unlimited-select/configure.ac.orig rsyslog-4.4.2.unlimited-select/configure.ac
--- rsyslog-4.4.2.unlimited-select/configure.ac.orig	2009-12-02 17:56:40.000000000 +0100
+++ rsyslog-4.4.2.unlimited-select/configure.ac	2009-12-02 14:14:22.000000000 +0100
@@ -341,6 +341,21 @@ AC_ARG_ENABLE([fsstnd],
   ])
 
 
+# support for unlimited select() syscall
+AC_ARG_ENABLE(unlimited_select,
+        [AS_HELP_STRING([--enable-unlimited-select],[Enable unlimited select() syscall @<:@default=no@:>@])],
+        [case "${enableval}" in
+         yes) enable_unlimited_select="yes" ;;
+          no) enable_unlimited_select="no" ;;
+           *) AC_MSG_ERROR(bad value ${enableval} for --enable-unlimited-select) ;;
+         esac],
+        [enable_unlimited_select="no"]
+)
+if test "$enable_unlimited_select" = "yes"; then
+        AC_DEFINE(USE_UNLIMITED_SELECT, 1, [If defined, the select() syscall won't be limited to a particular number of file descriptors.])
+fi
+
+
 # debug
 AC_ARG_ENABLE(debug,
         [AS_HELP_STRING([--enable-debug],[Enable debug mode @<:@default=no@:>@])],
@@ -843,6 +858,7 @@ echo "    Zlib compression support enabl
 echo "    rsyslog runtime will be built:            $enable_rsyslogrt"
 echo "    rsyslogd will be built:                   $enable_rsyslogd"
 echo "    custom module 1 will be built:            $enable_cust1"
+echo "    Unlimited select() support enabled:       $enable_unlimited_select"
 echo
 echo "---{ input plugins }---"
 echo "    Klog functionality enabled:               $enable_klog ($os_type)"
diff -up rsyslog-4.4.2.unlimited-select/gss-misc.c.orig rsyslog-4.4.2.unlimited-select/gss-misc.c
--- rsyslog-4.4.2.unlimited-select/gss-misc.c.orig	2009-12-02 17:56:02.000000000 +0100
+++ rsyslog-4.4.2.unlimited-select/gss-misc.c	2009-12-02 18:05:23.000000000 +0100
@@ -51,11 +51,14 @@
 #include "obj.h"
 #include "errmsg.h"
 #include "gss-misc.h"
+#include "glbl.h"
+#include "unlimited_select.h"
 
 MODULE_TYPE_LIB
 
 /* static data */
 DEFobjStaticHelpers
+DEFobjCurrIf(glbl)
 DEFobjCurrIf(errmsg)
 
 static void display_status_(char *m, OM_uint32 code, int type)
@@ -108,28 +111,38 @@ static int read_all(int fd, char *buf, u
 {
     int     ret;
     char   *ptr;
-    fd_set  rfds;
     struct timeval tv;
+#ifdef USE_UNLIMITED_SELECT
+    fd_set  *pRfds = malloc(glbl.GetFdSetSize());
+#else
+    fd_set  rfds;
+    fd_set *pRfds = &rfds;
+#endif
 
     for (ptr = buf; nbyte; ptr += ret, nbyte -= ret) {
-	    FD_ZERO(&rfds);
-	    FD_SET(fd, &rfds);
+	    FD_ZERO(pRfds);
+	    FD_SET(fd, pRfds);
 	    tv.tv_sec = 1;
 	    tv.tv_usec = 0;
 
-	    if ((ret = select(FD_SETSIZE, &rfds, NULL, NULL, &tv)) <= 0
-		|| !FD_ISSET(fd, &rfds))
+	    if ((ret = select(FD_SETSIZE, pRfds, NULL, NULL, &tv)) <= 0
+		|| !FD_ISSET(fd, pRfds)) {
+                    freeFdSet(pRfds);
 		    return ret;
+	    }
 	    ret = recv(fd, ptr, nbyte, 0);
 	    if (ret < 0) {
 		    if (errno == EINTR)
 			    continue;
+                    freeFdSet(pRfds);
 		    return (ret);
 	    } else if (ret == 0) {
+                    freeFdSet(pRfds);
 		    return (ptr - buf);
 	    }
     }
 
+    freeFdSet(pRfds);
     return (ptr - buf);
 }
 
@@ -264,6 +277,7 @@ BEGINObjClassExit(gssutil, OBJ_IS_LOADAB
 CODESTARTObjClassExit(gssutil)
 	/* release objects we no longer need */
 	objRelease(errmsg, CORE_COMPONENT);
+	objRelease(glbl, CORE_COMPONENT);
 ENDObjClassExit(gssutil)
 
 
@@ -274,6 +288,7 @@ ENDObjClassExit(gssutil)
 BEGINAbstractObjClassInit(gssutil, 1, OBJ_IS_LOADABLE_MODULE) /* class, version - CHANGE class also in END MACRO! */
 	/* request objects we use */
 	CHKiRet(objUse(errmsg, CORE_COMPONENT));
+	CHKiRet(objUse(glbl, CORE_COMPONENT));
 ENDObjClassInit(gssutil)
 
 
diff -up rsyslog-4.4.2.unlimited-select/plugins/imgssapi/imgssapi.c.orig rsyslog-4.4.2.unlimited-select/plugins/imgssapi/imgssapi.c
--- rsyslog-4.4.2.unlimited-select/plugins/imgssapi/imgssapi.c.orig	2009-12-02 17:58:12.000000000 +0100
+++ rsyslog-4.4.2.unlimited-select/plugins/imgssapi/imgssapi.c	2009-12-02 14:22:42.000000000 +0100
@@ -56,6 +56,7 @@
 #include "errmsg.h"
 #include "netstrm.h"
 #include "glbl.h"
+#include "unlimited_select.h"
 
 
 MODULE_TYPE_INPUT
@@ -414,15 +415,20 @@ OnSessAcceptGSS(tcpsrv_t *pThis, tcps_se
 		CHKiRet(netstrm.GetSock(pSess->pStrm, &fdSess)); // TODO: method access!
 		if (allowedMethods & ALLOWEDMETHOD_TCP) {
 			int len;
-			fd_set  fds;
 			struct timeval tv;
+#ifdef USE_UNLIMITED_SELECT
+                        fd_set *pFds = malloc(glbl.GetFdSetSize());
+#else
+                        fd_set fds;
+                        fd_set *pFds = &fds;
+#endif
 		
 			do {
-				FD_ZERO(&fds);
-				FD_SET(fdSess, &fds);
+				FD_ZERO(pFds);
+				FD_SET(fdSess, pFds);
 				tv.tv_sec = 1;
 				tv.tv_usec = 0;
-				ret = select(fdSess + 1, &fds, NULL, NULL, &tv);
+				ret = select(fdSess + 1, pFds, NULL, NULL, &tv);
 			} while (ret < 0 && errno == EINTR);
 			if (ret < 0) {
 				errmsg.LogError(0, RS_RET_ERR, "TCP session %p will be closed, error ignored\n", pSess);
@@ -475,6 +481,8 @@ OnSessAcceptGSS(tcpsrv_t *pThis, tcps_se
 				pGSess->allowedMethods = ALLOWEDMETHOD_TCP;
 				ABORT_FINALIZE(RS_RET_OK); // TODO: define good error codes
 			}
+
+                        freeFdSet(pFds);
 		}
 
 		context = &pGSess->gss_context;
diff -up rsyslog-4.4.2.unlimited-select/plugins/imudp/imudp.c.orig rsyslog-4.4.2.unlimited-select/plugins/imudp/imudp.c
--- rsyslog-4.4.2.unlimited-select/plugins/imudp/imudp.c.orig	2009-12-02 17:58:36.000000000 +0100
+++ rsyslog-4.4.2.unlimited-select/plugins/imudp/imudp.c	2009-12-02 14:31:25.000000000 +0100
@@ -44,6 +44,7 @@
 #include "parser.h"
 #include "datetime.h"
 #include "unicode-helper.h"
+#include "unlimited_select.h"
 
 MODULE_TYPE_INPUT
 
@@ -256,12 +257,18 @@ BEGINrunInput
 	int maxfds;
 	int nfds;
 	int i;
-	fd_set readfds;
 	struct sockaddr_storage frominetPrev;
 	int bIsPermitted;
 	uchar fromHost[NI_MAXHOST];
 	uchar fromHostIP[NI_MAXHOST];
 	uchar fromHostFQDN[NI_MAXHOST];
+#ifdef USE_UNLIMITED_SELECT
+        fd_set  *pReadfds = malloc(glbl.GetFdSetSize());
+#else
+        fd_set  readfds;
+        fd_set *pReadfds = &readfds;
+#endif
+
 CODESTARTrunInput
 	/* start "name caching" algo by making sure the previous system indicator
 	 * is invalidated.
@@ -280,30 +287,30 @@ CODESTARTrunInput
 		 * is given without -a, we do not need to listen at all..
 		 */
 	        maxfds = 0;
-	        FD_ZERO (&readfds);
+	        FD_ZERO (pReadfds);
 
 		/* Add the UDP listen sockets to the list of read descriptors. */
 		for (i = 0; i < *udpLstnSocks; i++) {
 			if (udpLstnSocks[i+1] != -1) {
 				if(Debug)
 					net.debugListenInfo(udpLstnSocks[i+1], "UDP");
-				FD_SET(udpLstnSocks[i+1], &readfds);
+				FD_SET(udpLstnSocks[i+1], pReadfds);
 				if(udpLstnSocks[i+1]>maxfds) maxfds=udpLstnSocks[i+1];
 			}
 		}
 		if(Debug) {
 			dbgprintf("--------imUDP calling select, active file descriptors (max %d): ", maxfds);
 			for (nfds = 0; nfds <= maxfds; ++nfds)
-				if ( FD_ISSET(nfds, &readfds) )
+				if ( FD_ISSET(nfds, pReadfds) )
 					dbgprintf("%d ", nfds);
 			dbgprintf("\n");
 		}
 
 		/* wait for io to become ready */
-		nfds = select(maxfds+1, (fd_set *) &readfds, NULL, NULL, NULL);
+		nfds = select(maxfds+1, (fd_set *) pReadfds, NULL, NULL, NULL);
 
 	       for(i = 0; nfds && i < *udpLstnSocks; i++) {
-			if(FD_ISSET(udpLstnSocks[i+1], &readfds)) {
+		       if (FD_ISSET(udpLstnSocks[i+1], pReadfds)) {
 		       		processSocket(udpLstnSocks[i+1], &frominetPrev, &bIsPermitted,
 					      fromHost, fromHostFQDN, fromHostIP);
 			--nfds; /* indicate we have processed one descriptor */
@@ -312,6 +319,7 @@ CODESTARTrunInput
 	       /* end of a run, back to loop for next recv() */
 	}
 
+	freeFdSet(pReadfds);
 	return iRet;
 ENDrunInput
 
diff -up rsyslog-4.4.2.unlimited-select/plugins/imuxsock/imuxsock.c.orig rsyslog-4.4.2.unlimited-select/plugins/imuxsock/imuxsock.c
--- rsyslog-4.4.2.unlimited-select/plugins/imuxsock/imuxsock.c.orig	2009-12-02 17:58:23.000000000 +0100
+++ rsyslog-4.4.2.unlimited-select/plugins/imuxsock/imuxsock.c	2009-12-02 14:35:58.000000000 +0100
@@ -43,6 +43,7 @@
 #include "net.h"
 #include "glbl.h"
 #include "msg.h"
+#include "unlimited_select.h"
 
 MODULE_TYPE_INPUT
 
@@ -245,7 +246,13 @@ BEGINrunInput
 	int nfds;
 	int i;
 	int fd;
-	fd_set readfds;
+#ifdef USE_UNLIMITED_SELECT
+        fd_set  *pReadfds = malloc(glbl.GetFdSetSize());
+#else
+        fd_set  readfds;
+        fd_set *pReadfds = &readfds;
+#endif
+
 CODESTARTrunInput
 	/* this is an endless loop - it is terminated when the thread is
 	 * signalled to do so. This, however, is handled by the framework,
@@ -259,11 +266,11 @@ CODESTARTrunInput
 		 * is given without -a, we do not need to listen at all..
 		 */
 	        maxfds = 0;
-	        FD_ZERO (&readfds);
+	        FD_ZERO (pReadfds);
 		/* Copy master connections */
 		for (i = startIndexUxLocalSockets; i < nfunix; i++) {
 			if (funix[i] != -1) {
-				FD_SET(funix[i], &readfds);
+				FD_SET(funix[i], pReadfds);
 				if (funix[i]>maxfds) maxfds=funix[i];
 			}
 		}
@@ -271,22 +278,23 @@ CODESTARTrunInput
 		if(Debug) {
 			dbgprintf("--------imuxsock calling select, active file descriptors (max %d): ", maxfds);
 			for (nfds= 0; nfds <= maxfds; ++nfds)
-				if ( FD_ISSET(nfds, &readfds) )
+				if ( FD_ISSET(nfds, pReadfds) )
 					dbgprintf("%d ", nfds);
 			dbgprintf("\n");
 		}
 
 		/* wait for io to become ready */
-		nfds = select(maxfds+1, (fd_set *) &readfds, NULL, NULL, NULL);
+		nfds = select(maxfds+1, (fd_set *) pReadfds, NULL, NULL, NULL);
 
 		for (i = 0; i < nfunix && nfds > 0; i++) {
-			if ((fd = funix[i]) != -1 && FD_ISSET(fd, &readfds)) {
+			if ((fd = funix[i]) != -1 && FD_ISSET(fd, pReadfds)) {
 				readSocket(fd, i);
 				--nfds; /* indicate we have processed one */
 			}
 		}
 	}
 
+	freeFdSet(pReadfds);
 	RETiRet;
 ENDrunInput
 
diff -up rsyslog-4.4.2.unlimited-select/runtime/Makefile.am.orig rsyslog-4.4.2.unlimited-select/runtime/Makefile.am
--- rsyslog-4.4.2.unlimited-select/runtime/Makefile.am.orig	2009-12-02 17:57:25.000000000 +0100
+++ rsyslog-4.4.2.unlimited-select/runtime/Makefile.am	2009-12-02 14:36:29.000000000 +0100
@@ -15,6 +15,7 @@ librsyslog_la_SOURCES = \
 	nsd.h \
 	glbl.h \
 	glbl.c \
+	unlimited_select.h \
 	conf.c \
 	conf.h \
 	parser.h \
diff -up rsyslog-4.4.2.unlimited-select/runtime/glbl.c.orig rsyslog-4.4.2.unlimited-select/runtime/glbl.c
--- rsyslog-4.4.2.unlimited-select/runtime/glbl.c.orig	2009-12-02 17:57:35.000000000 +0100
+++ rsyslog-4.4.2.unlimited-select/runtime/glbl.c	2009-12-02 14:40:07.000000000 +0100
@@ -68,6 +68,9 @@ static uchar *pszDfltNetstrmDrvr = NULL;
 static uchar *pszDfltNetstrmDrvrCAF = NULL; /* default CA file for the netstrm driver */
 static uchar *pszDfltNetstrmDrvrKeyFile = NULL; /* default key file for the netstrm driver (server) */
 static uchar *pszDfltNetstrmDrvrCertFile = NULL; /* default cert file for the netstrm driver (server) */
+#ifdef USE_UNLIMITED_SELECT
+static int iFdSetSize = howmany(FD_SETSIZE, __NFDBITS) * sizeof (fd_mask); /* size of select() bitmask in bytes */
+#endif
 
 
 /* define a macro for the simple properties' set and get functions
@@ -100,6 +103,9 @@ SIMP_PROP(DisableDNS, bDisableDNS, int)
 SIMP_PROP(LocalDomain, LocalDomain, uchar*)
 SIMP_PROP(StripDomains, StripDomains, char**)
 SIMP_PROP(LocalHosts, LocalHosts, char**)
+#ifdef USE_UNLIMITED_SELECT
+SIMP_PROP(FdSetSize, iFdSetSize, int)
+#endif
 
 SIMP_PROP_SET(LocalFQDNName, LocalFQDNName, uchar*)
 SIMP_PROP_SET(LocalHostName, LocalHostName, uchar*)
@@ -217,6 +223,9 @@ CODESTARTobjQueryInterface(glbl)
 	SIMP_PROP(DfltNetstrmDrvrCAF)
 	SIMP_PROP(DfltNetstrmDrvrKeyFile)
 	SIMP_PROP(DfltNetstrmDrvrCertFile)
+#ifdef USE_UNLIMITED_SELECT
+	SIMP_PROP(FdSetSize)
+#endif
 #undef	SIMP_PROP
 finalize_it:
 ENDobjQueryInterface(glbl)
@@ -251,6 +260,9 @@ static rsRetVal resetConfigVariables(uch
 	bOptimizeUniProc = 1;
 	bHUPisRestart = 1;
 	bPreserveFQDN = 0;
+#ifdef USE_UNLIMITED_SELECT
+	iFdSetSize = howmany(FD_SETSIZE, __NFDBITS) * sizeof (fd_mask);
+#endif
 	return RS_RET_OK;
 }
 
diff -up rsyslog-4.4.2.unlimited-select/runtime/glbl.h.orig rsyslog-4.4.2.unlimited-select/runtime/glbl.h
--- rsyslog-4.4.2.unlimited-select/runtime/glbl.h.orig	2009-12-02 17:57:41.000000000 +0100
+++ rsyslog-4.4.2.unlimited-select/runtime/glbl.h	2009-12-02 17:42:35.000000000 +0100
@@ -57,9 +57,10 @@ BEGINinterface(glbl) /* name must also b
 	SIMP_PROP(DfltNetstrmDrvrCAF, uchar*)
 	SIMP_PROP(DfltNetstrmDrvrKeyFile, uchar*)
 	SIMP_PROP(DfltNetstrmDrvrCertFile, uchar*)
+	SIMP_PROP(FdSetSize, int)
 #undef	SIMP_PROP
 ENDinterface(glbl)
-#define glblCURR_IF_VERSION 2 /* increment whenever you change the interface structure! */
+#define glblCURR_IF_VERSION 101 /* increment whenever you change the interface structure! */
 /* version 2 had PreserveFQDN added - rgerhards, 2008-12-08 */
 
 /* the remaining prototypes */
diff -up rsyslog-4.4.2.unlimited-select/runtime/nsdsel_ptcp.c.orig rsyslog-4.4.2.unlimited-select/runtime/nsdsel_ptcp.c
--- rsyslog-4.4.2.unlimited-select/runtime/nsdsel_ptcp.c.orig	2009-12-02 17:56:56.000000000 +0100
+++ rsyslog-4.4.2.unlimited-select/runtime/nsdsel_ptcp.c	2009-12-02 18:17:31.000000000 +0100
@@ -36,6 +36,7 @@
 #include "errmsg.h"
 #include "nsd_ptcp.h"
 #include "nsdsel_ptcp.h"
+#include "unlimited_select.h"
 
 /* static data */
 DEFobjStaticHelpers
@@ -47,14 +48,23 @@ DEFobjCurrIf(glbl)
  */
 BEGINobjConstruct(nsdsel_ptcp) /* be sure to specify the object type also in END macro! */
 	pThis->maxfds = 0;
+#ifdef USE_UNLIMITED_SELECT
+        pThis->pReadfds = calloc(1, glbl.GetFdSetSize());
+        pThis->pWritefds = calloc(1, glbl.GetFdSetSize());
+#else
 	FD_ZERO(&pThis->readfds);
 	FD_ZERO(&pThis->writefds);
+#endif
 ENDobjConstruct(nsdsel_ptcp)
 
 
 /* destructor for the nsdsel_ptcp object */
 BEGINobjDestruct(nsdsel_ptcp) /* be sure to specify the object type also in END and CODESTART macros! */
 CODESTARTobjDestruct(nsdsel_ptcp)
+#ifdef USE_UNLIMITED_SELECT
+	freeFdSet(pThis->pReadfds);
+	freeFdSet(pThis->pWritefds);
+#endif
 ENDobjDestruct(nsdsel_ptcp)
 
 
@@ -65,20 +75,27 @@ Add(nsdsel_t *pNsdsel, nsd_t *pNsd, nsds
 	DEFiRet;
 	nsdsel_ptcp_t *pThis = (nsdsel_ptcp_t*) pNsdsel;
 	nsd_ptcp_t *pSock = (nsd_ptcp_t*) pNsd;
+#ifdef USE_UNLIMITED_SELECT
+        fd_set *pReadfds = pThis->pReadfds;
+        fd_set *pWritefds = pThis->pWritefds;
+#else
+        fd_set *pReadfds = &pThis->readfds;
+        fd_set *pWritefds = &pThis->writefds;
+#endif
 
 	ISOBJ_TYPE_assert(pSock, nsd_ptcp);
 	ISOBJ_TYPE_assert(pThis, nsdsel_ptcp);
 
 	switch(waitOp) {
 		case NSDSEL_RD:
-			FD_SET(pSock->sock, &pThis->readfds);
+			FD_SET(pSock->sock, pReadfds);
 			break;
 		case NSDSEL_WR:
-			FD_SET(pSock->sock, &pThis->writefds);
+			FD_SET(pSock->sock, pWritefds);
 			break;
 		case NSDSEL_RDWR:
-			FD_SET(pSock->sock, &pThis->readfds);
-			FD_SET(pSock->sock, &pThis->writefds);
+			FD_SET(pSock->sock, pReadfds);
+			FD_SET(pSock->sock, pWritefds);
 			break;
 	}
 
@@ -98,6 +115,13 @@ Select(nsdsel_t *pNsdsel, int *piNumRead
 	DEFiRet;
 	int i;
 	nsdsel_ptcp_t *pThis = (nsdsel_ptcp_t*) pNsdsel;
+#ifdef USE_UNLIMITED_SELECT
+        fd_set *pReadfds = pThis->pReadfds;
+        fd_set *pWritefds = pThis->pWritefds;
+#else
+        fd_set *pReadfds = &pThis->readfds;
+        fd_set *pWritefds = &pThis->writefds;
+#endif
 
 	ISOBJ_TYPE_assert(pThis, nsdsel_ptcp);
 	assert(piNumReady != NULL);
@@ -106,13 +130,13 @@ Select(nsdsel_t *pNsdsel, int *piNumRead
 		// TODO: name in dbgprintf!
 		dbgprintf("--------<NSDSEL_PTCP> calling select, active fds (max %d): ", pThis->maxfds);
 		for(i = 0; i <= pThis->maxfds; ++i)
-			if(FD_ISSET(i, &pThis->readfds) || FD_ISSET(i, &pThis->writefds))
+			if(FD_ISSET(i, pReadfds) || FD_ISSET(i, pWritefds))
 				dbgprintf("%d ", i);
 		dbgprintf("\n");
 	}
 
 	/* now do the select */
-	*piNumReady = select(pThis->maxfds+1, &pThis->readfds, &pThis->writefds, NULL, NULL);
+	*piNumReady = select(pThis->maxfds+1, pReadfds, pWritefds, NULL, NULL);
 
 	RETiRet;
 }
@@ -125,6 +149,13 @@ IsReady(nsdsel_t *pNsdsel, nsd_t *pNsd, 
 	DEFiRet;
 	nsdsel_ptcp_t *pThis = (nsdsel_ptcp_t*) pNsdsel;
 	nsd_ptcp_t *pSock = (nsd_ptcp_t*) pNsd;
+#ifdef USE_UNLIMITED_SELECT
+        fd_set *pReadfds = pThis->pReadfds;
+        fd_set *pWritefds = pThis->pWritefds;
+#else
+        fd_set *pReadfds = &pThis->readfds;
+        fd_set *pWritefds = &pThis->writefds;
+#endif
 
 	ISOBJ_TYPE_assert(pThis, nsdsel_ptcp);
 	ISOBJ_TYPE_assert(pSock, nsd_ptcp);
@@ -132,14 +163,14 @@ IsReady(nsdsel_t *pNsdsel, nsd_t *pNsd, 
 
 	switch(waitOp) {
 		case NSDSEL_RD:
-			*pbIsReady = FD_ISSET(pSock->sock, &pThis->readfds);
+			*pbIsReady = FD_ISSET(pSock->sock, pReadfds);
 			break;
 		case NSDSEL_WR:
-			*pbIsReady = FD_ISSET(pSock->sock, &pThis->writefds);
+			*pbIsReady = FD_ISSET(pSock->sock, pWritefds);
 			break;
 		case NSDSEL_RDWR:
-			*pbIsReady =   FD_ISSET(pSock->sock, &pThis->readfds)
-				     | FD_ISSET(pSock->sock, &pThis->writefds);
+			*pbIsReady =   FD_ISSET(pSock->sock, pReadfds)
+				     | FD_ISSET(pSock->sock, pWritefds);
 			break;
 	}
 
diff -up rsyslog-4.4.2.unlimited-select/runtime/nsdsel_ptcp.h.orig rsyslog-4.4.2.unlimited-select/runtime/nsdsel_ptcp.h
--- rsyslog-4.4.2.unlimited-select/runtime/nsdsel_ptcp.h.orig	2009-12-02 17:57:15.000000000 +0100
+++ rsyslog-4.4.2.unlimited-select/runtime/nsdsel_ptcp.h	2009-12-02 17:48:41.000000000 +0100
@@ -31,8 +31,13 @@ typedef nsdsel_if_t nsdsel_ptcp_if_t; /*
 struct nsdsel_ptcp_s {
 	BEGINobjInstance;	/* Data to implement generic object - MUST be the first data element! */
 	int maxfds;
+#ifdef USE_UNLIMITED_SELECT
+	fd_set *pReadfds;
+	fd_set *pWritefds;
+#else
 	fd_set readfds;
 	fd_set writefds;
+#endif
 };
 
 /* interface is defined in nsd.h, we just implement it! */
diff -up rsyslog-4.4.2.unlimited-select/runtime/unlimited_select.h.orig rsyslog-4.4.2.unlimited-select/runtime/unlimited_select.h
--- rsyslog-4.4.2.unlimited-select/runtime/unlimited_select.h.orig	2009-12-02 18:21:15.000000000 +0100
+++ rsyslog-4.4.2.unlimited-select/runtime/unlimited_select.h	2009-12-02 17:51:35.000000000 +0100
@@ -0,0 +1,45 @@
+/* unlimited_select.h
+ * Tweak the macros for accessing fd_set so that the select() syscall
+ * won't be limited to a particular number of file descriptors.
+ *
+ * Copyright 2009 Rainer Gerhards and Adiscon GmbH.
+ *
+ * This file is part of rsyslog.
+ *
+ * Rsyslog is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Rsyslog is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Rsyslog.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * A copy of the GPL can be found in the file "COPYING" in this distribution.
+ */
+
+#ifndef	UNLIMITED_SELECT_H_INCLUDED
+
+#include <string.h>
+#include <stdlib.h>
+#include <sys/select.h>
+#include "glbl.h"
+
+#ifdef USE_UNLIMITED_SELECT
+# undef FD_ZERO
+# define FD_ZERO(set) memset((set), 0, glbl.GetFdSetSize());
+#endif
+
+#ifdef USE_UNLIMITED_SELECT
+void freeFdSet(fd_set *p) {
+        free(p);
+}
+#else
+# define freeFdSet(x)
+#endif
+
+#endif /* #ifndef UNLIMITED_SELECT_H_INCLUDED */
diff -up rsyslog-4.4.2.unlimited-select/tools/syslogd.c.orig rsyslog-4.4.2.unlimited-select/tools/syslogd.c
--- rsyslog-4.4.2.unlimited-select/tools/syslogd.c.orig	2009-12-02 17:57:55.000000000 +0100
+++ rsyslog-4.4.2.unlimited-select/tools/syslogd.c	2009-12-02 17:52:56.000000000 +0100
@@ -2150,6 +2150,9 @@ static rsRetVal setMaxFiles(void __attri
 				iFiles, errStr, (long) maxFiles.rlim_max);
 		ABORT_FINALIZE(RS_RET_ERR_RLIM_NOFILE);
 	}
+#ifdef USE_UNLIMITED_SELECT
+	glbl.SetFdSetSize(howmany(iFiles, __NFDBITS) * sizeof (fd_mask));
+#endif
 	DBGPRINTF("Max number of files set to %d [kernel max %ld].\n", iFiles, (long) maxFiles.rlim_max);
 
 finalize_it:


Index: .cvsignore
===================================================================
RCS file: /cvs/extras/rpms/rsyslog/F-12/.cvsignore,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -p -r1.33 -r1.34
--- .cvsignore	3 Sep 2009 12:23:12 -0000	1.33
+++ .cvsignore	3 Dec 2009 11:45:32 -0000	1.34
@@ -1 +1 @@
-rsyslog-4.4.1.tar.gz
+rsyslog-4.4.2.tar.gz


Index: rsyslog.spec
===================================================================
RCS file: /cvs/extras/rpms/rsyslog/F-12/rsyslog.spec,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -p -r1.64 -r1.65
--- rsyslog.spec	14 Sep 2009 16:54:26 -0000	1.64
+++ rsyslog.spec	3 Dec 2009 11:45:32 -0000	1.65
@@ -2,8 +2,8 @@
 
 Summary: Enhanced system logging and kernel message trapping daemons
 Name: rsyslog
-Version: 4.4.1
-Release: 2%{?dist}
+Version: 4.4.2
+Release: 1%{?dist}
 License: GPLv3+
 Group: System Environment/Daemons
 URL: http://www.rsyslog.com/
@@ -12,8 +12,9 @@ Source1: rsyslog.init
 Source2: rsyslog.conf
 Source3: rsyslog.sysconfig
 Source4: rsyslog.log
+Patch0: rsyslog-4.4.2-unlimited-select.patch
 BuildRequires: zlib-devel
-BuildRequires: autoconf automake
+BuildRequires: autoconf automake libtool
 Requires: logrotate >= 3.5.2
 Requires: bash >= 2.0
 Requires(post): /sbin/chkconfig coreutils
@@ -87,6 +88,8 @@ IETF standard protocol.
 
 %prep
 %setup -q
+%patch0 -p1 -b .unlimited-select
+aclocal && autoconf && automake
 
 %build
 export CFLAGS="$RPM_OPT_FLAGS -DSYSLOGD_PIDNAME=\\\"syslogd.pid\\\""
@@ -98,7 +101,8 @@ export CFLAGS="$RPM_OPT_FLAGS -DSYSLOGD_
 		--enable-gssapi-krb5 \
 		--enable-imfile \
 		--enable-relp \
-		--enable-gnutls
+		--enable-gnutls \
+		--enable-unlimited-select
 make %{?_smp_mflags}
 
 %install
@@ -194,6 +198,10 @@ fi	
 %{_libdir}/rsyslog/lmnsd_gtls.so
 
 %changelog
+* Thu Dec 03 2009 Tomas Heinrich <theinric at redhat.com> 4.4.2-1
+- upgrade to new upstream stable version 4.4.2
+- add support for arbitrary number of open file descriptors
+
 * Mon Sep 14 2009 Tomas Heinrich <theinric at redhat.com> 4.4.1-2
 - adjust init script according to guidelines (#522071)
 


Index: sources
===================================================================
RCS file: /cvs/extras/rpms/rsyslog/F-12/sources,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -p -r1.35 -r1.36
--- sources	3 Sep 2009 12:23:12 -0000	1.35
+++ sources	3 Dec 2009 11:45:32 -0000	1.36
@@ -1 +1 @@
-2f298222850a098834bbf8c651a9963c  rsyslog-4.4.1.tar.gz
+a8ada67b6cd5c00fbeb3a4b687b17359  rsyslog-4.4.2.tar.gz




More information about the fedora-extras-commits mailing list