Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Broken sys/arch/i386/stand/boot/biosboot build (was: CVS commit: src)



On Sun, Nov 16, 2008 at 10:50:38PM +0100, Bernd Ernesti wrote:
> Hi,
> 
> On Sun, Nov 16, 2008 at 04:15:58PM +0000, Andrew Doran wrote:
> > 
> > Module Name:        src
> > Committed By:       ad
> > Date:               Sun Nov 16 16:15:58 UTC 2008
> > 
> > Modified Files:
> >     src/sys/kern: kern_ksyms.c
> >     src/sys/lib/libkern: Makefile libkern.h
> > Added Files:
> >     src/common/lib/libc/stdlib: heapsort.c
> >     src/lib/libc/stdlib: qsort.c
> > Removed Files:
> >     src/common/lib/libc/stdlib: qsort.c
> >     src/lib/libc/stdlib: heapsort.c
> > 
> > Log Message:
> > Our qsort() is inappropriate for kernel use because it makes recursive
> > calls. Replace it with a kheapsort() function in kernel. Pointed out
> > by tron@.
> 
> Unfortunally this broke the build in src/sys/arch/i386/stand/boot/biosboot:
> 
>     compile  kern/heapsort.o
> /src/sys/arch/i386/stand/boot/biosboot/../../../../..//lib/libkern/../../../common/lib/libc/stdlib/heapsort.c:58:23:
>  error: namespace.h: No such file or directory

The following patch fixed the problem for me.

Bernd

Index: heapsort.c
===================================================================
RCS file: /cvsroot/src/common/lib/libc/stdlib/heapsort.c,v
retrieving revision 1.1
diff -b -u -r1.1 heapsort.c
--- heapsort.c  16 Nov 2008 16:15:58 -0000      1.1
+++ heapsort.c  16 Nov 2008 22:27:25 -0000
@@ -50,11 +50,11 @@
 #endif
 #endif /* LIBC_SCCS and not lint */
 
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(_STANDALONE)
 #include <sys/types.h>
 
 #include <lib/libkern/libkern.h>
-#else  /* _KERNEL */
+#else  /* _KERNEL || _STANDALONE */
 #include "namespace.h"
 #include <sys/types.h>
 
@@ -70,7 +70,7 @@
 #ifdef __weak_alias
 __weak_alias(heapsort,_heapsort)
 #endif
-#endif /* _KERNEL */
+#endif /* _KERNEL || _STANDALONE */
 
 /*
  * Swap two areas of size number of bytes.  Although qsort(3) permits random
@@ -167,7 +167,7 @@
  * a data set that will trigger the worst case is nonexistent.  Heapsort's
  * only advantage over quicksort is that it requires little additional memory.
  */
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(_STANDALONE)
 int
 kheapsort(void *vbase, size_t nmemb, size_t size,
     int (*compar)(const void *, const void *), void *k)
@@ -180,7 +180,7 @@
        size_t cnt, i, j, l;
        char tmp, *tmp1, *tmp2;
        char *base, *p, *t;
-#ifndef _KERNEL
+#if !defined(_KERNEL) && !defined(_STANDALONE)
        char *k;
 #endif
 
@@ -191,13 +191,13 @@
                return (0);
 
        if (!size) {
-#ifndef _KERNEL
+#if !defined(_KERNEL) && !defined(_STANDALONE)
                errno = EINVAL;
 #endif
                return (-1);
        }
 
-#ifndef _KERNEL
+#if !defined(_KERNEL) && !defined(_STANDALONE)
        if ((k = malloc(size)) == NULL)
                return (-1);
 #endif
@@ -222,7 +222,7 @@
                --nmemb;
                SELECT(i, j, nmemb, t, p, size, k, cnt, tmp1, tmp2);
        }
-#ifndef _KERNEL
+#if !defined(_KERNEL) && !defined(_STANDALONE)
        free(k);
 #endif
        return (0);


Home | Main Index | Thread Index | Old Index