about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2005-04-04 10:00:25 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2005-04-04 10:00:25 +0000
commitf12ca5fd8ee8922c6950a398e21286f2d59a428a (patch)
treec5ed303bac133ef9a5eb4ab5468cf8b862ea6fc1
parent6df44faf120b4abf8bf259a3d50deb1637335e54 (diff)
downloadzsh-f12ca5fd8ee8922c6950a398e21286f2d59a428a.tar.gz
zsh-f12ca5fd8ee8922c6950a398e21286f2d59a428a.tar.xz
zsh-f12ca5fd8ee8922c6950a398e21286f2d59a428a.zip
Toby Peterson: 21083: RLIMIT_AS and RLIMIT_RSS are the same in Mac OX X
ut_name needs to be ut_user in struct utmpx
-rw-r--r--ChangeLog3
-rw-r--r--Src/Builtins/rlimits.c4
-rw-r--r--Src/watch.c13
-rw-r--r--configure.ac27
4 files changed, 41 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index d25f9fd2d..4488e135f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2005-04-04  Peter Stephenson  <pws@csr.com>
 
+	* Toby Peterson: 21083: On Mac OS X 10.4, the AS and RSS rlimits
+	are the same.  Also utmpx doesn't have ut_name.
+
 	* Dan Nelson: 21082: Src/exec.c, Test/A01grammar.ztst: fix zsh -c
 	exit status on parse error.
 
diff --git a/Src/Builtins/rlimits.c b/Src/Builtins/rlimits.c
index 9256f25b2..922a182a2 100644
--- a/Src/Builtins/rlimits.c
+++ b/Src/Builtins/rlimits.c
@@ -242,7 +242,7 @@ printulimit(char *nam, int lim, int hard, int head)
 # endif /* HAVE_RLIMIT_MEMLOCK */
 /* If RLIMIT_VMEM and RLIMIT_RSS are defined and equal, avoid *
  * duplicate case statement.  Observed on QNX Neutrino 6.1.0. */
-# if defined(HAVE_RLIMIT_RSS) && !defined(RLIMIT_VMEM_IS_RSS)
+# if defined(HAVE_RLIMIT_RSS) && !defined(RLIMIT_VMEM_IS_RSS) && !defined(RLIMIT_RSS_IS_AS)
     case RLIMIT_RSS:
 	if (head)
 	    printf("-m: resident set size (kbytes) ");
@@ -834,7 +834,7 @@ bin_ulimit(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
 	    case RLIMIT_VMEM:
 # endif /* HAVE_RLIMIT_VMEM */
 /* ditto RLIMIT_VMEM and RLIMIT_AS */
-# if defined(HAVE_RLIMIT_AS) && !defined(RLIMIT_VMEM_IS_AS)
+# if defined(HAVE_RLIMIT_AS) && !defined(RLIMIT_VMEM_IS_AS) && !defined(RLIMIT_RSS_IS_AS)
 	    case RLIMIT_AS:
 # endif /* HAVE_RLIMIT_AS */
 # ifdef HAVE_RLIMIT_AIO_MEM
diff --git a/Src/watch.c b/Src/watch.c
index 6fe77afcd..9b2c22bdd 100644
--- a/Src/watch.c
+++ b/Src/watch.c
@@ -103,6 +103,9 @@
 # ifdef HAVE_STRUCT_UTMPX_UT_HOST
 #  define WATCH_UTMP_UT_HOST 1
 # endif
+# ifdef __APPLE__
+#  define ut_name ut_user
+# endif
 #endif
 
 #if !defined(WATCH_STRUCT_UTMP) && defined(HAVE_STRUCT_UTMP) && defined(REAL_UTMP_FILE)
@@ -491,8 +494,6 @@ dowatch(void)
     int uct, wct;
 
     s = watch;
-    if (!(fmt = getsparam("WATCHFMT")))
-	fmt = DEFAULT_WATCHFMT;
 
     holdintr();
     if (!wtab) {
@@ -542,6 +543,9 @@ dowatch(void)
 	free(utab);
 	return;
     }
+    queue_signals();
+    if (!(fmt = getsparam("WATCHFMT")))
+	fmt = DEFAULT_WATCHFMT;
     while ((uct || wct) && !errflag)
 	if (!uct || (wct && ucmp(uptr, wptr) > 0))
 	    wct--, watchlog(0, wptr++, s, fmt);
@@ -549,6 +553,7 @@ dowatch(void)
 	    uct--, watchlog(1, uptr++, s, fmt);
 	else
 	    uptr++, wptr++, wct--, uct--;
+    unqueue_signals();
     free(wtab);
     wtab = utab;
     wtabsz = utabsz;
@@ -557,7 +562,7 @@ dowatch(void)
 
 /**/
 int
-bin_log(char *nam, char **argv, char *ops, int func)
+bin_log(UNUSED(char *nam), UNUSED(char **argv), UNUSED(Options ops), UNUSED(int func))
 {
     if (!watch)
 	return 1;
@@ -579,7 +584,7 @@ void dowatch(void)
 
 /**/
 int
-bin_log(char *nam, char **argv, char *ops, int func)
+bin_log(char *nam, char **argv, Options ops, int func)
 {
     return bin_notavail(nam, argv, ops, func);
 }
diff --git a/configure.ac b/configure.ac
index dcc0acf96..da38620d0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1501,6 +1501,33 @@ if test $zsh_cv_rlimit_vmem_is_as = yes; then
 fi
 
 
+AH_TEMPLATE([RLIMIT_RSS_IS_AS],
+[Define to 1 if RLIMIT_RSS and RLIMIT_AS both exist and are equal.])
+AC_CACHE_CHECK(if RLIMIT_RSS and RLIMIT_AS are the same,
+zsh_cv_rlimit_rss_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_RSS) && defined(HAVE_RLIMIT_AS)
+if (RLIMIT_AS == RLIMIT_RSS) ret = 0;
+#endif
+return ret;
+}],
+  zsh_cv_rlimit_rss_is_as=yes,
+  zsh_cv_rlimit_rss_is_as=no,
+  zsh_cv_rlimit_rss_is_as=no)])
+
+if test $zsh_cv_rlimit_rss_is_as = yes; then
+  AC_DEFINE(RLIMIT_RSS_IS_AS)
+fi
+
+
 dnl --------------------------------------------
 dnl Check for members of struct rusage
 dnl --------------------------------------------