[pulseaudio-discuss] PulseAudio on Mac OS X
Sean McNamara
smcnam at gmail.com
Sat Nov 1 11:55:21 PDT 2008
According to POSIX.1-2001 (through `man sem_init`) there are quite a
few failure conditions for sem_init. Here is how they match up:
1. We pass 0 for pshared, the second param, so that can't be a
problem. There is only room for problems if you pass nonzero and the
OS doesn't support that.
2. It's possible that in the code being run, value is greater than
SEM_VALUE_MAX. Check the OSX header files for the value of
SEM_VALUE_MAX and make sure that PA isn't passing a value greater than
what is supported. You may have to work around the limitations of OSX
if it has a rather low SEM_VALUE_MAX. On Linux, sem_init is declared
in /usr/include/semaphore.h, and SEM_VALUE_MAX is defined in
/usr/include/bits/local_lim.h to be 2147483647.
However, it appears that the current git PA does not ever pass a value
greater than 0 when invoking sem_init. pa_semaphore_new just passes
its parameter as the value, so we need to find all instances of
pa_semaphore_new:
run `grep -R pa_semaphore_new src` in the main directory of your
pulseaudio trunk. On my machine, all instances of pa_semaphore_new
pass a value of 0. So unless OSX doesn't support using a value of 0
(which would be very awkward), this isn't the problem.
3. The POSIX.1-2001 spec doesn't say what value sem_init should return
on success. It's possible that OSX returns a nonzero success value, so
the assertion is not valid for OSX. You might try a simple test
program that calls sem_init, tries to use the semaphore, etc. and
verifies that an integer value can indeed be passed between processes
on OSX with a nonzero success value. In this case, hopefully the
return value is not random, but is some predetermined value that you
can #ifdef into the pa_semaphore_new code.
4. OSX pretends to support sem_init, but it really doesn't implement
it correctly at all and it is fundamentally broken. Try looking at
errno and strerror for the result. Also check the header files where
the sem_* functions themselves are declared.
At this point I would suggest:
* Look at SEM_VALUE_MAX (out of interest)
* Try changing uses of pa_semaphore_new to pass a nonzero initial
value in sem_init (then just decrement it immediately inside
pa_semaphore_init, obviously)
* Check the return value for being nonzero in scenarios where there's
been success.
* Unfortunately, not owning a Mac I can't go any further helping you with this.
* http://lists.zenoss.org/pipermail/zenoss-users/2006/000794.html
indicates that, on 10.4 at least, sem_init can be linked to [stub?]
but not implemented. YMMV.
HTH,
Sean
On Sat, Nov 1, 2008 at 2:27 PM, Igor Zubkov <igor.zubkov at gmail.com> wrote:
> Hi, All!
>
> After fixing some build errors, i have builded pulseaudio (current git
> version) on Mac OS X. But, it fail to run with:
> $ pulseaudio -v
> I: caps.c: Dropping root privileges.
> W: main.c: High-priority scheduling enabled in configuration but not
> allowed by policy.
> W: core-util.c: setpriority(): Permission denied
> I: main.c: This is PulseAudio 0.9.14
> I: main.c: Page size is 4096 bytes
> I: main.c: Machine ID is macbook-pro-15-igor-zubkov.local.
> I: main.c: Using runtime directory
> /Users/icesik/.pulse/macbook-pro-15-igor-zubkov.local:runtime.
> I: main.c: Using state directory /Users/icesik/.pulse.
> I: main.c: Running in system mode: no
> W: pid.c: Stale PID file, overwriting.
> I: main.c: Dude, your kernel stinks! The chef's recommendation today
> is Linux with high-resolution timers enabled!
> E: semaphore-posix.c: Assertion 'sem_init(&s->sem, 0, value) == 0'
> failed at pulsecore/semaphore-posix.c:43, function pa_semaphore_new().
> Aborting.
> Abort trap
> $
>
> Any ideas?
>
> --
> icesik
> _______________________________________________
> pulseaudio-discuss mailing list
> pulseaudio-discuss at mail.0pointer.de
> https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
>
More information about the pulseaudio-discuss
mailing list