Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Limit type
- X-seq: zsh-workers 2717
- From: Peter Stephenson <pws@xxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx (Zsh hackers list)
- Subject: Limit type
- Date: Fri, 03 Jan 1997 17:25:58 +0100
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@xxxxxx> 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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author