brianp 2002/07/08 18:33:42
Modified: . CHANGES
include apr_thread_proc.h
include/arch/unix threadproc.h
threadproc/unix proc.c
Log:
added support for changing the limit on file descriptors per process
Revision Changes Path
1.304 +4 -1 apr/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apr/CHANGES,v
retrieving revision 1.303
retrieving revision 1.304
diff -u -r1.303 -r1.304
--- CHANGES 8 Jul 2002 15:32:43 -0000 1.303
+++ CHANGES 9 Jul 2002 01:33:42 -0000 1.304
@@ -1,5 +1,8 @@
Changes with APR b1
-
+ *) Added APR_LIMIT_NOFILE option to apr_procattr_limit_set() to
+ control the file descriptor limit on platforms that support
+ RLIMIT_NOFILE. [Brian Pane]
+
*) FreeBSD: change apr_sendfile to accomodate a 4.6 kernel patch.
[Greg Ames]
1.87 +3 -0 apr/include/apr_thread_proc.h
Index: apr_thread_proc.h
===================================================================
RCS file: /home/cvs/apr/include/apr_thread_proc.h,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -r1.86 -r1.87
--- apr_thread_proc.h 11 Apr 2002 04:36:54 -0000 1.86
+++ apr_thread_proc.h 9 Jul 2002 01:33:42 -0000 1.87
@@ -127,6 +127,8 @@
#define APR_LIMIT_MEM 1
/** @see apr_procattr_limit_set */
#define APR_LIMIT_NPROC 2
+/** @see apr_procattr_limit_set */
+#define APR_LIMIT_NOFILE 3
#if APR_HAS_OTHER_CHILD || defined(DOXYGEN)
/**
@@ -469,6 +471,7 @@
* APR_LIMIT_CPU
* APR_LIMIT_MEM
* APR_LIMIT_NPROC
+ * APR_LIMIT_NOFILE
* </PRE>
* @param limit Value to set the limit to.
*/
1.24 +3 -0 apr/include/arch/unix/threadproc.h
Index: threadproc.h
===================================================================
RCS file: /home/cvs/apr/include/arch/unix/threadproc.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- threadproc.h 19 Mar 2002 17:53:59 -0000 1.23
+++ threadproc.h 9 Jul 2002 01:33:42 -0000 1.24
@@ -131,6 +131,9 @@
#ifdef RLIMIT_NPROC
struct rlimit *limit_nproc;
#endif
+#ifdef RLIMIT_NOFILE
+ struct rlimit *limit_nofile;
+#endif
};
#endif /* ! THREAD_PROC_H */
1.60 +15 -0 apr/threadproc/unix/proc.c
Index: proc.c
===================================================================
RCS file: /home/cvs/apr/threadproc/unix/proc.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- proc.c 19 Mar 2002 18:31:08 -0000 1.59
+++ proc.c 9 Jul 2002 01:33:42 -0000 1.60
@@ -260,6 +260,13 @@
}
}
#endif
+#ifdef RLIMIT_NOFILE
+ if (attr->limit_nofile != NULL) {
+ if ((setrlimit(RLIMIT_NOFILE, attr->limit_nofile)) != 0) {
+ return errno;
+ }
+ }
+#endif
#if defined(RLIMIT_AS)
if (attr->limit_mem != NULL) {
if ((setrlimit(RLIMIT_AS, attr->limit_mem)) != 0) {
@@ -523,6 +530,14 @@
case APR_LIMIT_NPROC:
#ifdef RLIMIT_NPROC
attr->limit_nproc = limit;
+ break;
+#else
+ return APR_ENOTIMPL;
+#endif
+
+ case APR_LIMIT_NOFILE:
+#ifdef RLIMIT_NOFILE
+ attr->limit_nofile = limit;
break;
#else
return APR_ENOTIMPL;