From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2591 invoked from network); 25 Feb 1999 13:50:36 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 25 Feb 1999 13:50:36 -0000 Received: (qmail 28395 invoked by alias); 25 Feb 1999 13:50:12 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5527 Received: (qmail 28370 invoked from network); 25 Feb 1999 13:49:55 -0000 Message-Id: <9902251333.AA73288@ibmth.df.unipi.it> To: zsh-workers@sunsite.auc.dk Subject: Re: strange limit output for pws-9 In-Reply-To: "Helmut Jarausch"'s message of "Thu, 25 Feb 1999 09:25:55 NFT." Date: Thu, 25 Feb 1999 14:33:43 +0100 From: Peter Stephenson Helmut Jarausch wrote: > datasize qdMB Here's my attempt to fix this. Unfortunately I couldn't test it fully because none of the systems I use has limits longer than `long', but I've tested it piecemeal. Basically, it sees if "%qd" produces a number (pretty much as suggested by Helmut), and if not, assumes that it should use `long long' rather than `quad_t'. --- Src/Builtins/rlimits.c.quad Thu Feb 25 13:56:38 1999 +++ Src/Builtins/rlimits.c Thu Feb 25 14:01:12 1999 @@ -37,7 +37,7 @@ # include "rlimits.h" -# if defined(RLIM_T_IS_QUAD_T) || defined(RLIM_T_IS_UNSIGNED) +# if defined(RLIM_T_IS_QUAD_T) || defined(RLIM_T_IS_LONG_LONG) || defined(RLIM_T_IS_UNSIGNED) static rlim_t zstrtorlimt(const char *s, char **t, int base) { @@ -62,9 +62,9 @@ *t = (char *)s; return ret; } -# else /* !RLIM_T_IS_QUAD_T && !RLIM_T_IS_UNSIGNED */ +# else /* !RLIM_T_IS_QUAD_T && !RLIM_T_IS_LONG_LONG && !RLIM_T_IS_UNSIGNED */ # define zstrtorlimt(a, b, c) zstrtol((a), (b), (c)) -# endif /* !RLIM_T_IS_QUAD_T && !RLIM_T_IS_UNSIGNED */ +# endif /* !RLIM_T_IS_QUAD_T && !RLIM_T_IS_LONG_LONG && !RLIM_T_IS_UNSIGNED */ /* Display resource limits. hard indicates whether `hard' or `soft' * * limits should be displayed. lim specifies the limit, or may be -1 * @@ -107,9 +107,15 @@ else printf("%qdkB\n", val / 1024L); # else +# ifdef RLIM_T_IS_LONG_LONG + printf("%lldMB\n", val / (1024L * 1024L)); + else + printf("%lldkB\n", val / 1024L); +# else printf("%ldMB\n", val / (1024L * 1024L)); else printf("%ldkB\n", val / 1024L); +# endif /* RLIM_T_IS_LONG_LONG */ # endif /* RLIM_T_IS_QUAD_T */ } } --- acconfig.h.quad Wed Dec 16 14:56:33 1998 +++ acconfig.h Thu Feb 25 13:57:03 1999 @@ -196,10 +196,13 @@ /* Define to 1 if system has working FIFO's */ #undef HAVE_FIFOS -/* Define to 1 if struct rlimit use quad_t */ +/* Define to 1 if struct rlimit uses quad_t */ #undef RLIM_T_IS_QUAD_T -/* Define to 1 if rlimit use unsigned */ +/* Define to 1 if struct rlimit uses long long */ +#undef RLIM_T_IS_LONG_LONG + +/* Define to 1 if rlimit uses unsigned */ #undef RLIM_T_IS_UNSIGNED /* Define to the type used in struct rlimit */ --- config.h.in.quad Fri Dec 18 18:28:04 1998 +++ config.h.in Thu Feb 25 14:05:52 1999 @@ -260,10 +260,13 @@ /* Define to 1 if system has working FIFO's */ #undef HAVE_FIFOS -/* Define to 1 if struct rlimit use quad_t */ +/* Define to 1 if struct rlimit uses quad_t */ #undef RLIM_T_IS_QUAD_T -/* Define to 1 if rlimit use unsigned */ +/* Define to 1 if struct rlimit use long long */ +#undef RLIM_T_IS_LONG_LONG + +/* Define to 1 if rlimit uses unsigned */ #undef RLIM_T_IS_UNSIGNED /* Define to the type used in struct rlimit */ --- configure.in.quad Thu Feb 25 12:15:28 1999 +++ configure.in Thu Feb 25 14:04:22 1999 @@ -735,20 +735,43 @@ dnl rlimit type checks dnl ------------------ DEFAULT_RLIM_T=long -AC_CACHE_CHECK(if rlim_t is quad_t, -zsh_cv_rlim_t_is_quad_t, +AC_CACHE_CHECK(if rlim_t is longer than a long, +zsh_cv_rlim_t_is_longer, [AC_TRY_RUN([ #ifdef HAVE_SYS_TIME_H #include #endif #include main(){struct rlimit r;exit(sizeof(r.rlim_cur) <= sizeof(long));}], -zsh_cv_rlim_t_is_quad_t=yes, -zsh_cv_rlim_t_is_quad_t=no, -zsh_cv_rlim_t_is_quad_t=yes)]) -if test $zsh_cv_rlim_t_is_quad_t = yes; then - AC_DEFINE(RLIM_T_IS_QUAD_T) - DEFAULT_RLIM_T=quad_t +zsh_cv_rlim_t_is_longer=yes, +zsh_cv_rlim_t_is_longer=no, +zsh_cv_rlim_t_is_longer=yes)]) +if test $zsh_cv_rlim_t_is_longer = yes; then + AC_CACHE_CHECK(if rlim_t is a quad, + zsh_cv_rlim_t_is_quad_t, + [AC_TRY_RUN([ +#ifdef HAVE_SYS_TIME_H +#include +#endif +#include +#include +main() { + struct rlimit r; + char buf[[20]]; + r.rlim_cur = 0; + sprintf(buf, "%qd", r.rlim_cur); + exit(strcmp(buf, "0")); +}], + zsh_cv_rlim_t_is_quad_t=yes, + zsh_cv_rlim_t_is_quad_t=no, + zsh_cv_rlim_t_is_quad_t=no)]) + if test $zsh_cv_tlim_t_is_quad_t = yes; then + AC_DEFINE(RLIM_T_IS_QUAD_T) + DEFAULT_RLIM_T=quad_t + else + AC_DEFINE(RLIM_T_IS_LONG_LONG) + DEFAULT_RLIM_T='long long' + fi else AC_CACHE_CHECK(if the rlim_t is unsigned, zsh_cv_type_rlim_t_is_unsigned, -- Peter Stephenson Tel: +39 050 844536 WWW: http://www.ifh.de/~pws/ Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy