2
* This macro is not present in Apache HTTP server version 2.2.3
5
#ifndef ap_is_HTTP_VALID_RESPONSE
6
# define ap_is_HTTP_VALID_RESPONSE(x) (((x) >= 100)&&((x) < 600))
10
* apr_time_from_msec is defined in APR 1.4.0 or later
12
#if (APR_MAJOR_VERSION < 1) || ((APR_MAJOR_VERSION == 1) && (APR_MINOR_VERSION < 4))
13
#define apr_time_from_msec(x) (x * 1000)
17
* The following is a patch ported from mod_fcgid for Apache 2.0 releases
18
* which don't provide a version of apr_shm_remove.
20
* Please have a look at the mod_fcgid mailing list for details.
21
* The original patch can be found at:
22
* http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2007-June/122731.html
24
/* BEGIN OF PATCH ---------------------------------------------------------- */
25
/* apr version 0.x not support apr_shm_remove, I have to copy it from apr version 1.x */
26
#if (APR_MAJOR_VERSION < 1)
28
#if APR_HAS_SHARED_MEMORY
30
#ifdef HAVE_SYS_MMAN_H
36
#ifdef HAVE_SYS_MUTEX_H
37
#include <sys/mutex.h>
48
#ifdef HAVE_SYS_FILE_H
52
/* To avoid conflicts with mod_fcgid and that instance of the patch there.
53
* This basically replaces each of our instances of apr_shm_remove with a local
54
* identifier only used by us thus avoiding hard-to-find bugs if the wrong
55
* version of this function gets linked in when loading the module.
57
* If re-using this patch you are therefore encouraged to change the name of
58
* the resulting function in the makro and the function declaration below.
60
#define apr_shm_remove modup_backport_apr_shm_remove
61
static apr_status_t modup_backport_apr_shm_remove(const char *filename, apr_pool_t * pool)
63
#if APR_USE_SHMEM_SHMGET
70
#if APR_USE_SHMEM_MMAP_TMP
71
return apr_file_remove(filename, pool);
74
#if APR_USE_SHMEM_MMAP_SHM
75
if (shm_unlink(filename) == -1) {
81
#if APR_USE_SHMEM_SHMGET
82
/* Presume that the file already exists; just open for writing */
83
status = apr_file_open(&file, filename, APR_WRITE, APR_OS_DEFAULT, pool);
88
/* ftok() (on solaris at least) requires that the file actually
89
* exist before calling ftok(). */
90
shmkey = ftok(filename, 1);
91
if (shmkey == (key_t) - 1) {
92
goto shm_remove_failed;
96
if ((shmid = shmget(shmkey, 0, SHM_R | SHM_W)) < 0) {
97
goto shm_remove_failed;
100
/* Indicate that the segment is to be destroyed as soon
101
* as all processes have detached. This also disallows any
102
* new attachments to the segment. */
103
if (shmctl(shmid, IPC_RMID, NULL) == -1) {
104
goto shm_remove_failed;
106
return apr_file_remove(filename, pool);
110
/* ensure the file has been removed anyway. */
111
apr_file_remove(filename, pool);
115
/* No support for anonymous shm */
118
/* END OF PATCH ------------------------------------------------------------ */
121
/* (APR_MAJOR_VERSION < 1) */