Debian Codegraph @

ap_backports.h

raw symbols SCIP
1 #cxx . . $ `<file>/ap_backports.h`/include <ap_release.h>
2
3 /**
4 * unixd_* functions are prefixed with ap_ since Apache 2.4
5 */
6 #if (AP_SERVER_MINORVERSION_NUMBERcxx . . $ `<external>/13130438301976661772/ap_release.h:45:9`! < 2) || ((AP_SERVER_MAJORVERSION_NUMBERcxx . . $ `<external>/13130438301976661772/ap_release.h:44:9`! == 2) && (AP_SERVER_MINORVERSION_NUMBERcxx . . $ `<external>/13130438301976661772/ap_release.h:45:9`! < 4))
7 # define unixd_set_global_mutex_perms ap_unixd_set_global_mutex_perms
8 #endif
9
10 /**
11 * This macro is not present in Apache HTTP server version 2.2.3
12 * Red-Hat 5 / CentOS 5
13 */
14 #ifndef ap_is_HTTP_VALID_RESPONSEcxx . . $ `<external>/2935095550947534277/httpd.h:564:9`!
15 # define ap_is_HTTP_VALID_RESPONSE(x) (((x) >= 100)&&((x) < 600))
16 #endif
17
18 /*
19 * apr_time_from_msec is defined in APR 1.4.0 or later
20 */
21 #if (APR_MAJOR_VERSIONcxx . . $ `<external>/2595682082967799043/apr_version.h:52:9`! < 1) || ((APR_MAJOR_VERSIONcxx . . $ `<external>/2595682082967799043/apr_version.h:52:9`! == 1) && (APR_MINOR_VERSIONcxx . . $ `<external>/2595682082967799043/apr_version.h:58:9`! < 4))
22 #define apr_time_from_msec(x) (x * 1000)
23 #endif
24
25 /*
26 * The following is a patch ported from mod_fcgid for Apache 2.0 releases
27 * which don't provide a version of apr_shm_remove.
28 *
29 * Please have a look at the mod_fcgid mailing list for details.
30 * The original patch can be found at:
31 * http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2007-June/122731.html
32 */
33 /* BEGIN OF PATCH ---------------------------------------------------------- */
34 /* apr version 0.x not support apr_shm_remove, I have to copy it from apr version 1.x */
35 #if (APR_MAJOR_VERSIONcxx . . $ `<external>/2595682082967799043/apr_version.h:52:9`! < 1)
36
37 #if APR_HAS_SHARED_MEMORY
38
39 #ifdef HAVE_SYS_MMAN_H
40 #include <sys/mman.h>
41 #endif
42 #ifdef HAVE_SYS_IPC_H
43 #include <sys/ipc.h>
44 #endif
45 #ifdef HAVE_SYS_MUTEX_H
46 #include <sys/mutex.h>
47 #endif
48 #ifdef HAVE_SYS_SHM_H
49 #include <sys/shm.h>
50 #endif
51 #if !defined(SHM_R)
52 #define SHM_R 0400
53 #endif
54 #if !defined(SHM_W)
55 #define SHM_W 0200
56 #endif
57 #ifdef HAVE_SYS_FILE_H
58 #include <sys/file.h>
59 #endif
60
61 /* To avoid conflicts with mod_fcgid and that instance of the patch there.
62 * This basically replaces each of our instances of apr_shm_remove with a local
63 * identifier only used by us thus avoiding hard-to-find bugs if the wrong
64 * version of this function gets linked in when loading the module.
65 *
66 * If re-using this patch you are therefore encouraged to change the name of
67 * the resulting function in the makro and the function declaration below.
68 */
69 #define apr_shm_remove modup_backport_apr_shm_remove
70 static apr_status_t modup_backport_apr_shm_remove(const char *filename, apr_pool_t * pool)
71 {
72 #if APR_USE_SHMEM_SHMGET
73 apr_status_t status;
74 apr_file_t *file;
75 key_t shmkey;
76 int shmid;
77 #endif
78
79 #if APR_USE_SHMEM_MMAP_TMP
80 return apr_file_remove(filename, pool);
81 #endif
82
83 #if APR_USE_SHMEM_MMAP_SHM
84 if (shm_unlink(filename) == -1) {
85 return errno;
86 }
87 return APR_SUCCESS;
88 #endif
89
90 #if APR_USE_SHMEM_SHMGET
91 /* Presume that the file already exists; just open for writing */
92 status = apr_file_open(&file, filename, APR_WRITE, APR_OS_DEFAULT, pool);
93 if (status) {
94 return status;
95 }
96
97 /* ftok() (on solaris at least) requires that the file actually
98 * exist before calling ftok(). */
99 shmkey = ftok(filename, 1);
100 if (shmkey == (key_t) - 1) {
101 goto shm_remove_failed;
102 }
103
104 apr_file_close(file);
105 if ((shmid = shmget(shmkey, 0, SHM_R | SHM_W)) < 0) {
106 goto shm_remove_failed;
107 }
108
109 /* Indicate that the segment is to be destroyed as soon
110 * as all processes have detached. This also disallows any
111 * new attachments to the segment. */
112 if (shmctl(shmid, IPC_RMID, NULL) == -1) {
113 goto shm_remove_failed;
114 }
115 return apr_file_remove(filename, pool);
116
117 shm_remove_failed:
118 status = errno;
119 /* ensure the file has been removed anyway. */
120 apr_file_remove(filename, pool);
121 return status;
122 #endif
123
124 /* No support for anonymous shm */
125 return APR_ENOTIMPL;
126 }
127 /* END OF PATCH ------------------------------------------------------------ */
128
129 #endif
130 /* (APR_MAJOR_VERSION < 1) */
131 #endif