You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by go...@apache.org on 2007/10/13 08:31:35 UTC

svn commit: r584377 - in /perl/modperl/branches/threading: ./ t/modperl/ t/response/TestModperl/ xs/ModPerl/Interpreter/ xs/maps/ xs/tables/current/Apache2/ xs/tables/current/ModPerl/

Author: gozer
Date: Fri Oct 12 23:31:33 2007
New Revision: 584377

URL: http://svn.apache.org/viewvc?rev=584377&view=rev
Log:
Introduce ModPerl::Interpreter, an interface to modperl_interp_t.
Note, this currently does not behave correctly with a non-threaded
Apache

Submitted-By Torsten Foertsch <to...@gmx.net>
Message-Id: <20...@gmx.net>
Reviewed-By: gozer

Added:
    perl/modperl/branches/threading/t/response/TestModperl/interpreter.pm
    perl/modperl/branches/threading/xs/ModPerl/Interpreter/
    perl/modperl/branches/threading/xs/ModPerl/Interpreter/ModPerl__Interpreter.h
    perl/modperl/branches/threading/xs/maps/modperl_structures.map
Modified:
    perl/modperl/branches/threading/Changes
    perl/modperl/branches/threading/t/modperl/   (props changed)
    perl/modperl/branches/threading/xs/maps/modperl_functions.map
    perl/modperl/branches/threading/xs/maps/modperl_types.map
    perl/modperl/branches/threading/xs/tables/current/Apache2/StructureTable.pm
    perl/modperl/branches/threading/xs/tables/current/ModPerl/FunctionTable.pm

Modified: perl/modperl/branches/threading/Changes
URL: http://svn.apache.org/viewvc/perl/modperl/branches/threading/Changes?rev=584377&r1=584376&r2=584377&view=diff
==============================================================================
--- perl/modperl/branches/threading/Changes (original)
+++ perl/modperl/branches/threading/Changes Fri Oct 12 23:31:33 2007
@@ -12,6 +12,8 @@
 
 =item 2.0.4-dev
 
+Expose modperl_interp_t via ModPerl::Interpreter [Torsten Foertsch]
+
 On Win32, embed the manifest file, if present, in mod_perl.so,
 so as to work with VC 8 [Steve Hay, Randy Kobes]
 

Propchange: perl/modperl/branches/threading/t/modperl/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Fri Oct 12 23:31:33 2007
@@ -1,6 +1,7 @@
 current_callback.t
 env.t
 endav.t
+interpreter.t
 printf.t
 print.t
 dir_config.t

Added: perl/modperl/branches/threading/t/response/TestModperl/interpreter.pm
URL: http://svn.apache.org/viewvc/perl/modperl/branches/threading/t/response/TestModperl/interpreter.pm?rev=584377&view=auto
==============================================================================
--- perl/modperl/branches/threading/t/response/TestModperl/interpreter.pm (added)
+++ perl/modperl/branches/threading/t/response/TestModperl/interpreter.pm Fri Oct 12 23:31:33 2007
@@ -0,0 +1,33 @@
+package TestModperl::interpreter;
+
+# Modperl::Util tests
+
+use strict;
+use warnings FATAL => 'all';
+
+use Apache::Test;
+use Apache::TestUtil;
+
+use ModPerl::Interpreter ();
+
+use Apache2::Const -compile => 'OK';
+
+sub handler {
+    my $r = shift;
+
+    plan $r, tests => 5;
+    
+    my $interp = ModPerl::Interpreter::current();
+    print STDERR Dumper($interp); use Data::Dumper;
+    ok t_cmp ref($interp), 'ModPerl::Interpreter';
+    
+    ok $interp->num_requests > 0;
+    ok $interp->refcnt > 0;
+    ok $interp->mip > 0; 
+    ok $interp->perl > 0; 
+
+    Apache2::Const::OK;
+}
+
+1;
+__END__

Added: perl/modperl/branches/threading/xs/ModPerl/Interpreter/ModPerl__Interpreter.h
URL: http://svn.apache.org/viewvc/perl/modperl/branches/threading/xs/ModPerl/Interpreter/ModPerl__Interpreter.h?rev=584377&view=auto
==============================================================================
--- perl/modperl/branches/threading/xs/ModPerl/Interpreter/ModPerl__Interpreter.h (added)
+++ perl/modperl/branches/threading/xs/ModPerl/Interpreter/ModPerl__Interpreter.h Fri Oct 12 23:31:33 2007
@@ -0,0 +1,21 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+static MP_INLINE
+modperl_interp_t *mpxs_ModPerl__Interpreter_current(pTHX)
+{
+    return MP_THX_INTERP_GET(aTHX);
+}

