* strange limit output for pws-9
@ 1999-02-25 8:25 Helmut Jarausch
1999-02-25 9:25 ` Peter Stephenson
1999-02-25 13:33 ` Peter Stephenson
0 siblings, 2 replies; 3+ messages in thread
From: Helmut Jarausch @ 1999-02-25 8:25 UTC (permalink / raw)
To: zsh-workers
Hi,
recent versions of zsh upto pws-9 plus patches here on my IRIX 6.5.2 box
show a strange output
5 % limit
cputime unlimited
filesize unlimited
datasize qdMB
stacksize qdMB
coredumpsize qdkB
descriptors 200
vmemorysize qdMB
resident qdMB
PTHREAD qdkB
reloading a very old version of zsh shows
$ limit
cputime unlimited
filesize unlimited
datasize 2097152 kbytes
stacksize 65536 kbytes
coredumpsize 0 kbytes
memoryuse 185952 kbytes
descriptors 200
vmemory 2097152 kbytes
Where should I start searching for the problem?
Thanks,
Helmut.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: strange limit output for pws-9
1999-02-25 8:25 strange limit output for pws-9 Helmut Jarausch
@ 1999-02-25 9:25 ` Peter Stephenson
1999-02-25 13:33 ` Peter Stephenson
1 sibling, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 1999-02-25 9:25 UTC (permalink / raw)
To: zsh-workers
Helmut Jarausch wrote:
> Hi,
>
> recent versions of zsh upto pws-9 plus patches here on my IRIX 6.5.2 box
> show a strange output
>
> 5 % limit
> ...
> datasize qdMB
> ...
It thinks rlim_t is a quad length variable, so is trying to print it with
printf("%qd", val), where val has type rlim_t: see showlimits() in
Src/Builtins/rlimits.c . This implies either
(1) rlim_t really is that long, but the compiler doesn't understand the
format. The test in configure is for sizeof(rlim_t) > sizeof(long), but it
doesn't test how to print it and maybe we just need to check if the
compiler thinks it's long long and wants "%lld" instead. Try changing %qd
in that function to %lld, and if that works I'll rig up a configure test to
see which the compiler likes. (I'm assuming this "%qd" really exists, and
isn't just a figment of someone's overactive imagination --- can anyone
swear to having seen it?)
or
(2) rlim_t is no longer than long and RLIM_T_IS_QUAD_T is defined by
mistake by configure. In that case the code around line 745 of
configure.in is responsible and doing something funny. (This works OK on
Irix 6.2 where it identifies rlim_t as unsigned but not quad.)
--
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: strange limit output for pws-9
1999-02-25 8:25 strange limit output for pws-9 Helmut Jarausch
1999-02-25 9:25 ` Peter Stephenson
@ 1999-02-25 13:33 ` Peter Stephenson
1 sibling, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 1999-02-25 13:33 UTC (permalink / raw)
To: zsh-workers
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1999-02-25 13:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-02-25 8:25 strange limit output for pws-9 Helmut Jarausch
1999-02-25 9:25 ` Peter Stephenson
1999-02-25 13:33 ` 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).