Skip to contentSkip to conversation

Fix iasl on Mac OS X

PATCH New Stefan Reinauer 1 participant 1 message May 14, 2010 ACPI component architecture (acpica)

lore
Share & tools
lore

Stefan Reinauer

author
#0 lore raw

PATCH 1/1 Fix iasl on Mac OS X

Hi,

Mac OS X does not support unnamed semaphores, which breaks iasl. The attached patch tries a named semaphore in case sema_init claims that it is not implemented.

Best regards,

Stefan Reinauer

Signature · 5 lines
coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br.
      Tel.: +49 761 7668825 • Fax: +49 761 7664613
Email: info(a)coresystems.de  • http://www.coresystems.de/
Registergericht: Amtsgericht Freiburg • HRB 7656
Geschäftsführer: Stefan Reinauer • Ust-IdNr.: DE245674866

Mac OS X does not implement unnamed semaphores. So use a named one instead.

osunixxf.c +9 -2
@@ -126,6 +126,7 @@
 #include <sys/time.h>
 #include <semaphore.h>
 #include <pthread.h>
+#include <errno.h>
 
 #include "acpi.h"
 #include "accommon.h"
@@ -537,8 +538,14 @@
 
     if (sem_init (Sem, 0, InitialUnits) == -1)
     {
-        AcpiOsFree (Sem);
-        return (AE_BAD_PARAMETER);
+        if (errno == ENOSYS) {
+            AcpiOsFree (Sem);
+	     Sem = sem_open(tmpnam(NULL), O_EXCL|O_CREAT, 0755, InitialUnits);
+ 	 } else {
+            perror ("AcpiOsCreateSemaphore");
+            AcpiOsFree (Sem);
+            return (AE_BAD_PARAMETER);
+	 }
     }
 
     *OutHandle = (ACPI_HANDLE) Sem;