zsh-workers
 help / color / mirror / code / Atom feed
* zsh-3.0.1-test2 compilation problem
@ 1996-12-12 12:56 Thomas Winder
  1996-12-12 14:36 ` Zoltan Hidvegi
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Winder @ 1996-12-12 12:56 UTC (permalink / raw)
  To: zsh-workers


Hi!

Trying to compile zsh-3.0.1-test2 on sparclinux-961210 shows the
following: 


cd Src && make CC='gcc' CPPFLAGS='' DEFS='-DHAVE_CONFIG_H' CFLAGS='-Wall -Wno-implicit -Wmissing-prototypes -O2' LDFLAGS='' LIBS='-ltermcap' prefix='/usr' exec_prefix='/' bindir='//bin' infodir='/usr/info' mandir='/usr/man' manext='1'
make[1]: Entering directory `/data1a/src/zsh-3.0.1/Src'
gcc -c -I.. -I. -I.  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes -O2 builtin.c
builtin.c:3686: #error there are some unknown limits.  Fix me!
make[1]: *** [builtin.o] Error 1
make[1]: Leaving directory `/data1a/src/zsh-3.0.1/Src'


Comparing the asm/resources.h from i386-linux to sparc-linux shows
that the RLIMIT_NOFILE and RLIMIT_NPROC are exchanged (6 <->
7). Shouldn't zsh be able to handle this? (btw: why is there such a
confusing "define tree" for the limits in Src/builtins.c?).


thanks

tom


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: zsh-3.0.1-test2 compilation problem
  1996-12-12 12:56 zsh-3.0.1-test2 compilation problem Thomas Winder
@ 1996-12-12 14:36 ` Zoltan Hidvegi
  1996-12-12 17:41   ` Peter Stephenson
  0 siblings, 1 reply; 4+ messages in thread
From: Zoltan Hidvegi @ 1996-12-12 14:36 UTC (permalink / raw)
  To: Thomas Winder; +Cc: zsh-workers

Thomas Winder wrote:
> Trying to compile zsh-3.0.1-test2 on sparclinux-961210 shows the
> following: 
[...]
> builtin.c:3686: #error there are some unknown limits.  Fix me!

I compiled zsh on plain RedHad-4.0-sparc which has an old resources.h
that's why I did not notice it.  The patch below should fix it.  I'm in the
process of replacing SunOS 4 to SparcLinux here and as a test I installed
it on a SUN ELC but that's a lot slower than a 386 DX/40 so I do not have
time to compile the kernel on it, I only use binary kernel images, and I
forgot to upgrage the includes.

That compiles on SparcLinux fine, but it may break something else, so
please test it (especially those using UP-UX-10.20, Digital Unix 4.x or
AIX-4.x).

I know this preprocessor trickery is ugly but the alternatives are not much
better either.  We can generate limits with an awk script but it took more
than a year to make the awk script generating signames.h portable.  And for
that we have to find out where are the RLIMIT_ macros defined (that seems
to be always in /usr/include/sys/resource.h but on Linux it is under asm).

Zoltan


*** Src/builtin.c	1996/12/11 02:27:28	3.1.0.10
--- Src/builtin.c	1996/12/12 14:08:25
***************
*** 2556,2566 ****
  #  define NEXT_RLIM (RLIMIT_MEMLOCK + 1)
      "memorylocked",
  # endif /* RLIMIT_MEMLOCK */
- # if defined RLIMIT_AS && RLIMIT_AS == NEXT_RLIM
- #  undef NEXT_RLIM
- #  define NEXT_RLIM (RLIMIT_AS + 1)
-     "addressspace",
- # endif /* RLIMIT_AS */
  # if defined RLIMIT_NPROC && RLIMIT_NPROC == NEXT_RLIM
  #  undef NEXT_RLIM
  #  define NEXT_RLIM (RLIMIT_NPROC + 1)
--- 2556,2561 ----
***************
*** 2571,2576 ****
--- 2566,2576 ----
  #  define NEXT_RLIM (RLIMIT_MEMLOCK + 1)
      "memorylocked",
  # endif /* RLIMIT_MEMLOCK */
+ # if defined RLIMIT_AS && RLIMIT_AS == NEXT_RLIM
+ #  undef NEXT_RLIM
+ #  define NEXT_RLIM (RLIMIT_AS + 1)
+     "addressspace",
+ # endif /* RLIMIT_AS */
  # if defined RLIMIT_NOFILE && RLIMIT_NOFILE == NEXT_RLIM
  #  undef NEXT_RLIM
  #  define NEXT_RLIM (RLIMIT_NOFILE + 1)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: zsh-3.0.1-test2 compilation problem
  1996-12-12 14:36 ` Zoltan Hidvegi
@ 1996-12-12 17:41   ` Peter Stephenson
  1996-12-13  3:24     ` gwing
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Stephenson @ 1996-12-12 17:41 UTC (permalink / raw)
  To: Zsh hackers list

