Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

spamd out of descriptors w/patch

From: Armin Wolfermann <aw(at)osn.de>
Date: Fri Apr 11 2003 - 09:44:59 EDT


Hi,

while spamd maintains up to a maximum of 200 connections, it's soft limit is set to 128 file descriptors. It dies silently if it exceeds that limit.

Index: spamd.c



RCS file: /cvs/src/libexec/spamd/spamd.c,v retrieving revision 1.29
diff -u -r1.29 spamd.c
--- spamd.c	30 Mar 2003 01:50:21 -0000	1.29
+++ spamd.c	11 Apr 2003 13:35:18 -0000

@@ -28,6 +28,7 @@
#include <sys/file.h>
#include <sys/wait.h>
#include <sys/socket.h>
+#include <sys/resource.h>  

#include <netinet/in.h>
#include <arpa/inet.h>

@@ -728,6 +729,7 @@

 	int sinlen, one = 1;
 	u_short port, cfg_port;
 	struct servent *ent;
+	struct rlimit rlp;
 
 	tzset();
 	openlog_r("spamd", LOG_PID | LOG_NDELAY, LOG_DAEMON, &sdata);
@@ -787,6 +789,10 @@  
 	for (i = 0; i < maxcon; i++)
 		con[i].fd = -1;
+
+	rlp.rlim_cur = rlp.rlim_max = maxcon + 7;
+	if (setrlimit(RLIMIT_NOFILE, &rlp) == -1)
+		err(1, "setrlimit");
 
 	signal(SIGPIPE, SIG_IGN);
 

Regards,
Armin Wolfermann Received on Fri Apr 11 09:45:48 2003

This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 13:29:53 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library