zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@ifh.de>
To: zsh-workers@math.gatech.edu (Zsh hackers list)
Subject: Limit type
Date: Fri, 03 Jan 1997 17:25:58 +0100	[thread overview]
Message-ID: <199701031625.RAA01278@hydra.ifh.de> (raw)

On Irix, the type returned by limits is unsigned long, whereas zsh
assumes it is long.  Here, this is in particular a problem for filesize,
which comes out as 0 instead of 4095MB.

This fix is only partial.  It makes configure look for a definition of
rlim_t where it found the RLIMIT macros (and for good measure in
/usr/include/sys/resource.h in case they're different) and uses that.
The value printed is now correct.  (The division by 1M rather luckily
means not having to worry about the presence or absence of a sign bit.)

Unfortunately, this isn't the end of the matter, since zsh really
needs to know more specifically about the types when it is converting
from and to a string.  This would require configure to decide on a
particular type and define an appropriate macro (such as the existing
RLIM_T_IS_QUAD_T which after the patch is still defined ad hoc in
system.h).  I haven't had the strength to do this at the moment.  I
think the thing to do is alter zstrtoq() in utils.c to zstrtorlim_t(),
with appropriate definitions, and define and use it whenever RLIM_T is
not long.

Maybe somebody has cleverer ideas.

*** Src/system.h.rlt	Fri Jan  3 16:25:18 1997
--- Src/system.h	Fri Jan  3 17:07:46 1997
***************
*** 378,393 ****
  #endif
  
  /* RLIM_T is the type for system calls involving resource limits     */
! /* Eventually the following will be replaced by a check in configure */
  
  #if defined(BSD4_4) && (BSD > 199300)
  # define RLIM_T_IS_QUAD_T
  #endif
  
! #ifdef RLIM_T_IS_QUAD_T
! # define RLIM_T quad_t
  #else
! # define RLIM_T long
  #endif
  
  /* DIGBUFSIZ is the length of a buffer which can hold the -LONG_MAX-1 *
--- 378,399 ----
  #endif
  
  /* RLIM_T is the type for system calls involving resource limits     */
! /* The configure tests need improving to handle quad and unsigned better */
  
  #if defined(BSD4_4) && (BSD > 199300)
  # define RLIM_T_IS_QUAD_T
  #endif
  
! #ifdef HAVE_RLIM_T
! # define RLIM_T rlim_t
  #else
! 
! # ifdef RLIM_T_IS_QUAD_T
! #  define RLIM_T quad_t
! # else
! #  define RLIM_T long
! # endif
! 
  #endif
  
  /* DIGBUFSIZ is the length of a buffer which can hold the -LONG_MAX-1 *
*** acconfig.h.rlt	Fri Jan  3 16:41:17 1997
--- acconfig.h	Fri Jan  3 16:45:31 1997
***************
*** 165,169 ****
--- 165,172 ----
  /* Define to 1 if system has working FIFO's */
  #undef HAVE_FIFOS
  
+ /* Define to 1 if there is an rlim_t type */
+ #undef HAVE_RLIM_T
+ 
  /* Define to 1 if /bin/sh does not interpret \ escape sequences */
  #undef SH_USE_BSD_ECHO
*** config.h.in.rlt	Fri Jan  3 16:47:06 1997
--- config.h.in	Fri Jan  3 16:47:29 1997
***************
*** 207,212 ****
--- 207,215 ----
  /* Define to 1 if system has working FIFO's */
  #undef HAVE_FIFOS
  
+ /* Define to 1 if there is an rlim_t type */
+ #undef HAVE_RLIM_T
+ 
  /* Define to 1 if /bin/sh does not interpret \ escape sequences */
  #undef SH_USE_BSD_ECHO
  
*** configure.in.rlt	Fri Jan  3 16:28:25 1997
--- configure.in	Fri Jan  3 16:51:21 1997
***************
*** 520,525 ****
--- 520,543 ----
  AC_SUBST(RLIMITS_SRC_H)dnl
  AC_SUBST(RLIMITS_INC_H)dnl
  
+ dnl ---------------------------------------
+ dnl See if the file found defines an rlim_t
+ dnl ---------------------------------------
+ dnl In case we found the macros somewhere other than <sys/resource.h>,
+ dnl look through that as well.  No idea if this is necessary.
+ AC_CACHE_CHECK(if the rlim_t type is defined,zsh_cv_have_rlim_t,
+ [resource_file=$zsh_cv_path_rlimit_h
+ test -f /usr/sys/include/resource.h && \
+ resource_file="$resource_file /usr/sys/include/resource.h"
+ if grep '\<typedef\>.*\<rlim_t\>' $resource_file > /dev/null; then
+   zsh_cv_have_rlim_t=yes
+ else
+   zsh_cv_have_rlim_t=no
+ fi])
+ if test $zsh_cv_have_rlim_t = yes; then
+   AC_DEFINE(HAVE_RLIM_T)
+ fi
+ 
  dnl ----------------------------
  dnl CHECK FOR /dev/fd FILESYSTEM
  dnl ----------------------------

-- 
Peter Stephenson <pws@ifh.de>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77413
Deutsches Elektronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.


                 reply	other threads:[~1997-01-03 16:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199701031625.RAA01278@hydra.ifh.de \
    --to=pws@ifh.de \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).