Zoltan Hidvegi wrote:
> I know this preprocessor trickery is ugly but the alternatives are not much
> better either.  We can generate limits with an awk script but it took more
> than a year to make the awk script generating signames.h portable.  And for
> that we have to find out where are the RLIMIT_ macros defined (that seems
> to be always in /usr/include/sys/resource.h but on Linux it is under asm).

Certainly true, but

(1) we can start from that other awk script.  I hacked up the
following which worked fine on a random sample of Sgi, HPUX, SunOS 4,
Solaris 2 and OSF/1 workstations with the standard awk.  The worst
problem may be sneaky definitions which define the signal in terms
of some other cpp token instead of an integer directly.  I think we
can only suck it and see.  (Do `awk -f rlimits.awk
/usr/include/sys/resource.h' unless the limits are elsewhere.)

Note I've made the script exit with the status containing the number
of limits it failed to find, so configure can print a warning, but
supplied the bit of the CPP token (e.g. RSS, CORE, ... although those
are of course handled) as the name, so it can compile anyway.

(2) it shouldn't be too hard to make a list of possible locations for
RLIMITS, let configure decide whether they exist (which it may well do
anyway, thought we might have to check for files included from other
files) and awk through the list of those which do exist.  I thought
I'd better see what people made of the script first, though.

# 
# $Id:$
#
# rlimits.awk: {g,n}awk script to generate rlimits.h
# rewritten by Peter Stephenson <pws@ifh.de> from Geoff Wing
# <mason@werple.apana.org.au>'s signames.awk
# NB: On SunOS 4.1.3 - user-functions don't work properly, also \" problems
# Without 0 + hacks some nawks compare numbers as strings
#
/^[\t ]*#[\t ]*define[\t _]*RLIMIT_[A-Z]*[\t ]*[0-9][0-9]*/ { 
    limindex = index($0, "RLIMIT_")
    limtail = substr($0, limindex, 80)
    split(limtail, tmp)
    limnam = substr(tmp[1], 8, 20)
    limnum = tmp[2]
    limrev[limnam] = limnum
    if (lim[limnum] == "") {
	lim[limnum] = limnam
	if (limnum ~ /^[0-9]*$/) {
	    if (limnam == "MEMLOCK") { msg[limnum] = "memorylocked" }
	    if (limnam == "RSS")     { msg[limnum] = "resident" }
	    if (limnam == "VMEM")    { msg[limnum] = "vmemorysize" }
	    if (limnam == "NOFILE")  { msg[limnum] = "descriptors" }
	    if (limnam == "CORE")    { msg[limnum] = "coredumpsize" }
	    if (limnam == "STACK")   { msg[limnum] = "stacksize" }
	    if (limnam == "DATA")    { msg[limnum] = "datasize" }
	    if (limnam == "FSIZE")   { msg[limnum] = "filesize" }
	    if (limnam == "CPU")     { msg[limnum] = "cputime" }
	    if (limnam == "NPROC")   { msg[limnum] = "maxproc" }
	    if (limnam == "AS")      { msg[limnum] = "addressspace" }
	    if (limnam == "TCACHE")  { msg[limnum] = "cachethreads" }
        }
    }
}
/^[\t ]*#[\t ]*define[\t _]*RLIM_NLIMITS[\t ]*[0-9][0-9]*/ {
    limindex = index($0, "RLIM_")
    limtail = substr($0, limindex, 80)
    split(limtail, tmp)
    nlimits = tmp[2]
}

END {
    if (limrev["MEMLOCK"] != "") {
        irss = limrev["RSS"]
        msg[irss] = "memoryuse"
    }
    ps = "%s"

    printf("%s\n%s\n\n%s\n", "/** rlimits.h                                 **/", "/** architecture-customized rlimits.h for zsh **/", "static char *recs[RLIM_NLIMITS+1] = {")

    for (i = 0; i < 0 + nlimits; i++)
	if (msg[i] == "") {
            badlimit = badlimit + 1
            printf("\t%c%s%c,\n", 034, lim[i], 034)
	} else
	    printf("\t%c%s%c,\n", 034, msg[i], 034)
    print "\tNULL"
    print "};"
    print ""
    exit(badlimit)
}

-- 
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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: zsh-3.0.1-test2 compilation problem
  1996-12-12 17:41   ` Peter Stephenson
@ 1996-12-13  3:24     ` gwing
  0 siblings, 0 replies; 4+ messages in thread
From: gwing @ 1996-12-13  3:24 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: zsh-workers

Peter Stephenson wrote:
:            badlimit = badlimit + 1

I haven't really looked over the script but this caught my eye.
Just a note the you can do  ``badlimit++''  here.
-- 
Geoff Wing [gwing@primenet.com.au]   Technical Manager
  Phone    : +61-3-9818 2977	     PrimeNet - Internet Consultancy
  Facsimile: +61-3-9819 3788	     Web : <URL:http://www.primenet.com.au/>
  Mobile   : 0412 162 441


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1996-12-13  3:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-12-12 12:56 zsh-3.0.1-test2 compilation problem Thomas Winder
1996-12-12 14:36 ` Zoltan Hidvegi
1996-12-12 17:41   ` Peter Stephenson
1996-12-13  3:24     ` gwing

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).