rbb 99/06/22 07:56:31
Modified: apr/locks/unix crossproc.c locks.c Log: Adding new function to bring UNIX up to par with Windows. Revision Changes Path 1.9 +32 -0 apache-apr/apr/locks/unix/crossproc.c Index: crossproc.c =================================================================== RCS file: /home/cvs/apache-apr/apr/locks/unix/crossproc.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- crossproc.c 1999/06/15 19:43:35 1.8 +++ crossproc.c 1999/06/22 14:56:29 1.9 @@ -127,6 +127,12 @@ } return stat; } + +ap_status_t child_init_lock(ap_context_t *cont, char *fname, struct lock_t **lock) +{ + return APR_SUCCESS; +} + #elif defined (USE_PROC_PTHREAD_SERIALIZE) ap_status_t lock_cleanup(struct lock_t *lock) @@ -216,6 +222,11 @@ return stat; } +ap_status_t child_init_lock(ap_context_t *cont, char *fname, struct lock_t **lock) +{ + return APR_SUCCESS; +} + #elif defined (USE_FCNTL_SERIALIZE) ap_status_t lock_cleanup(struct lock_t *lock) @@ -283,6 +294,11 @@ return stat; } +ap_status_t child_init_lock(ap_context_t *cont, char *fname, struct lock_t **lock) +{ + return APR_SUCCESS; +} + #elif defined (USE_FLOCK_SERIALIZE) ap_status_t lock_cleanup(struct lock_t *lock) { @@ -336,10 +352,26 @@ } return stat; } + +ap_status_t child_init_lock(ap_context_t *cont, char *fname, struct lock_t **lock) +{ + struct lock_t *new; + + new = (struct lock_t *)ap_palloc(cont, sizeof(struct lock_t)); + + new->interproc = open(new->fname, O_CREAT | O_WRONLY | O_EXCL, 0600); + if (new->interproc == -1) { + destroy_inter_lock(new); + return errno; + } + return APR_SUCCESS; +} + #else /* No inter-process mutex on this platform. Use at your own risk */ #define create_inter_lock(x, y) #define lock_inter(x, y) #define unlock_inter(x, y) #define destroy_inter_lock(x, y) +#define child_init_lock(x, y, z) #endif 1.9 +10 -0 apache-apr/apr/locks/unix/locks.c Index: locks.c =================================================================== RCS file: /home/cvs/apache-apr/apr/locks/unix/locks.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- locks.c 1999/06/02 18:44:41 1.8 +++ locks.c 1999/06/22 14:56:29 1.9 @@ -131,4 +131,14 @@ return APR_SUCCESS; } +ap_status_t ap_child_init_lock(ap_context_t *cont, char *fname, struct lock_t **lock) +{ + ap_status_t stat; + if ((*lock)->type != APR_CROSS_PROCESS) { + if ((stat = child_init_lock(cont, fname, lock)) != APR_SUCCESS) { + return stat; + } + } + return APR_SUCCESS; +}