commit 0c75c75cc69c936a9398f254b524b2978f7626ea
Author: Tomáš Chvátal <tchvatal@suse.com>
Date:   Thu Apr 20 17:55:25 2017 +0200

    Reapply the files rlimit with fedora patch that thakes poll into efect

diff --git a/man/xinetd.conf.5 b/man/xinetd.conf.5
index b8462bf..c5e92c9 100644
--- a/xinetd/xinetd.conf.man
+++ b/xinetd/xinetd.conf.man
@@ -569,6 +569,12 @@ is implemented, it is more useful to set this limit than rlimit_data,
 rlimit_rss and rlimit_stack. This resource limit is only implemented on
 Linux systems.
 .TP
+.B rlimit_files
+Sets the maximum number of open files that the service may use.
+One parameter is required, which is a positive integer representing
+the number of open file descriptors. Practical limit of this number
+is around 1024000.
+.TP
 .B rlimit_cpu
 Sets the maximum number of CPU seconds that the service may use.
 One parameter is required, which is either a positive integer representing
diff --git a/xinetd/attr.h b/src/attr.h
index 25221a0..fa1b30a 100644
--- a/xinetd/attr.h
+++ b/xinetd/attr.h
@@ -61,12 +61,13 @@
 #define A_DISABLED         43
 #define A_MDNS             44
 #define A_LIBWRAP          45
+#define A_RLIMIT_FILES     46
 
 /*
  * SERVICE_ATTRIBUTES is the number of service attributes and also
  * the number from which defaults-only attributes start.
  */
-#define SERVICE_ATTRIBUTES      ( A_MDNS + 1 )
+#define SERVICE_ATTRIBUTES      ( A_MDNS + 2 )
 
 /*
  * Mask of attributes that must be specified.
diff --git a/xinetd/parse.c b/src/parse.c
index b40d28a..19b4bcb 100644
--- a/xinetd/parse.c
+++ b/xinetd/parse.c
@@ -92,6 +92,9 @@ static const struct attribute service_attributes[] =
 #ifdef RLIMIT_DATA
    { "rlimit_data",    A_RLIMIT_DATA,    1,  rlim_data_parser       },
 #endif
+#ifdef RLIMIT_NOFILE
+   { "rlimit_files",   A_RLIMIT_FILES,   1,  rlim_files_parser      },
+#endif
 #ifdef RLIMIT_RSS
    { "rlimit_rss",     A_RLIMIT_RSS,     1,  rlim_rss_parser        },
 #endif
diff --git a/xinetd/parsers.c b/src/parsers.c
index 2668b03..b59e5c2 100644
--- a/xinetd/parsers.c
+++ b/xinetd/parsers.c
@@ -1415,6 +1415,29 @@ status_e rlim_data_parser( pset_h values,
 }
 #endif
 
+#ifdef RLIMIT_NOFILE
+status_e rlim_files_parser( pset_h values, 
+                         struct service_config *scp, 
+                         enum assign_op op )
+{
+   char *mem = (char *) pset_pointer( values, 0 ) ;
+   const char *func = "rlim_files_parser" ;
+
+   if ( EQ( mem, "UNLIMITED" ) )
+      SC_RLIM_FILES(scp) = (rlim_t)RLIM_INFINITY ;
+   else
+   {
+      if ( get_limit ( mem, &SC_RLIM_FILES(scp)) )
+      {
+         parsemsg( LOG_ERR, func,
+            "Max files limit is invalid: %s", mem ) ;
+         return( FAILED ) ;
+      }
+   }
+   return( OK ) ;
+}
+#endif
+
 #ifdef RLIMIT_RSS
 status_e rlim_rss_parser( pset_h values, 
                           struct service_config *scp, 
diff --git a/xinetd/parsers.h b/src/parsers.h
index 50a5688..ab9c65a 100644
--- a/xinetd/parsers.h
+++ b/xinetd/parsers.h
@@ -57,6 +57,9 @@ status_e rlim_cpu_parser(pset_h, struct service_config *, enum assign_op) ;
 #ifdef RLIMIT_DATA
 status_e rlim_data_parser(pset_h, struct service_config *, enum assign_op) ;
 #endif
+#ifdef RLIMIT_NOFILE
+status_e rlim_files_parser(pset_h, struct service_config *, enum assign_op) ;
+#endif
 #ifdef RLIMIT_RSS
 status_e rlim_rss_parser(pset_h, struct service_config *, enum assign_op) ;
 #endif
diff --git a/xinetd/sconf.h b/src/sconf.h
index 762c03a..2b1e85f 100644
--- a/xinetd/sconf.h
+++ b/xinetd/sconf.h
@@ -141,6 +141,7 @@ struct service_config
    rlim_t               sc_rlim_as;
    rlim_t               sc_rlim_cpu;
    rlim_t               sc_rlim_data;
+   rlim_t               sc_rlim_files;
    rlim_t               sc_rlim_rss;
    rlim_t               sc_rlim_stack;
    mode_t               sc_umask;
@@ -189,6 +190,7 @@ struct service_config
 #define SC_RLIM_AS( scp )        (scp)->sc_rlim_as
 #define SC_RLIM_CPU( scp )       (scp)->sc_rlim_cpu
 #define SC_RLIM_DATA( scp )      (scp)->sc_rlim_data
+#define SC_RLIM_FILES( scp )     (scp)->sc_rlim_files
 #define SC_RLIM_RSS( scp )       (scp)->sc_rlim_rss
 #define SC_RLIM_STACK( scp )     (scp)->sc_rlim_stack
 #define SC_TYPE( scp )           (scp)->sc_type
