Subject: Re: panic: vm_pager_map_pages: page not busy
To: None <port-sparc@NetBSD.ORG>
From: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
List: port-sparc
Date: 02/29/1996 16:11:35
>> (At this point, I'd even like patches to make strip not use mmap, so
>> I can get a usable debugging kernel!)
> none for that.

Turns out it's really simple.  You don't have to stop strip from using
mmap.  You just have to munmap _before_ you ftruncate:

--- OLD/usr.bin/strip/strip.c   Thu Jan  1 00:00:00 1970
+++ NEW/usr.bin/strip/strip.c   Thu Jan  1 00:00:00 1970
@@ -183,6 +183,8 @@
        /* Set symbol size and relocation info values to 0. */
        ep->a_syms = ep->a_trsize = ep->a_drsize = 0;
 
+munmap((caddr_t)ep, sp->st_size);
+
        /* Truncate the file. */
        if (ftruncate(fd, neweof - (char *)ep)) {
                err("%s: %s", fn, strerror(errno));
@@ -268,6 +270,8 @@
         */
        bcopy(nstrbase, (void *)nsym, len);
        free(nstrbase);
+
+munmap((caddr_t)ep, sp->st_size);
 
        /* Truncate to the current length. */
        if (ftruncate(fd, (char *)nsym + len - (char *)ep)) {

This patch is sloppy - it calls munmap twice, and thus works only
because the main routine ignores errors from its munmap.

> how about trying the strip on a different type of file system ?  mfs
> if you have one ...

Thanks for the suggestion; I created a 16-meg mfs filesystem (the
kernel I'm trying to strip -d is about 11 megs) and copied the kernel
to there.  But when I tried stripping the mfs copy, it crashed just the
same.  That's when I attacked strip and came up with the hack above.

Now, to find out what the real problem is...either the
ftruncate()-vs-mmap() problem or the hang that started this off.

					der Mouse

			    mouse@collatz.mcrcim.mcgill.edu