From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9956 invoked from network); 15 May 2001 08:37:42 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 15 May 2001 08:37:42 -0000 Received: (qmail 22748 invoked by alias); 15 May 2001 08:37:35 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 14346 Received: (qmail 22735 invoked from network); 15 May 2001 08:37:33 -0000 From: Sven Wischnowsky Date: Tue, 15 May 2001 10:37:06 +0200 (MET DST) Message-Id: <200105150837.KAA09465@beta.informatik.hu-berlin.de> To: zsh-workers@sunsite.dk Subject: PATCH: Re: architecture independent wordcode files (.zwc) In-Reply-To: <15104.4136.595537.497564@paullew-ultra.cisco.com> Paul Lew wrote: > ... > > I have lots of startup files for zsh, fortunately, the .zshenv is good > enough to trigger the problem. Attached below. That helped. Obviously I had only tried it with functions that were too small. The zwc files contain the compiled versions for both endianesses, first in the one for the machine the file was compiled on and after that the one for the other endianess. When the shell has to use that other version (with mapping), it has to calculate the offset into the zwc file for the header (containing the directory of files/functions in the zwc file including their positions relative to the header etc.). That worked fine. But it also has to map the part of the part of the zwc it needs and for that it has to adjust the offset to a page boundary. That worked fine, too. But then it forgot to increment the length of the mapped reagion by the difference between the real offset and the aligned one. For large functions that happened to cross a page boundary that could result in the string table of the function being not or only partially mapped. > ... > dirs=(.) > dirs=($dirs $artool/$bindir $artool/sh $artool/perl) > dirs=($dirs /auto/insbu-cnstools/$bindir) #cisco CNS > dirs=($dirs /auto/insbu-cnstools/s$bindir) #cisco CNS > ... Ugh, that's pretty inefficient -- zsh has no problems with arrays definitions spanning multiple lines. Bye Sven Index: Src/parse.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/parse.c,v retrieving revision 1.19 diff -u -r1.19 parse.c --- Src/parse.c 2001/03/07 12:58:41 1.19 +++ Src/parse.c 2001/05/15 08:25:50 @@ -2782,7 +2782,7 @@ { FuncDump d; Wordcode addr; - int fd, off; + int fd, off, mlen; if (other) { static size_t pgsz = 0; @@ -2802,15 +2802,17 @@ pgsz--; } off = len & ~pgsz; - } else + mlen = len + (len - off); + } else { off = 0; - + mlen = len; + } if ((fd = open(dump, O_RDONLY)) < 0) return; fd = movefd(fd); - if ((addr = (Wordcode) mmap(NULL, len, PROT_READ, MAP_SHARED, fd, off)) == + if ((addr = (Wordcode) mmap(NULL, mlen, PROT_READ, MAP_SHARED, fd, off)) == ((Wordcode) -1)) { close(fd); return; -- Sven Wischnowsky wischnow@informatik.hu-berlin.de