On 05/09/2012 09:40 AM, Jan Kaluža wrote:
On 05/08/2012 06:26 AM, Fred Moyer wrote:
On Tue, Apr 10, 2012 at 11:44 PM, Jan Kaluža<jkal...@redhat.com> wrote:
I've talked with Torsten about the mod_perl and httpd-2.4
compatibility and
he advised me to start discussion about this problem.

Attached patch against httpd24 branch fixes the compilation with
httpd-2.4.
I was not able to generate xs using "make source_scan", so I've
changed them
manually. Should source_scan.pl work...?

What changes to source_scan.pl did you have to make?

So far I've the attached patch to compile mod_perl-2.0.6 against
httpd-2.4. It's based on Stefan's patches. The only problem I have now
is that after running source_scan and building mod_perl, ModPerl::Global
is not included which causes later runtime failure. I'm not sure why it
behaves like that and I'm in state of debugging this problem, but help
is welcome.

Finally found out that CScan doesn't parse inline methods and this is why ModPerl::Global is omitted. I've "fixed" this by adding defitions for ModPerl::Global methods, so CScan parses them correctly now. The proper fix would be probably to fix CScan, but I think my Perl knowledge is not so good...

So, attached patch is everything I needed to compile modperl-2.0.6 against httpd-2.4.

Note that you have to run "make source_scan" and "make xs_generate" and rerun MakeFile.pl before executing "make".

Regards,
Jan Kaluza
diff --git a/lib/Apache2/ParseSource.pm b/lib/Apache2/ParseSource.pm
index 8027548..4727411 100644
--- a/lib/Apache2/ParseSource.pm
+++ b/lib/Apache2/ParseSource.pm
@@ -139,7 +139,8 @@ sub find_includes {
                                     apr_optional mod_include mod_cgi
                                     mod_proxy mod_ssl ssl_ apr_anylock
                                     apr_rmm ap_config mod_log_config
-                                    mod_perl modperl_ apreq);
+                                    mod_perl modperl_ apreq mod_cache
+                                    mod_serf mod_dav);
         $unwanted = qr|^$unwanted|;
         my $wanted = '';
 
