Newer versions of the AIX 5.2 libc implement POSIX
semaphores and thus define _POSIX_SEMAPHORES in
<unistd.h>. However, when building Python 2.3.x (and
I'm sure any other version with sem_init()), a few
semaphore errors are encountered:
building 'pcre' extension
./Modules/ld_so_aix gcc -bI:Modules/python.exp \
-L/opt/TWWfsw/python232/lib/support -Wl,-brtl \
-Wl,-blibpath:/opt/TWWfsw/python232/lib/support:/usr/lib \
build/temp.aix-5.2-2.3/pcremodule.o \
build/temp.aix-5.2-2.3/pypcre.o
-L/opt/TWWfsw/python232/lib \
-o build/lib.aix-5.2-2.3/pcre.so
sem_trywait: Permission denied
sem_wait: Permission denied
sem_post: Permission denied
I ran the Python process under truss and saw that the
sem_init() from Python/thread_pthread.h worked
successfully. fork() was then called and a
sem_trywait() operation (probably from
PyThread_acquire_lock()) was called. From the
sem_init() man page
(http://publib.boulder.ibm.com/infocenter/pseries/index.jsp?topic=/com.ibm.aix.doc/libs/basetrf2/sem_init.htm):
If the pshared parameter has a nonzero value, the
semaphore
is shared between processes. In this case, any
process that can
access the sem parameter can use it for performing
sem_wait,
sem_trywait, sem_post, and sem_destroy operations.
Only the sem parameter itself may be used for performing
synchronization.
If the pshared parameter is zero, the semaphore is
shared between
threads of the process. Any thread in this process
can use the sem
parameter for performing sem_wait, sem_trywait,
sem_post, and
sem_destroy operations. The use of the semaphore by
threads
other than those created in the same process returns
an error.
Setting the 2nd value of sem_init to 1 (was 0) solved
the problem. However, I don't know if this is wise for
security. Another solution is to set
HAVE_BROKEN_POSIX_SEMAPHORES for "AIX/5" like for
"SunOS/5.8".
|