|
|
01101d |
diff -Nurp xinetd-2.3.14-orig/xinetd/attr.h xinetd-2.3.14-files/xinetd/attr.h
|
|
|
01101d |
--- xinetd-2.3.14-orig/xinetd/attr.h 2005-10-05 19:15:33.000000000 +0200
|
|
|
01101d |
+++ xinetd-2.3.14-files/xinetd/attr.h 2009-10-20 13:08:45.000000000 +0200
|
|
|
01101d |
@@ -61,12 +61,13 @@
|
|
|
01101d |
#define A_DISABLED 43
|
|
|
01101d |
#define A_MDNS 44
|
|
|
01101d |
#define A_LIBWRAP 45
|
|
|
01101d |
+#define A_RLIMIT_FILES 46
|
|
|
01101d |
|
|
|
01101d |
/*
|
|
|
01101d |
* SERVICE_ATTRIBUTES is the number of service attributes and also
|
|
|
01101d |
* the number from which defaults-only attributes start.
|
|
|
01101d |
*/
|
|
|
01101d |
-#define SERVICE_ATTRIBUTES ( A_MDNS + 1 )
|
|
|
01101d |
+#define SERVICE_ATTRIBUTES ( A_MDNS + 2 )
|
|
|
01101d |
|
|
|
01101d |
/*
|
|
|
01101d |
* Mask of attributes that must be specified.
|
|
|
01101d |
diff -Nurp xinetd-2.3.14-orig/xinetd/child.c xinetd-2.3.14-files/xinetd/child.c
|
|
|
01101d |
--- xinetd-2.3.14-orig/xinetd/child.c 2009-10-20 13:07:34.000000000 +0200
|
|
|
01101d |
+++ xinetd-2.3.14-files/xinetd/child.c 2009-10-20 13:10:16.000000000 +0200
|
|
|
01101d |
@@ -109,6 +109,10 @@ void exec_server( const struct server *s
|
|
|
01101d |
|
|
|
01101d |
|
|
|
01101d |
#ifdef RLIMIT_NOFILE
|
|
|
01101d |
+ if ( SC_RLIM_FILES( scp ))
|
|
|
01101d |
+ {
|
|
|
01101d |
+ ps.ros.max_descriptors = SC_RLIM_FILES( scp );
|
|
|
01101d |
+ }
|
|
|
01101d |
rl.rlim_max = rl.rlim_cur = ps.ros.max_descriptors ;
|
|
|
01101d |
(void) setrlimit( RLIMIT_NOFILE, &rl ) ;
|
|
|
01101d |
#endif
|
|
|
01101d |
diff -Nurp xinetd-2.3.14-orig/xinetd/parse.c xinetd-2.3.14-files/xinetd/parse.c
|
|
|
01101d |
--- xinetd-2.3.14-orig/xinetd/parse.c 2005-10-05 19:15:33.000000000 +0200
|
|
|
01101d |
+++ xinetd-2.3.14-files/xinetd/parse.c 2009-10-20 13:08:45.000000000 +0200
|
|
|
01101d |
@@ -92,6 +92,9 @@ static const struct attribute service_at
|
|
|
01101d |
#ifdef RLIMIT_DATA
|
|
|
01101d |
{ "rlimit_data", A_RLIMIT_DATA, 1, rlim_data_parser },
|
|
|
01101d |
#endif
|
|
|
01101d |
+#ifdef RLIMIT_NOFILE
|
|
|
01101d |
+ { "rlimit_files", A_RLIMIT_FILES, 1, rlim_files_parser },
|
|
|
01101d |
+#endif
|
|
|
01101d |
#ifdef RLIMIT_RSS
|
|
|
01101d |
{ "rlimit_rss", A_RLIMIT_RSS, 1, rlim_rss_parser },
|
|
|
01101d |
#endif
|
|
|
01101d |
diff -Nurp xinetd-2.3.14-orig/xinetd/parsers.c xinetd-2.3.14-files/xinetd/parsers.c
|
|
|
01101d |
--- xinetd-2.3.14-orig/xinetd/parsers.c 2005-10-05 23:45:41.000000000 +0200
|
|
|
01101d |
+++ xinetd-2.3.14-files/xinetd/parsers.c 2009-10-20 13:08:45.000000000 +0200
|
|
|
01101d |
@@ -1415,6 +1415,29 @@ status_e rlim_data_parser( pset_h values
|
|
|
01101d |
}
|
|
|
01101d |
#endif
|
|
|
01101d |
|
|
|
01101d |
+#ifdef RLIMIT_NOFILE
|
|
|
01101d |
+status_e rlim_files_parser( pset_h values,
|
|
|
01101d |
+ struct service_config *scp,
|
|
|
01101d |
+ enum assign_op op )
|
|
|
01101d |
+{
|
|
|
01101d |
+ char *mem = (char *) pset_pointer( values, 0 ) ;
|
|
|
01101d |
+ const char *func = "rlim_files_parser" ;
|
|
|
01101d |
+
|
|
|
01101d |
+ if ( EQ( mem, "UNLIMITED" ) )
|
|
|
01101d |
+ SC_RLIM_FILES(scp) = (rlim_t)RLIM_INFINITY ;
|
|
|
01101d |
+ else
|
|
|
01101d |
+ {
|
|
|
01101d |
+ if ( get_limit ( mem, &SC_RLIM_FILES(scp)) )
|
|
|
01101d |
+ {
|
|
|
01101d |
+ parsemsg( LOG_ERR, func,
|
|
|
01101d |
+ "Max files limit is invalid: %s", mem ) ;
|
|
|
01101d |
+ return( FAILED ) ;
|
|
|
01101d |
+ }
|
|
|
01101d |
+ }
|
|
|
01101d |
+ return( OK ) ;
|
|
|
01101d |
+}
|
|
|
01101d |
+#endif
|
|
|
01101d |
+
|
|
|
01101d |
#ifdef RLIMIT_RSS
|
|
|
01101d |
status_e rlim_rss_parser( pset_h values,
|
|
|
01101d |
struct service_config *scp,
|
|
|
01101d |
diff -Nurp xinetd-2.3.14-orig/xinetd/parsers.h xinetd-2.3.14-files/xinetd/parsers.h
|
|
|
01101d |
--- xinetd-2.3.14-orig/xinetd/parsers.h 2005-10-05 19:15:33.000000000 +0200
|
|
|
01101d |
+++ xinetd-2.3.14-files/xinetd/parsers.h 2009-10-20 13:08:45.000000000 +0200
|
|
|
01101d |
@@ -57,6 +57,9 @@ status_e rlim_cpu_parser(pset_h, struct
|
|
|
01101d |
#ifdef RLIMIT_DATA
|
|
|
01101d |
status_e rlim_data_parser(pset_h, struct service_config *, enum assign_op) ;
|
|
|
01101d |
#endif
|
|
|
01101d |
+#ifdef RLIMIT_NOFILE
|
|
|
01101d |
+status_e rlim_files_parser(pset_h, struct service_config *, enum assign_op) ;
|
|
|
01101d |
+#endif
|
|
|
01101d |
#ifdef RLIMIT_RSS
|
|
|
01101d |
status_e rlim_rss_parser(pset_h, struct service_config *, enum assign_op) ;
|
|
|
01101d |
#endif
|
|
|
01101d |
diff -Nurp xinetd-2.3.14-orig/xinetd/sconf.h xinetd-2.3.14-files/xinetd/sconf.h
|
|
|
01101d |
--- xinetd-2.3.14-orig/xinetd/sconf.h 2009-10-20 13:07:34.000000000 +0200
|
|
|
01101d |
+++ xinetd-2.3.14-files/xinetd/sconf.h 2009-10-20 13:08:45.000000000 +0200
|
|
|
01101d |
@@ -143,6 +143,7 @@ struct service_config
|
|
|
01101d |
rlim_t sc_rlim_as;
|
|
|
01101d |
rlim_t sc_rlim_cpu;
|
|
|
01101d |
rlim_t sc_rlim_data;
|
|
|
01101d |
+ rlim_t sc_rlim_files;
|
|
|
01101d |
rlim_t sc_rlim_rss;
|
|
|
01101d |
rlim_t sc_rlim_stack;
|
|
|
01101d |
mode_t sc_umask;
|
|
|
01101d |
@@ -191,6 +192,7 @@ struct service_config
|
|
|
01101d |
#define SC_RLIM_AS( scp ) (scp)->sc_rlim_as
|
|
|
01101d |
#define SC_RLIM_CPU( scp ) (scp)->sc_rlim_cpu
|
|
|
01101d |
#define SC_RLIM_DATA( scp ) (scp)->sc_rlim_data
|
|
|
01101d |
+#define SC_RLIM_FILES( scp ) (scp)->sc_rlim_files
|
|
|
01101d |
#define SC_RLIM_RSS( scp ) (scp)->sc_rlim_rss
|
|
|
01101d |
#define SC_RLIM_STACK( scp ) (scp)->sc_rlim_stack
|
|
|
01101d |
#define SC_TYPE( scp ) (scp)->sc_type
|
|
|
01101d |
diff -Nurp xinetd-2.3.14-orig/xinetd/xinetd.conf.man xinetd-2.3.14-files/xinetd/xinetd.conf.man
|
|
|
01101d |
--- xinetd-2.3.14-orig/xinetd/xinetd.conf.man 2009-10-20 13:07:34.000000000 +0200
|
|
|
01101d |
+++ xinetd-2.3.14-files/xinetd/xinetd.conf.man 2009-10-20 13:08:45.000000000 +0200
|
|
|
01101d |
@@ -569,6 +569,12 @@ is implemented, it is more useful to set
|
|
|
01101d |
rlimit_rss and rlimit_stack. This resource limit is only implemented on
|
|
|
01101d |
Linux systems.
|
|
|
01101d |
.TP
|
|
|
01101d |
+.B rlimit_files
|
|
|
01101d |
+Sets the maximum number of open files that the service may use.
|
|
|
01101d |
+One parameter is required, which is a positive integer representing
|
|
|
01101d |
+the number of open file descriptors. Practical limit of this number
|
|
|
01101d |
+is around 1024000.
|
|
|
01101d |
+.TP
|
|
|
01101d |
.B rlimit_cpu
|
|
|
01101d |
Sets the maximum number of CPU seconds that the service may use.
|
|
|
01101d |
One parameter is required, which is either a positive integer representing
|