jorton 2004/06/14 01:53:31
Modified: include/arch/unix apr_arch_proc_mutex.h
. configure.in
locks/unix proc_mutex.c
Log:
Support POSIX semaphores on LP64 platforms:
* configure.in: Don't disable POSIX semaphore support on LP64
platforms.
* include/arch/unix/apr_arch_proc_mutex.h (struct apr_proc_mutex_t):
Add a sem_t pointer field.
* locks/unix/proc_mutex.c (proc_mutex_posix_create,
proc_mutex_posix_cleanup, proc_mutex_posix_acquire,
prox_mutex_posix_release): Use the sem_t pointer not the fd for the
semaphore.
Revision Changes Path
1.7 +3 -0 apr/include/arch/unix/apr_arch_proc_mutex.h
Index: apr_arch_proc_mutex.h
===================================================================
RCS file: /home/cvs/apr/include/arch/unix/apr_arch_proc_mutex.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -d -w -u -r1.6 -r1.7
--- apr_arch_proc_mutex.h 5 Jun 2004 13:33:19 -0000 1.6
+++ apr_arch_proc_mutex.h 14 Jun 2004 08:53:30 -0000 1.7
@@ -98,6 +98,9 @@
#if APR_HAS_SYSVSEM_SERIALIZE || APR_HAS_FCNTL_SERIALIZE ||
APR_HAS_FLOCK_SERIALIZE
apr_file_t *interproc;
#endif
+#if APR_HAS_POSIXSEM_SERIALIZE
+ sem_t *psem_interproc;
+#endif
#if APR_HAS_PROC_PTHREAD_SERIALIZE
pthread_mutex_t *pthread_interproc;
#endif
1.588 +0 -2 apr/configure.in
Index: configure.in
===================================================================
RCS file: /home/cvs/apr/configure.in,v
retrieving revision 1.587
retrieving revision 1.588
diff -d -w -u -r1.587 -r1.588
--- configure.in 10 Jun 2004 10:59:03 -0000 1.587
+++ configure.in 14 Jun 2004 08:53:31 -0000 1.588
@@ -1492,8 +1492,6 @@
sem_t *psem;
const char *sem_name = "/apr_autoconf";
- if (sizeof(int) < sizeof(sem_t *))
- exit(1);
psem = sem_open(sem_name, O_CREAT, 0644, 1);
if (psem == (sem_t *)SEM_FAILED) {
exit(1);
1.40 +4 -4 apr/locks/unix/proc_mutex.c
Index: proc_mutex.c
===================================================================
RCS file: /home/cvs/apr/locks/unix/proc_mutex.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -d -w -u -r1.39 -r1.40
--- proc_mutex.c 5 Jun 2004 13:33:19 -0000 1.39
+++ proc_mutex.c 14 Jun 2004 08:53:31 -0000 1.40
@@ -50,7 +50,7 @@
apr_status_t stat = APR_SUCCESS;
if (mutex->interproc->filedes != -1) {
- if (sem_close((sem_t *)mutex->interproc->filedes) < 0) {
+ if (sem_close(mutex->psem_interproc) < 0) {
stat = errno;
}
}
@@ -113,7 +113,7 @@
}
/* Ahhh. The joys of Posix sems. Predelete it... */
sem_unlink((const char *) semname);
- new_mutex->interproc->filedes = (int)psem; /* Ugg */
+ new_mutex->psem_interproc = psem;
new_mutex->fname = apr_pstrdup(new_mutex->pool, semname);
apr_pool_cleanup_register(new_mutex->pool, (void *)new_mutex,
apr_proc_mutex_cleanup,
@@ -125,7 +125,7 @@
{
int rc;
- if ((rc = sem_wait((sem_t *)mutex->interproc->filedes)) < 0) {
+ if ((rc = sem_wait(mutex->psem_interproc)) < 0) {
return errno;
}
mutex->curr_locked = 1;
@@ -137,7 +137,7 @@
int rc;
mutex->curr_locked = 0;
- if ((rc = sem_post((sem_t *)mutex->interproc->filedes)) < 0) {
+ if ((rc = sem_post(mutex->psem_interproc)) < 0) {
return errno;
}
return APR_SUCCESS;