On 2007/04/12 13:31, Christian Weisgerber wrote:
> Josh Grosse <[EMAIL PROTECTED]> wrote:
> 
> > Originally submitted in January.  Now, with:
> > 
> >     ONLY_FOR_ARCHS= amd64 i386 armish
> > 
> > as it had been confirmed to run on those platforms, and would not run
> > on sparc64, nor on vax. 
> 
> It also dies with an alignment error on alpha (in regress).

this fixes sparc64.

--- CPP/myWindows/myGetNumberOfProcessors.cpp.orig      Fri Apr 13 19:28:46 2007
+++ CPP/myWindows/myGetNumberOfProcessors.cpp   Fri Apr 13 19:27:56 2007
@@ -7,6 +7,9 @@
 #elif defined(__linux__) || defined(__CYGWIN__) || defined(sun)
 #include <unistd.h>
 #endif
+     int
+     sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
+             size_t newlen);
 
 namespace NWindows
 {
@@ -14,16 +17,16 @@ namespace NWindows
        {
                #if defined (__NetBSD__) || defined(__OpenBSD__)
                int GetNumberOfProcessors() {
-                       int mib[2];
-                       size_t value[2];
+                       int mib[2], value;
+                       size_t len;
                        int nbcpu = 1;
 
                        mib[0] = CTL_HW;
                        mib[1] = HW_NCPU;
-                       value[1] = sizeof(size_t);
-                       if (sysctl(mib, 2, value, value+1, NULL, 0) >= 0)
-                       if (value[0] > nbcpu)
-                               nbcpu = value[0];
+                       len = sizeof(value);
+                       if (sysctl(mib, 2, &value, &len, NULL, 0) >= 0)
+                       if (value > nbcpu)
+                               nbcpu = value;
                        return nbcpu;
                }
                #elif defined (__FreeBSD__)

Reply via email to