@@ -280,6 +281,9 @@ my %enums_wanted = (
 
 my $defines_unwanted = join '|', qw{
 HTTP_VERSION APR_EOL_STR APLOG_MARK APLOG_NOERRNO APR_SO_TIMEOUT
+APR_HOOK_PROBES_ENABLED APR_HOOK_INT_DCL_UD
+APLOG_MAX_LOGLEVEL
+APR_BEGIN_DECLS APR_END_DECLS
 };
 
 sub get_constants {
@@ -398,6 +402,7 @@ sub get_functions {
     my $c = $self->{c};
 
     my $fdecls = $c->get($key);
+# 	print Data::Dumper::Dumper($fdecls);
 
     my %seen;
     my $wanted = $self->wanted_functions;
diff --git a/lib/ModPerl/CScan.pm b/lib/ModPerl/CScan.pm
index 6789af3..a7314c9 100644
--- a/lib/ModPerl/CScan.pm
+++ b/lib/ModPerl/CScan.pm
@@ -943,7 +943,7 @@ sub new {
     my ($sym) = gensym;
     my $cmd = WIN32 ?
         "$Cpp->{cppstdin} $Defines $addincludes $Cpp->{cppflags} $filename |" :
-        "echo '\#include \"$filename\"' | $Cpp->{cppstdin} $Defines $addincludes $Cpp->{cppflags} $Cpp->{cppminus} |";
+        "echo '\#include \"$filename\"' | $Cpp->{cppstdin} $Defines $addincludes $Cpp->{cppflags} $Cpp->{cppminus} | grep -v '^#' |";
     #my $cmd = "echo '\#include <$filename>' | $Cpp->{cppstdin} $Defines $addincludes $Cpp->{cppflags} $Cpp->{cppminus} |";
 
     (open($sym, $cmd) or die "Cannot open pipe from `$cmd': $!")
diff --git a/lib/ModPerl/Code.pm b/lib/ModPerl/Code.pm
index e43f77c..52a7e30 100644
--- a/lib/ModPerl/Code.pm
+++ b/lib/ModPerl/Code.pm
@@ -777,7 +777,7 @@ sub generate {
     $self->postamble;
 
     my $xsinit = "$self->{path}/modperl_xsinit.c";
-    debug "generating...$xsinit";
+	debug "generating...$xsinit";
 
     # There's a possibility that $Config{static_ext} may contain spaces
     # and ExtUtils::Embed::xsinit won't handle the situation right. In
@@ -889,7 +889,8 @@ EOF
 
             if ($name eq 'DECLINE_CMD' ||
                 $name eq 'DIR_MAGIC_TYPE' ||
-                $name eq 'CRLF') {
+                $name eq 'CRLF' ||
+                $name eq 'CRLF_ASCII') {
                 print $c_fh <<EOF;
               return newSVpv($alias{$name}, 0);
 EOF
diff --git a/lib/ModPerl/FunctionMap.pm b/lib/ModPerl/FunctionMap.pm
index baf25e9..388bdc9 100644
--- a/lib/ModPerl/FunctionMap.pm
+++ b/lib/ModPerl/FunctionMap.pm
@@ -122,7 +122,6 @@ sub parse {
             for (keys %words) {
                 $cur{$_} = $words{$_};
             }
-
             next;
         }
 
diff --git a/lib/ModPerl/MapUtil.pm b/lib/ModPerl/MapUtil.pm
index 1aa219f..8cd453c 100644
--- a/lib/ModPerl/MapUtil.pm
+++ b/lib/ModPerl/MapUtil.pm
@@ -180,7 +180,7 @@ sub map_files {
                 next unless $file =~ /$wanted/i;
             }
 
-            #print "$package => $file\n";
+#             print "$package => $file\n";
             push @files, $file;
         }
 
diff --git a/lib/ModPerl/WrapXS.pm b/lib/ModPerl/WrapXS.pm
index 9114fc6..2abdfb4 100644
--- a/lib/ModPerl/WrapXS.pm
+++ b/lib/ModPerl/WrapXS.pm
@@ -140,7 +140,8 @@ EOF
             else {
                 if ($orig_args and @$orig_args == @$args) {
                     #args were reordered
-                    $parms = join ', ', @$orig_args;
+#                     $parms = join ', ', @$orig_args;
+                     $parms = $xs_parms;
                 }
 
                 $dispatch = $func->{name};
@@ -1129,7 +1130,7 @@ sub write_module_versions_file {
     my $self = shift;
 
     my $file = catfile "lib", "ModPerl", "DummyVersions.pm";
-    debug "creating $file";
+    debug "creating $file\n";
     open my $fh, ">$file" or die "Can't open $file: $!";
 
     my $noedit_warning = $self->ModPerl::Code::noedit_warning_hash();
diff --git a/src/modules/perl/modperl_apache_compat.h b/src/modules/perl/modperl_apache_compat.h
index 78a9cb3..072ae79 100644
--- a/src/modules/perl/modperl_apache_compat.h
+++ b/src/modules/perl/modperl_apache_compat.h
@@ -68,7 +68,6 @@ AP_DECLARE(const char *) ap_get_server_version(void);
 #define MP_HTTPD_OVERRIDE_OPTS_UNSET (-1)
 #define MP_HTTPD_OVERRIDE_OPTS_DEFAULT (OPT_UNSET | \
                                         OPT_ALL | \
-                                        OPT_INCNOEXEC | \
                                         OPT_SYM_OWNER | \
                                         OPT_MULTI)
 
diff --git a/src/modules/perl/modperl_apache_includes.h b/src/modules/perl/modperl_apache_includes.h
index c93decc..4183782 100644
--- a/src/modules/perl/modperl_apache_includes.h
+++ b/src/modules/perl/modperl_apache_includes.h
@@ -23,6 +23,10 @@
 #define CORE_PRIVATE
 #endif
 
+#ifdef MP_IN_XS
+#define AP_DEBUG_NO_ALLOC_POISON
+#endif
+
 #include "ap_mmn.h"
 #include "httpd.h"
 #include "http_config.h"
@@ -34,9 +38,14 @@
 #include "http_core.h"
 #include "http_vhost.h"
 #include "ap_mpm.h"
+//#include "apu_errno.h"
 
 #include "util_filter.h"
 
 #include "util_script.h"
 
+#ifndef MP_IN_XS
+APLOG_USE_MODULE(perl);
+#endif
+
 #endif /* MODPERL_APACHE_INCLUDES_H */
diff --git a/src/modules/perl/modperl_interp.c b/src/modules/perl/modperl_interp.c
index dfff32e..56bc820 100644
--- a/src/modules/perl/modperl_interp.c
+++ b/src/modules/perl/modperl_interp.c
@@ -500,7 +500,7 @@ modperl_interp_t *modperl_interp_select(request_rec *r, conn_rec *c,
                    "set interp 0x%lx in %s 0x%lx (%s request for %s)\n",
                    (unsigned long)interp, desc, (unsigned long)p,
                    (r ? (is_subrequest ? "sub" : "main") : "conn"),
-                   (r ? r->uri : c->remote_ip));
+                   (r ? r->uri : c->client_ip));
     }
 
     /* set context (THX) for this thread */
diff --git a/src/modules/perl/modperl_module.c b/src/modules/perl/modperl_module.c
index da148ca..f6a18b1 100644
--- a/src/modules/perl/modperl_module.c
+++ b/src/modules/perl/modperl_module.c
@@ -832,7 +832,7 @@ const char *modperl_module_add(apr_pool_t *p, server_rec *s,
 
     modperl_module_insert(modp);
 
-    ap_add_loaded_module(modp, p);
+    ap_add_loaded_module(modp, p, modp->name);
 
     apr_pool_cleanup_register(p, modp, modperl_module_remove,
                               apr_pool_cleanup_null);
diff --git a/t/response/TestAPI/add_config.pm b/t/response/TestAPI/add_config.pm
index ff52cbc..c5f2d37 100644
--- a/t/response/TestAPI/add_config.pm
+++ b/t/response/TestAPI/add_config.pm
@@ -100,7 +100,6 @@ sub handler : method {
 
     my $expect =  Apache2::Const::OPT_ALL |
                   Apache2::Const::OPT_UNSET |
-                  Apache2::Const::OPT_INCNOEXEC |
                   Apache2::Const::OPT_MULTI |
                   Apache2::Const::OPT_SYM_OWNER;
 
diff --git a/t/response/TestAPI/aplog.pm b/t/response/TestAPI/aplog.pm
index f2a4e19..1357311 100644
--- a/t/response/TestAPI/aplog.pm
+++ b/t/response/TestAPI/aplog.pm
@@ -93,7 +93,7 @@ sub handler {
                    APR::Const::ENOTIME, "log_rerror test");
     # can't match against the error string, since a locale may kick in
     ok t_cmp $logdiff->diff,
-        qr/\[crit\] .*?: log_rerror test/,
+        qr/\[\w*:crit\] \[pid[^]]+\] .*?: \[[^]]+\] log_rerror test/,
         '$r->log_rerror(LOG_MARK, LOG_CRIT, APR::Const::ENOTIME...)';
 
     # log_error
@@ -101,13 +101,13 @@ sub handler {
         t_server_log_error_is_expected();
         $r->log_error('$r->log_error test');
         ok t_cmp $logdiff->diff,
-            qr/\[error\] \$r->log_error test/,
+            qr/\[\w*:error\] \[pid[^]]+\] \$r->log_error test/,
             '$r->log_error(...)';
 
         t_server_log_error_is_expected();
         $s->log_error('$s->log_error test');
         ok t_cmp $logdiff->diff,
-            qr/\[error\] \$s->log_error test/,
+            qr/\[\w*:error\] \[pid[^]]+\] \$s->log_error test/,
             '$s->log_error(...)';
     }
 
@@ -116,13 +116,13 @@ sub handler {
         t_server_log_error_is_expected();
         $r->log_reason('$r->log_reason test');
         ok t_cmp $logdiff->diff,
-            qr/\[error\] access to.*failed.*reason: \$r->log_reason test/,
+            qr/\[\w*:error\] \[pid[^]]+\] access to.*failed.*reason: \$r->log_reason test/,
             '$r->log_reason(msg)';
 
         t_server_log_error_is_expected();
         $r->log_reason('$r->log_reason filename test','filename');
         ok t_cmp $logdiff->diff,
-            qr/\[error\] access to filename failed.*\$r->log_reason filename test/,
+            qr/\[\w*:error\] \[pid[^]]+\] access to filename failed.*\$r->log_reason filename test/,
             '$r->log_reason(msg, filename)';
     }
 
