~ubuntu-branches/ubuntu/edgy/libapache2-mod-perl2/edgy-updates

« back to all changes in this revision

Viewing changes to src/modules/perl/modperl_util.h

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2004-08-19 06:23:48 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040819062348-jxl4koqbtvgm8v2t
Tags: 1.99.14-4
Remove the LFS CFLAGS, and build-dep against apache2-*-dev (>= 2.0.50-10)
as we're backing out of the apache2/apr ABI transition.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright 2000-2004 The Apache Software Foundation
 
2
 *
 
3
 * Licensed under the Apache License, Version 2.0 (the "License");
 
4
 * you may not use this file except in compliance with the License.
 
5
 * You may obtain a copy of the License at
 
6
 *
 
7
 *     http://www.apache.org/licenses/LICENSE-2.0
 
8
 *
 
9
 * Unless required by applicable law or agreed to in writing, software
 
10
 * distributed under the License is distributed on an "AS IS" BASIS,
 
11
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
12
 * See the License for the specific language governing permissions and
 
13
 * limitations under the License.
 
14
 */
 
15
 
1
16
#ifndef MODPERL_UTIL_H
2
17
#define MODPERL_UTIL_H
3
18
 
50
65
#define MP_magical_tie(sv, mg_flags) \
51
66
    SvFLAGS((SV*)sv) |= mg_flags
52
67
 
 
68
 
 
69
/* XXX: this should be removed */
53
70
#define MP_FAILURE_CROAK(rc_run) do { \
54
71
        apr_status_t rc = rc_run; \
55
72
        if (rc != APR_SUCCESS) { \
56
 
            Perl_croak(aTHX_ modperl_apr_strerror(rc)); \
 
73
            Perl_croak(aTHX_ modperl_error_strerror(aTHX_ rc)); \
57
74
        } \
58
75
    } while (0)
59
76
 
60
77
/* check whether the response phase has been initialized already */
61
78
#define MP_CHECK_WBUCKET_INIT(func) \
62
79
    if (!rcfg->wbucket) { \
63
 
        Perl_croak(aTHX_ "%s: " func " can't be called before the response phase", MP_FUNC); \
 
80
        Perl_croak(aTHX_ "%s: " func " can't be called "  \
 
81
                   "before the response phase", MP_FUNC); \
64
82
    }
65
83
 
66
84
/* turn off cgi header parsing. in case we are already inside
86
104
MP_INLINE SV *modperl_perl_sv_setref_uv(pTHX_ SV *rv,
87
105
                                        const char *classname, UV uv);
88
106
 
89
 
apr_pool_t *modperl_sv2pool(pTHX_ SV *obj);
90
 
 
91
 
char *modperl_apr_strerror(apr_status_t rv);
92
 
 
93
107
int modperl_errsv(pTHX_ int status, request_rec *r, server_rec *s);
94
108
 
95
109
int modperl_require_module(pTHX_ const char *pv, int logfailure);
155
169
 
156
170
void modperl_clear_symtab(pTHX_ HV *symtab);
157
171
 
 
172
char *modperl_file2package(apr_pool_t *p, const char *file);
 
173
 
 
174
SV *modperl_server_root_relative(pTHX_ SV *sv, const char *fname);
 
175
 
 
176
/**
 
177
 * convert a compiled *CV ref to its original source code
 
178
 * @param p       pool object (with a shortest possible life scope)
 
179
 * @param cv      compiled *CV
 
180
 * @return string of original source code
 
181
 */
 
182
char *modperl_coderef2text(pTHX_ apr_pool_t *p, CV *cv);
 
183
 
158
184
#ifdef MP_TRACE
 
185
 
159
186
void modperl_apr_table_dump(pTHX_ apr_table_t *table, char *name);
 
187
 
 
188
/* dump the contents of PL_modglobal */
 
189
void modperl_perl_modglobal_dump(pTHX);
 
190
 
160
191
#endif
161
192
 
162
 
char *modperl_file2package(apr_pool_t *p, const char *file);
 
193
#if defined(MP_TRACE) && defined(APR_HAS_THREADS)
 
194
#define MP_TRACEf_TID   "/tid 0x%lx"
 
195
#define MP_TRACEv_TID   (unsigned long)apr_os_thread_current()
 
196
#define MP_TRACEv_TID_  MP_TRACEv_TID,
 
197
#define MP_TRACEv__TID  ,MP_TRACEv_TID
 
198
#else
 
199
#define MP_TRACEf_TID
 
200
#define MP_TRACEv_TID
 
201
#define MP_TRACEv_TID_
 
202
#define MP_TRACEv__TID
 
203
#endif /* APR_HAS_THREADS */
 
204
 
 
205
#if defined(MP_TRACE) && defined(USE_ITHREADS)
 
206
#define MP_TRACEf_PERLID   "/perl id 0x%lx"
 
207
#define MP_TRACEv_PERLID   (unsigned long)my_perl
 
208
#define MP_TRACEv_PERLID_  MP_TRACEv_PERLID,
 
209
#define MP_TRACEv__PERLID  ,MP_TRACEv_PERLID
 
210
#else
 
211
#define MP_TRACEf_PERLID
 
212
#define MP_TRACEv_PERLID
 
213
#define MP_TRACEv_PERLID_
 
214
#define MP_TRACEv__PERLID
 
215
#endif /* USE_ITHREADS */
 
216
 
 
217
/* dumping hundreds of lines in the trace, makes it less useful. Get a
 
218
 * string chunk of MP_TRACE_STR_LEN bytes or less. Not too long so it
 
219
 * won't wrap when posted in email. Notice that we copy 'count' bytes
 
220
 * of the string even if count < MP_TRACE_STR_LEN, because the 'str'
 
221
 * buffer doesn't necessarily have \0 terminator at 'count'. As this
 
222
 * is for debug tracing, not to be used in production, it doesn't make
 
223
 * any difference if it's not efficient.
 
224
 */
 
225
#define MP_TRACE_STR_LEN 35
 
226
#define MP_TRACE_STR_TRUNC(p, str, count)                                \
 
227
    count < MP_TRACE_STR_LEN                                             \
 
228
        ? (char *)apr_pstrmemdup(p, str, count)                          \
 
229
        : (char *)apr_psprintf(p, "%s...",                               \
 
230
                               apr_pstrmemdup(p, str, MP_TRACE_STR_LEN))
 
231
 
163
232
#endif /* MODPERL_UTIL_H */