[Pkg-clamav-commits] [SCM] Debian repository for ClamAV branch, debian/unstable, updated. debian/0.95+dfsg-1-6156-g094ec9b

Török Edvin edwin at clamav.net
Sun Apr 4 01:09:36 UTC 2010


The following commit has been merged in the debian/unstable branch:
commit 41feff650ce0052b4fe9adc25caa26a08a7ca3c1
Author: Török Edvin <edwin at clamav.net>
Date:   Tue Nov 24 10:25:41 2009 +0200

    Enable more than 256 FD support on Solaris (bb #1764).
    
    Solaris still doesn't have the fix for a bug filed in 1992 (!) enabled by default
    for the sake of binary compatibility.
    Each 32-bit application that wants to use more than 256 file descriptors must enable
    support explicitly, or use an LD_PRELOAD library at runtime that does this
    (or be compiled as 64-bit).
    Otherwise fdopen(),fopen(),.. fail when the file descriptor is >255.
    See http://developers.sun.com/solaris/articles/stdio_256.html

diff --git a/ChangeLog b/ChangeLog
index 3e96022..b823848 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Tue Nov 24 10:24:27 EET 2009 (edwin)
+------------------------------------
+ * clamd/server-th.c: enable more than 256 FD support on Solaris (bb #1764).
+
 Mon Nov 23 23:15:38 CET 2009 (tk)
 ---------------------------------
  * sigtool: --decode-sigs; decode .db entries (bb#1246)
diff --git a/clamd/server-th.c b/clamd/server-th.c
index 7d20795..5ccc6a7 100644
--- a/clamd/server-th.c
+++ b/clamd/server-th.c
@@ -41,6 +41,9 @@
 #endif
 
 #include <fcntl.h>
+#ifdef C_SOLARIS
+#include <stdio_ext.h>
+#endif
 #include "libclamav/clamav.h"
 
 #include "shared/output.h"
@@ -937,6 +940,18 @@ int recvloop_th(int *socketds, unsigned nsockets, struct cl_engine *engine, unsi
 	 * MaxThreads * MaxRecursion + (MaxQueue - MaxThreads) + CLAMDFILES < RLIMIT_NOFILE 
 	 * CLAMDFILES is 6: 3 standard FD + logfile + 2 FD for reloading the DB
 	 * */
+#ifdef C_SOLARIS
+#ifdef F_BADFD
+	if (enable_extended_FILE_stdio(-1, -1) == -1) {
+	    logg("^Unable to set extended FILE stdio, clamd will be limited to max 256 open files\n");
+	    rlim.rlim_cur = rlim.rlim_cur > 255 ? 255 : rlim.rlim_cur;
+	}
+#elif !defined(_LP64)
+	if (rlim.rlim_cur > 255) {
+	    logg("^Solaris only supports 256 open files for 32-bit processes, you need at least Solaris 10u4, or compile as 64-bit to support more!\n");
+	}
+#endif
+#endif
 	opt = optget(opts,"MaxRecursion");
 	maxrec = opt->numarg;
 	max_max_queue = rlim.rlim_cur - maxrec * max_threads - clamdfiles + max_threads;

-- 
Debian repository for ClamAV



More information about the Pkg-clamav-commits mailing list