@@ -177,7 +177,7 @@ sub handler {
     t_server_log_warn_is_expected();
     $s->warn('$s->warn test');
     ok t_cmp $logdiff->diff,
-        qr/\[warn\] \$s->warn test/,
+        qr/\[\w*:warn\] \[pid[^]]+\] \$s->warn test/,
         '$s->warn()';
 
     {
@@ -185,7 +185,7 @@ sub handler {
         # this uses global server to get $s internally
         Apache2::ServerRec::warn("Apache2::ServerRec::warn test");
         ok t_cmp $logdiff->diff,
-            qr/\[warn\] Apache2::ServerRec::warn test/,
+            qr/\[\w*:warn\] \[pid[^]]+\] Apache2::ServerRec::warn test/,
             'Apache2::ServerRec::warn() w/o Apache2::RequestUtil->request ';
 
         Apache2::RequestUtil->request($r);
@@ -193,14 +193,14 @@ sub handler {
         # this uses the global $r to get $s internally
         Apache2::ServerRec::warn("Apache2::ServerRec::warn test");
         ok t_cmp $logdiff->diff,
-            qr/\[warn\] Apache2::ServerRec::warn test/,
+            qr/\[\w*:warn\] \[pid[^]]+\] Apache2::ServerRec::warn test/,
             'Apache2::ServerRec::warn() w/ Apache2::RequestUtil->request ';
     }
 
     t_server_log_warn_is_expected();
     warn "warn test";
     ok t_cmp $logdiff->diff,
