From: Peter Stephenson <pws@ibmth.df.unipi.it>
To: zsh-workers@sunsite.auc.dk
Subject: Re: strange limit output for pws-9
Date: Thu, 25 Feb 1999 14:33:43 +0100 [thread overview]
Message-ID: <9902251333.AA73288@ibmth.df.unipi.it> (raw)
In-Reply-To: "Helmut Jarausch"'s message of "Thu, 25 Feb 1999 09:25:55 NFT." <jarausch-990225092544.A01191272@numa1.igpm.rwth-aachen.de>
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 <sys/time.h>
#endif
#include <sys/resource.h>
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 <sys/time.h>
+#endif
+#include <stdio.h>
+#include <sys/resource.h>
+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 <pws@ibmth.df.unipi.it> Tel: +39 050 844536
WWW: http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy
prev parent reply other threads:[~1999-02-25 13:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-02-25 8:25 Helmut Jarausch
1999-02-25 9:25 ` Peter Stephenson
1999-02-25 13:33 ` Peter Stephenson [this message]
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=9902251333.AA73288@ibmth.df.unipi.it \
--to=pws@ibmth.df.unipi.it \
--cc=zsh-workers@sunsite.auc.dk \
/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).