sorry, I forgot a patch.

From: Naruto TAKAHASHI <[EMAIL PROTECTED]>
Subject: [PATCH] evas patch for FreeBSD7.1 later
Date: Fri, 31 Oct 2008 22:11:31 +0900 (JST)

> Hi, all
> 
> I made a evas patch for FreeBSD 7.1 later, in SVN.
> 
> When you specified --enable-pthreads, evas in SVN build is fault on
> non-linux based unix OS. Because evas_common_cpu_count() is using
> sched_getaffinity() that is linux specification system call.
> 
> This patch modified two things.
> 
>   1. Add "#ifdef __linux__" that is linux routine.
> 
>   2. Add a routine that get cpu affinity for FreeBSD 7.1 later.
>     (Because getting cpu affinity system call cpuset_getaffinity()
>     appeared in FreeBSD 7.1)
> 
> Best Regards.
> -=-=-=-=-=-=-=-=-
> Naruto TAKAHASHI
> [EMAIL PROTECTED]
Index: src/lib/engines/common/evas_cpu.c
===================================================================
--- src/lib/engines/common/evas_cpu.c   (revision 37355)
+++ src/lib/engines/common/evas_cpu.c   (working copy)
@@ -11,6 +11,10 @@
 #ifndef _WIN32
 #include <signal.h>
 #include <setjmp.h>
+#ifdef __FreeBSD__
+#include <sys/param.h>
+#include <sys/cpuset.h>
+#endif
 
 static sigjmp_buf detect_buf;
 #endif
@@ -220,13 +224,19 @@
 evas_common_cpu_count(void)
 {
 #ifdef BUILD_PTHREAD
-   cpu_set_t cpu;
    int i;
    static int cpus = 0;
 
    if (cpus != 0) return cpus;
 
+#ifdef __linux__
+   cpu_set_t cpu;
    sched_getaffinity(getpid(), sizeof(cpu), &cpu);
+#elif __FreeBSD__
+   cpuset_t cpu;
+   cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID,
+                      getpid(), sizeof(cpu), &cpu);
+#endif
    for (i = 0; i < TH_MAX; i++)
      {
        if (CPU_ISSET(i, &cpu)) cpus = i + 1;
Index: src/lib/engines/common/evas_pipe.c
===================================================================
--- src/lib/engines/common/evas_pipe.c  (revision 37355)
+++ src/lib/engines/common/evas_pipe.c  (working copy)
@@ -3,6 +3,10 @@
  */
 
 #include "evas_common.h"
+#ifdef __FreeBSD__
+#include <sys/param.h>
+#include <sys/cpuset.h>
+#endif
 
 static RGBA_Pipe *evas_common_pipe_add(RGBA_Pipe *pipe, RGBA_Pipe_Op **op);
 static void evas_common_pipe_draw_context_copy(RGBA_Draw_Context *dc, 
RGBA_Pipe_Op *op);
@@ -133,7 +137,11 @@
        for (i = 0; i < thread_num; i++)
          {
             pthread_attr_t attr;
-            cpu_set_t cpu;
+#ifdef __linux__
+             cpu_set_t cpu;
+#elif __FreeBSD__
+             cpuset_t cpu;
+#endif
 
             pthread_attr_init(&attr);
             CPU_ZERO(&cpu);
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to