Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: RLIMITS macros
- X-seq: zsh-workers 18419
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-workers@xxxxxxxxxx (Zsh hackers list)
- Subject: Re: PATCH: RLIMITS macros
- Date: Tue, 01 Apr 2003 11:20:49 +0100
- In-reply-to: "Peter Stephenson"'s message of "Tue, 01 Apr 2003 10:40:04 BST." <2067.1049190004@xxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
Peter Stephenson wrote:
> Does that mean RLIMIT_AS and RLIMIT_VMEM aren't actually definitions at
> all? That's the only conclusion I can see. Presumably it's necessary
> to test compilation with RLIMIT_VMEM, RLIMIT_RSS, RLIMIT_AS, use
> these to define HAVE_RLIMIT_VMEM, HAVE_RLIMIT_RSS, HAVE_RLIMIT_AS, and
> replace the #ifdef's in the configure tests with those.
[OK, now running in gung-ho mode and not waiting for responses.]
This is about the best I can come up with. If this doesn't work, I'm
stuck. This is a cumulative patch of the old bit and the new bit since
I haven't committed anything yet.
Index: acconfig.h
===================================================================
RCS file: /cvsroot/zsh/zsh/acconfig.h,v
retrieving revision 1.14
diff -u -r1.14 acconfig.h
--- acconfig.h 6 May 2002 14:50:10 -0000 1.14
+++ acconfig.h 1 Apr 2003 10:16:24 -0000
@@ -238,6 +238,21 @@
/* Define to the type used in struct rlimit */
#undef rlim_t
+/* Define to 1 if RLIMIT_VMEM is present (whether or not as a macro) */
+#undef HAVE_RLIMIT_VMEM
+
+/* Define to 1 if RLIMIT_RSS is present (whether or not as a macro) */
+#undef HAVE_RLIMIT_RSS
+
+/* Define to 1 if RLIMIT_AS is present (whether or not as a macro) */
+#undef HAVE_RLIMIT_AS
+
+/* Define to 1 if RLIMIT_VMEM and RLIMIT_RSS both exist and are equal */
+#undef RLIMIT_VMEM_IS_RSS
+
+/* Define to 1 if RLIMIT_VMEM and RLIMIT_AS both exist and are equal */
+#undef RLIMIT_VMEM_IS_AS
+
/* Define to 1 if /bin/sh does not interpret \ escape sequences */
#undef SH_USE_BSD_ECHO
Index: zshconfig.ac
===================================================================
RCS file: /cvsroot/zsh/zsh/zshconfig.ac,v
retrieving revision 1.35
diff -u -r1.35 zshconfig.ac
--- zshconfig.ac 24 Mar 2003 12:56:59 -0000 1.35
+++ zshconfig.ac 1 Apr 2003 10:16:24 -0000
@@ -1221,6 +1221,109 @@
AC_DEFINE_UNQUOTED(rlim_t, $DEFAULT_RLIM_T)
fi
+
+dnl On some systems the RLIMIT_* are macros which don't evaluate
+dnl to integers at compile time. In this case we are not able to
+dnl do preprocessor comparisions and need our tests to determine
+dnl if there are clashing definitions.
+AC_CACHE_CHECK(if RLIMIT_VMEM exists,
+zsh_cv_rlimit_vmem,
+[AC_TRY_COMPILE([
+#include <sys/types.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <sys/resource.h>],
+[RLIMIT_VMEM],
+ zsh_cv_rlimit_vmem=yes,
+ zsh_cv_rlimit_vmem=no)])
+
+if test $zsh_cv_rlimit_vmem = yes; then
+ AC_DEFINE(HAVE_RLIMIT_VMEM)
+fi
+
+AC_CACHE_CHECK(if RLIMIT_RSS exists,
+zsh_cv_rlimit_rss,
+[AC_TRY_COMPILE([
+#include <sys/types.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <sys/resource.h>],
+[RLIMIT_RSS],
+ zsh_cv_rlimit_rss=yes,
+ zsh_cv_rlimit_rss=no)])
+
+if test $zsh_cv_rlimit_rss = yes; then
+ AC_DEFINE(HAVE_RLIMIT_RSS)
+fi
+
+AC_CACHE_CHECK(if RLIMIT_AS exists,
+zsh_cv_rlimit_as,
+[AC_TRY_COMPILE([
+#include <sys/types.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <sys/resource.h>],
+[RLIMIT_AS],
+ zsh_cv_rlimit_as=yes,
+ zsh_cv_rlimit_as=no)])
+
+if test $zsh_cv_rlimit_as = yes; then
+ AC_DEFINE(HAVE_RLIMIT_AS)
+fi
+
+AC_CACHE_CHECK(if RLIMIT_VMEM and RLIMIT_RSS are the same,
+zsh_cv_rlimit_vmem_is_rss,
+[AC_TRY_RUN([
+#include <sys/types.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <sys/resource.h>
+int main()
+{
+int ret = 1;
+#if defined(HAVE_RLIMIT_VMEM) && defined(HAVE_RLIMIT_RSS)
+if (RLIMIT_RSS == RLIMIT_VMEM) ret = 0;
+#endif
+return ret;
+}],
+ zsh_cv_rlimit_vmem_is_rss=yes,
+ zsh_cv_rlimit_vmem_is_rss=no,
+ zsh_cv_rlimit_vmem_is_rss=no)])
+
+if test $zsh_cv_rlimit_vmem_is_rss = yes; then
+ AC_DEFINE(RLIMIT_VMEM_IS_RSS)
+fi
+
+
+AC_CACHE_CHECK(if RLIMIT_VMEM and RLIMIT_AS are the same,
+zsh_cv_rlimit_vmem_is_as,
+[AC_TRY_RUN([
+#include <sys/types.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <sys/resource.h>
+int main()
+{
+int ret = 1;
+#if defined(HAVE_RLIMIT_VMEM) && defined(HAVE_RLIMIT_AS)
+if (RLIMIT_AS == RLIMIT_VMEM) ret = 0;
+#endif
+return ret;
+}],
+ zsh_cv_rlimit_vmem_is_as=yes,
+ zsh_cv_rlimit_vmem_is_as=no,
+ zsh_cv_rlimit_vmem_is_as=no)])
+
+if test $zsh_cv_rlimit_vmem_is_as = yes; then
+ AC_DEFINE(RLIMIT_VMEM_IS_AS)
+fi
+
+
dnl ----------------------------
dnl CHECK FOR /dev/fd FILESYSTEM
dnl ----------------------------
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070
**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential
and/or privileged material.
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by
persons or entities other than the intended recipient is
prohibited.
If you received this in error, please contact the sender and
delete the material from any computer.
**********************************************************************
Messages sorted by:
Reverse Date,
Date,
Thread,
Author