Modified: perl/modperl/branches/threading/xs/maps/modperl_functions.map
URL: http://svn.apache.org/viewvc/perl/modperl/branches/threading/xs/maps/modperl_functions.map?rev=584377&r1=584376&r2=584377&view=diff
==============================================================================
--- perl/modperl/branches/threading/xs/maps/modperl_functions.map (original)
+++ perl/modperl/branches/threading/xs/maps/modperl_functions.map Fri Oct 12 23:31:33 2007
@@ -162,3 +162,6 @@
 
 MODULE=Apache2::Access   PACKAGE=guess
  mpxs_Apache2__RequestRec_allow_override_opts
+
+MODULE=ModPerl::Interpreter
+ mpxs_ModPerl__Interpreter_current

Added: perl/modperl/branches/threading/xs/maps/modperl_structures.map
URL: http://svn.apache.org/viewvc/perl/modperl/branches/threading/xs/maps/modperl_structures.map?rev=584377&view=auto
==============================================================================
--- perl/modperl/branches/threading/xs/maps/modperl_structures.map (added)
+++ perl/modperl/branches/threading/xs/maps/modperl_structures.map Fri Oct 12 23:31:33 2007
@@ -0,0 +1,14 @@
+##########  ModPerl structures  ##########
+
+# for mapping see %ModPerl::MapUtil::disabled_map in
+# lib/ModPerl/MapUtil.pm
+
+<modperl_interp_t>
+<  mip
+<  perl
+<  num_requests
+<  flags
+-  ccfg
+<  refcnt
+-  tid
+</modperl_interp_t>

Modified: perl/modperl/branches/threading/xs/maps/modperl_types.map
URL: http://svn.apache.org/viewvc/perl/modperl/branches/threading/xs/maps/modperl_types.map?rev=584377&r1=584376&r2=584377&view=diff
==============================================================================
--- perl/modperl/branches/threading/xs/maps/modperl_types.map (original)
+++ perl/modperl/branches/threading/xs/maps/modperl_types.map Fri Oct 12 23:31:33 2007
@@ -1,6 +1,9 @@
 ##########  mod_perl types  ##########
 
 struct modperl_filter_t | Apache2::OutputFilter
+struct modperl_interp_t | ModPerl::Interpreter
+modperl_interp_pool_t * | IV
+PerlInterpreter *       | IV
 
 ##########  Perl types  ##########
 

Modified: perl/modperl/branches/threading/xs/tables/current/Apache2/StructureTable.pm
URL: http://svn.apache.org/viewvc/perl/modperl/branches/threading/xs/tables/current/Apache2/StructureTable.pm?rev=584377&r1=584376&r2=584377&view=diff
==============================================================================
--- perl/modperl/branches/threading/xs/tables/current/Apache2/StructureTable.pm (original)
+++ perl/modperl/branches/threading/xs/tables/current/Apache2/StructureTable.pm Fri Oct 12 23:31:33 2007
@@ -3333,6 +3333,39 @@
         'name' => 'suexec_enabled'
       }
     ]
+  },
+  {
+    'type' => 'modperl_interp_t',
+    'elts' => [
+      {
+        'type' => 'modperl_interp_pool_t *',
+        'name' => 'mip'
+      },
+      {
+        'type' => 'PerlInterpreter *',
+        'name' => 'perl'
+      },
+      {
+        'type' => 'int',
+        'name' => 'num_requests'
+      },
+      {
+        'type' => 'U8',
+        'name' => 'flags'
+      },
+      {
+        'type' => 'modperl_config_con_t *',
+        'name' => 'ccfg'
+      },
+      {
+        'type' => 'int',
+        'name' => 'refcnt'
+      },
+      {
+        'type' => 'unsigned long',
+        'name' => 'tid'
+      }
+    ]
   }
 ];
 

Modified: perl/modperl/branches/threading/xs/tables/current/ModPerl/FunctionTable.pm
URL: http://svn.apache.org/viewvc/perl/modperl/branches/threading/xs/tables/current/ModPerl/FunctionTable.pm?rev=584377&r1=584376&r2=584377&view=diff
==============================================================================
--- perl/modperl/branches/threading/xs/tables/current/ModPerl/FunctionTable.pm (original)
+++ perl/modperl/branches/threading/xs/tables/current/ModPerl/FunctionTable.pm Fri Oct 12 23:31:33 2007
@@ -8199,6 +8199,20 @@
         'name' => 'func'
       }
     ]
+  },
+  {
+    'return_type' => 'modperl_interp_t *',
+    'name' => 'mpxs_ModPerl__Interpreter_current',
+    'attr' => [
+      'static',
+      '__inline__'
+    ],
+    'args' => [
+      {
+        'type' => 'PerlInterpreter *',
+        'name' => 'my_perl'
+      }
+    ]
   }
 ];