Mailing List Archive

cvs commit: apache-2.0/src/os/unix unixd.c
jim 00/08/23 16:28:55

Modified: src CHANGES
src/lib/apr configure.in
src/lib/apr/include apr.h.in
src/lib/apr/threadproc/unix proc.c
src/os/unix unixd.c
Log:
We need to test specifically for setrlimit/getrlimit instead of
just the structure or the RLIMIT_* defines. Also, we should make
the API function unixd_set_rlimit() ``available'' even if it
doesn't do anything.

Revision Changes Path
1.214 +5 -0 apache-2.0/src/CHANGES

Index: CHANGES
===================================================================
RCS file: /home/cvs/apache-2.0/src/CHANGES,v
retrieving revision 1.213
retrieving revision 1.214
diff -u -r1.213 -r1.214
--- CHANGES 2000/08/23 20:16:20 1.213
+++ CHANGES 2000/08/23 23:28:44 1.214
@@ -1,5 +1,10 @@
Changes with Apache 2.0a7

+ *) Minor revamp of the rlimit sections of code. We now test
+ explicitly for setrlimit and getrlimit. Also, unixd_set_rlimit()
+ is now "available" even if the platform doesn't support
+ the rlimit family (it's just a noop though). [Jim Jagielski]
+
*) Migrate the pre-selection of which MPM to use for specific
platforms to hints.m4, which contains (or should contain)
all platform specific "hints". [Jim Jagielski]



1.145 +4 -0 apache-2.0/src/lib/apr/configure.in

Index: configure.in
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/configure.in,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -r1.144 -r1.145
--- configure.in 2000/08/18 15:33:08 1.144
+++ configure.in 2000/08/23 23:28:46 1.145
@@ -215,6 +215,8 @@
dnl Checks for library functions. (N.B. poll is further down)
AC_CHECK_FUNCS(strcasecmp stricmp setsid nl_langinfo)
AC_CHECK_FUNCS(sigaction, [ have_sigaction="1" ], [ have_sigaction="0" ])
+AC_CHECK_FUNCS(setrlimit, [ have_setrlimit="1" ], [ have_setrlimit="0" ])
+AC_CHECK_FUNCS(getrlimit, [ have_getrlimit="1" ], [ have_getrlimit="0" ])
AC_CHECK_FUNCS(writev)
sendfile="0"
AC_CHECK_FUNCS(sendfile send_file, [ sendfile="1" ])
@@ -238,6 +240,8 @@
AC_SUBST(inet_addr)
AC_SUBST(inet_network)
AC_SUBST(have_sigaction)
+AC_SUBST(have_setrlimit)
+AC_SUBST(have_getrlimit)
AC_SUBST(iconv)
AC_SUBST(mmap)
AC_SUBST(have_memmove)



1.40 +2 -0 apache-2.0/src/lib/apr/include/apr.h.in

Index: apr.h.in
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr.h.in,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- apr.h.in 2000/08/06 06:07:07 1.39
+++ apr.h.in 2000/08/23 23:28:47 1.40
@@ -63,6 +63,8 @@
#define APR_HAVE_INET_NETWORK @inet_network@
#define APR_HAVE_UNION_SEMUN @have_union_semun@
#define APR_HAVE_STRUCT_RLIMIT @struct_rlimit@
+#define APR_HAVE_SETRLIMIT @have_setrlimit@
+#define APR_HAVE_GETRLIMIT @have_getrlimit@
#define APR_HAVE_STRICMP @have_stricmp@
#define APR_HAVE_STRNICMP @have_strnicmp@
#define APR_HAVE_STRCASECMP @have_strcasecmp@



1.37 +7 -6 apache-2.0/src/lib/apr/threadproc/unix/proc.c

Index: proc.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/threadproc/unix/proc.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- proc.c 2000/08/06 06:07:32 1.36
+++ proc.c 2000/08/23 23:28:49 1.37
@@ -225,10 +225,9 @@
return APR_INPARENT;
}

-#if APR_HAVE_STRUCT_RLIMIT
-#if defined(RLIMIT_CPU) || defined(RLIMIT_NPROC) || defined(RLIMIT_AS) || defined(RLIMIT_DATA) || defined(RLIMIT_VMEM)
static apr_status_t limit_proc(apr_procattr_t *attr)
{
+#if APR_HAVE_STRUCT_RLIMIT && APR_HAVE_SETRLIMIT
#ifdef RLIMIT_CPU
if (attr->limit_cpu != NULL) {
if ((setrlimit(RLIMIT_CPU, attr->limit_cpu)) != 0) {
@@ -262,10 +261,14 @@
}
}
#endif
+#else
+ /*
+ * Maybe make a note in error_log that setrlimit isn't supported??
+ */
+
+#endif
return APR_SUCCESS;
}
-#endif
-#endif

apr_status_t apr_create_process(apr_proc_t *new, const char *progname,
char *const args[], char **env,
@@ -310,11 +313,9 @@

apr_cleanup_for_exec();

-#if defined(RLIMIT_CPU) || defined(RLIMIT_NPROC) || defined(RLIMIT_AS) || defined(RLIMIT_DATA) || defined(RLIMIT_VMEM)
if ((status = limit_proc(attr)) != APR_SUCCESS) {
return status;
}
-#endif

if (attr->cmdtype == APR_SHELLCMD) {
i = 0;



1.24 +6 -2 apache-2.0/src/os/unix/unixd.c

Index: unixd.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/os/unix/unixd.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- unixd.c 2000/08/02 05:27:28 1.23
+++ unixd.c 2000/08/23 23:28:54 1.24
@@ -339,10 +339,10 @@
}
#endif /* NEED_AP_SYS_SIGLIST */

-#if defined(RLIMIT_CPU) || defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_NPROC) || defined(RLIMIT_AS)
API_EXPORT(void) unixd_set_rlimit(cmd_parms *cmd, struct rlimit **plimit,
const char *arg, const char * arg2, int type)
{
+#if (defined(RLIMIT_CPU) || defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_NPROC) || defined(RLIMIT_AS)) && APR_HAVE_STRUCT_RLIMIT && APR_HAVE_GETRLIMIT
char *str;
struct rlimit *limit;
/* If your platform doesn't define rlim_t then typedef it in ap_config.h */
@@ -392,6 +392,10 @@
limit->rlim_max = max;
}
}
-}
+#else
+
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, cmd->server,
+ "Platform does not support rlimit for %s", cmd->cmd->name);
#endif
+}