zsh-workers
 help / color / mirror / code / Atom feed
* Patches for zsh on Mac OS X 10.4
@ 2005-04-03  8:43 Toby Peterson
  2005-04-04  9:57 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Toby Peterson @ 2005-04-03  8:43 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 378 bytes --]

Two patches (against current CVS) included...

rlimit-rss-as.diff: RLIMIT_RSS and RLIMIT_AS are the same. Patch  
includes configure check and source changes.

utmpx-apple.diff: We now include utmpx, but the struct has no ut_name  
field. I suspect this issue may occur on other platforms... Solaris 9  
and Fedora Core 2 didn't appear to have the field either.

- Toby Peterson

[-- Attachment #2: rlimit-rss-as.diff --]
[-- Type: application/octet-stream, Size: 2173 bytes --]

Index: configure.ac
===================================================================
RCS file: /cvsroot/zsh/zsh/configure.ac,v
retrieving revision 1.30
diff -u -r1.30 configure.ac
--- configure.ac	14 Mar 2005 10:51:17 -0000	1.30
+++ configure.ac	3 Apr 2005 08:37:44 -0000
@@ -1502,6 +1502,33 @@
 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 --------------------------------------------
Index: Src/Builtins/rlimits.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Builtins/rlimits.c,v
retrieving revision 1.13
diff -u -r1.13 rlimits.c
--- Src/Builtins/rlimits.c	19 Jan 2005 13:04:10 -0000	1.13
+++ Src/Builtins/rlimits.c	3 Apr 2005 08:37:44 -0000
@@ -242,7 +242,7 @@
 # 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 @@
 	    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

[-- Attachment #3: utmpx-apple.diff --]
[-- Type: application/octet-stream, Size: 512 bytes --]

Index: Src/watch.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/watch.c,v
retrieving revision 1.4
diff -u -r1.4 watch.c
--- Src/watch.c	2 Jun 2004 22:14:26 -0000	1.4
+++ Src/watch.c	3 Apr 2005 08:37:44 -0000
@@ -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)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Patches for zsh on Mac OS X 10.4
  2005-04-03  8:43 Patches for zsh on Mac OS X 10.4 Toby Peterson
@ 2005-04-04  9:57 ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2005-04-04  9:57 UTC (permalink / raw)
  To: Toby Peterson, zsh-workers

Toby Peterson wrote:
> utmpx-apple.diff: We now include utmpx, but the struct has no ut_name  
> field. I suspect this issue may occur on other platforms... Solaris 9  
> and Fedora Core 2 didn't appear to have the field either.

Yes, it looks like ut_user is standard in struct utmpx.  Solaris even
has ut_user in struct utmp, but #define's ut_name for
compatibility---this might be a clue to how the utmpx version currently
works on Solaris.

On the main line I'll commit this as follows:

/*
 * In utmpx, the ut_name field is replaced by ut_user.
 * Howver, on some systems ut_name may already be defined this
 * way for the purposes of utmp.
 */
# ifndef ut_name
#  define ut_name ut_user
# endif

but I don't dare try that out on the 4.2 branch.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

**********************************************************************


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-04-04  9:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-03  8:43 Patches for zsh on Mac OS X 10.4 Toby Peterson
2005-04-04  9:57 ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).