* [Devel] [PATCH] Fix iasl on Mac OS X
@ 2010-05-14 16:53 Stefan Reinauer
0 siblings, 0 replies; 3+ messages in thread
From: Stefan Reinauer @ 2010-05-14 16:53 UTC (permalink / raw)
To: devel
[-- Attachment #1: Type: text/plain, Size: 511 bytes --]
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
--
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
[-- Attachment #2: acpica-unix-20100428-sema.diff --]
[-- Type: text/plain, Size: 848 bytes --]
Mac OS X does not implement unnamed semaphores. So use a named one instead.
Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
--- osunixxf.c 2010-05-14 17:18:57.000000000 +0200
+++ osunixxf.c 2010-05-14 18:15:57.000000000 +0200
@@ -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;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Devel] [PATCH] Fix iasl on Mac OS X
@ 2010-05-24 8:44 Lin Ming
0 siblings, 0 replies; 3+ messages in thread
From: Lin Ming @ 2010-05-24 8:44 UTC (permalink / raw)
To: devel
[-- Attachment #1: Type: text/plain, Size: 1703 bytes --]
> From: Stefan Reinauer <stefan.reinauer(a)coresystems.de>
> Date: Sat, May 15, 2010 at 12:53 AM
> Subject: [Devel] [PATCH] Fix iasl on Mac OS X
> To: devel(a)acpica.org
>
>
> 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.
Hi,
I got below error, need to add "#include <fcntl.h>" to fix it.
cc -Wall -O2 -Wstrict-prototypes -D_LINUX -DACPI_ASL_COMPILER -I../include -I../compiler -c -o ../osunixxf.o ../osunixxf.c
../osunixxf.c: In function ‘AcpiOsCreateSemaphore’:
../osunixxf.c:543: error: ‘O_EXCL’ undeclared (first use in this function)
../osunixxf.c:543: error: (Each undeclared identifier is reported only once
../osunixxf.c:543: error: for each function it appears in.)
../osunixxf.c:543: error: ‘O_CREAT’ undeclared (first use in this function)
make: *** [../osunixxf.o] Error 1
And another warning is,
../osunixxf.o: In function `AcpiOsCreateSemaphore':
osunixxf.c:(.text+0x518): warning: the use of `tmpnam' is dangerous, better use `mkstemp'
As gcc suggests, better to use "mkstemp".
Thanks,
Lin Ming
>
> Best regards,
>
> Stefan Reinauer
>
> --
> 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
>
>
> _______________________________________________
> Devel mailing list
> Devel(a)acpica.org
> http://lists.acpica.org/listinfo/devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Devel] [PATCH] Fix iasl on Mac OS X
@ 2010-05-24 9:08 Stefan Reinauer
0 siblings, 0 replies; 3+ messages in thread
From: Stefan Reinauer @ 2010-05-24 9:08 UTC (permalink / raw)
To: devel
[-- Attachment #1: Type: text/plain, Size: 1836 bytes --]
On 5/24/10 10:44 AM, Lin Ming wrote:
>
>> From: Stefan Reinauer <stefan.reinauer(a)coresystems.de>
>> Date: Sat, May 15, 2010 at 12:53 AM
>> Subject: [Devel] [PATCH] Fix iasl on Mac OS X
>> To: devel(a)acpica.org
>>
>>
>> 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.
>>
> Hi,
>
> I got below error, need to add "#include <fcntl.h>" to fix it.
>
> cc -Wall -O2 -Wstrict-prototypes -D_LINUX -DACPI_ASL_COMPILER -I../include -I../compiler -c -o ../osunixxf.o ../osunixxf.c
> ../osunixxf.c: In function ‘AcpiOsCreateSemaphore’:
> ../osunixxf.c:543: error: ‘O_EXCL’ undeclared (first use in this function)
> ../osunixxf.c:543: error: (Each undeclared identifier is reported only once
> ../osunixxf.c:543: error: for each function it appears in.)
> ../osunixxf.c:543: error: ‘O_CREAT’ undeclared (first use in this function)
> make: *** [../osunixxf.o] Error 1
>
Thank you for testing this. I will update the patch.
> And another warning is,
>
> ../osunixxf.o: In function `AcpiOsCreateSemaphore':
> osunixxf.c:(.text+0x518): warning: the use of `tmpnam' is dangerous, better use `mkstemp'
>
> As gcc suggests, better to use "mkstemp".
Not sure mkstemp is appropriate here. It creates a file while what we
need is a semaphore. I will test, however, whether creating a semaphore
by overwriting that file name works as one would hope.
Stefan
--
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-05-24 9:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-24 9:08 [Devel] [PATCH] Fix iasl on Mac OS X Stefan Reinauer
-- strict thread matches above, loose matches on Subject: below --
2010-05-24 8:44 Lin Ming
2010-05-14 16:53 Stefan Reinauer
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.