-        qr/\[warn\] warn test/,
+        qr/\[\w*:warn\] \[pid[^]]+\] warn test/,
         'overriden via export warn()';
 
     Apache2::Const::OK;
diff --git a/xs/Apache2/Log/Apache2__Log.h b/xs/Apache2/Log/Apache2__Log.h
index 1866315..f642a5d 100644
--- a/xs/Apache2/Log/Apache2__Log.h
+++ b/xs/Apache2/Log/Apache2__Log.h
@@ -48,13 +48,13 @@ static void mpxs_ap_log_error(pTHX_ int level, SV *sv, SV *msg)
         s = modperl_global_get_server_rec();
     }
 
-    if ((lmask == APLOG_DEBUG) && (s->loglevel >= APLOG_DEBUG)) {
+    if ((lmask == APLOG_DEBUG) && (s->log.level >= APLOG_DEBUG)) {
         COP *cop = PL_curcop;
         file = CopFILE(cop); /* (caller)[1] */
         line = CopLINE(cop); /* (caller)[2] */
     }
 
-    if ((s->loglevel >= lmask) &&
+    if ((s->log.level >= lmask) &&
         SvROK(msg) && (SvTYPE(SvRV(msg)) == SVt_PVCV)) {
         dSP;
         ENTER;SAVETMPS;
diff --git a/xs/Apache2/ServerUtil/Apache2__ServerUtil.h b/xs/Apache2/ServerUtil/Apache2__ServerUtil.h
index e222c1b..f58c89d 100644
--- a/xs/Apache2/ServerUtil/Apache2__ServerUtil.h
+++ b/xs/Apache2/ServerUtil/Apache2__ServerUtil.h
@@ -162,8 +162,8 @@ SV *mpxs_Apache2__ServerRec_get_handlers(pTHX_ server_rec *s,
 #define mpxs_Apache2__ServerUtil_server(classname) modperl_global_get_server_rec()
 
 #if !defined(OS2) && !defined(WIN32) && !defined(BEOS)  && !defined(NETWARE)
-#define mpxs_Apache2__ServerUtil_user_id(classname)  unixd_config.user_id
-#define mpxs_Apache2__ServerUtil_group_id(classname) unixd_config.group_id
+#define mpxs_Apache2__ServerUtil_user_id(classname)  ap_unixd_config.user_id
+#define mpxs_Apache2__ServerUtil_group_id(classname) ap_unixd_config.group_id
 #else
 #define mpxs_Apache2__ServerUtil_user_id(classname)  0
 #define mpxs_Apache2__ServerUtil_group_id(classname) 0
diff --git a/xs/ModPerl/Global/ModPerl__Global.h b/xs/ModPerl/Global/ModPerl__Global.h
index 2ece589..1b38683 100644
--- a/xs/ModPerl/Global/ModPerl__Global.h
+++ b/xs/ModPerl/Global/ModPerl__Global.h
@@ -17,7 +17,11 @@
 typedef void (*mpxs_special_list_do_t)(pTHX_ modperl_modglobal_key_t *,
                                        const char *, I32);
 
-static int mpxs_special_list_do(pTHX_ const char *name,
+int mpxs_special_list_do(pTHX_ const char *name,
+                                SV *package,
+                                mpxs_special_list_do_t func);
+
+int mpxs_special_list_do(pTHX_ const char *name,
                                 SV *package,
                                 mpxs_special_list_do_t func)
 {
@@ -36,7 +40,9 @@ static int mpxs_special_list_do(pTHX_ const char *name,
     return TRUE;
 }
 
-static
+int mpxs_ModPerl__Global_special_list_call(pTHX_ const char *name,
+                                                     SV *package);
+
 MP_INLINE int mpxs_ModPerl__Global_special_list_call(pTHX_ const char *name,
                                                      SV *package)
 {
@@ -44,7 +50,11 @@ MP_INLINE int mpxs_ModPerl__Global_special_list_call(pTHX_ const char *name,
                                 modperl_perl_global_avcv_call);
 }
 
-static
+
+int mpxs_ModPerl__Global_special_list_clear(pTHX_ const char *name,
+                                                      SV *package);
+
+
 MP_INLINE int mpxs_ModPerl__Global_special_list_clear(pTHX_ const char *name,
                                                       SV *package)
 {
@@ -52,7 +62,11 @@ MP_INLINE int mpxs_ModPerl__Global_special_list_clear(pTHX_ const char *name,
                                 modperl_perl_global_avcv_clear);
 }
 
-static
+int mpxs_ModPerl__Global_special_list_register(pTHX_
+                                                         const char *name,
+                                                         SV *package);
+
+
 MP_INLINE int mpxs_ModPerl__Global_special_list_register(pTHX_
                                                          const char *name,
                                                          SV *package)
diff --git a/xs/maps/modperl_types.map b/xs/maps/modperl_types.map
index 3b02f02..8c6d541 100644
--- a/xs/maps/modperl_types.map
+++ b/xs/maps/modperl_types.map
@@ -7,6 +7,8 @@ struct modperl_filter_t | Apache2::OutputFilter
 SV *  | SV
 I32   | IV
 I32 * | IV
+U16   | UV
+U16 * | UV
 U32   | UV
 U32 * | UV
 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@perl.apache.org
For additional commands, e-mail: dev-h...@perl.apache.org

Reply via email to