cvs commit: modperl-2.0/xs/APR/PerlIO apr_perlio.c apr_perlio.h

2002-06-21 Thread stas

stas2002/06/21 08:28:44

  Modified:t/response/TestAPR perlio.pm
   xs/APR/PerlIO apr_perlio.c apr_perlio.h
  Log:
  APR PerlIO updates:
  - make the apr layer independent from PerlIOBuf
  - sync with the latest PerlIO API changes
  - cleanup
  - add a new test for buffered write
  - prepare for the future possible LARGE_FILES_CONFLICT constant, for seek
  tests
  
  Revision  ChangesPath
  1.11  +20 -8 modperl-2.0/t/response/TestAPR/perlio.pm
  
  Index: perlio.pm
  ===
  RCS file: /home/cvs/modperl-2.0/t/response/TestAPR/perlio.pm,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- perlio.pm 15 Jun 2002 23:48:58 -  1.10
  +++ perlio.pm 21 Jun 2002 15:28:43 -  1.11
   -12,6 +12,10 
   use Apache::Const -compile = 'OK';
   use constant HAVE_PERLIO = eval { require APR::PerlIO };
   
  +#XXX: feel free to enable if largefile support is not enabled in Perl
  +#XXX: APR::LARGE_FILES_CONFLICT constant?
  +use constant LARGE_FILES_CONFLICT = 1;
  +
   sub handler {
   my $r = shift;
   
   -22,10 +26,10 
   return Apache::OK;
   }
   
  -my $tests = 2; #XXX 11;
  +my $tests = 12;
   my $lfs_tests = 3;
   
  -#$tests += $lfs_tests if USE_LARGE_FILES; #XXX
  +$tests += $lfs_tests unless LARGE_FILES_CONFLICT;
   
   plan $r, tests = $tests, have_perl 'iolayers';
   
   -36,6 +40,7 
   
   my $sep = -- sep --\n;
   my lines = (This is a test: $$\n, test line --sep two\n);
  +
   my $expected = $lines[0];
   my $expected_all = join $sep, lines;
   
   -66,10 +71,9 
expected failure);
   }
   }
  -return Apache::OK; #XXX remove when perlio issues are sorted out
  +
   # seek/tell() tests
  -#XXX: feel free to enable if largefile support is not enabled in Perl
  -if (0) {
  +unless (LARGE_FILES_CONFLICT) {
   open my $fh, :APR, $file, $r 
   or die Cannot open $file for reading: $!;
   
   -132,7 +136,7 
   my expect = ($lines[0] . $sep, $lines[1]);
   ok t_cmp(\@expect,
\@got_lines,
  - adjusted input record sep read);
  + custom complex input record sep read);
   
   close $fh;
   }
   -179,17 +183,25 
   {
   open my $wfh, :APR, $file, $r
   or die Cannot open $file for writing: $!;
  +open my $rfh,  :APR, $file, $r
  +or die Cannot open $file for reading: $!;
   
   my $expected = This is an un buffering write test;
   # unbuffer
   my $oldfh = select($wfh); $| = 1; select($oldfh);
   print $wfh $expected; # must be flushed to disk immediately
   
  -open my $rfh,  :APR, $file, $r
  -or die Cannot open $file for reading: $!;
   ok t_cmp($expected,
scalar($rfh),
file unbuffered write);
  +
  +# buffer up
  +$oldfh = select($wfh); $| = 0; select($oldfh);
  +print $wfh $expected; # must be flushed to disk immediately
  +
  +ok t_cmp(undef,
  + scalar($rfh),
  + file buffered write);
   
   close $wfh;
   close $rfh;
  
  
  
  1.16  +102 -47   modperl-2.0/xs/APR/PerlIO/apr_perlio.c
  
  Index: apr_perlio.c
  ===
  RCS file: /home/cvs/modperl-2.0/xs/APR/PerlIO/apr_perlio.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- apr_perlio.c  21 Jun 2002 02:06:48 -  1.15
  +++ apr_perlio.c  21 Jun 2002 15:28:43 -  1.16
   -10,23 +10,37 
* The PerlIO API is documented in perliol.pod.
**/
   
  +/*
  + * APR::PerlIO implements a PerlIO layer using apr_file_io as the core.
  + */
  +
  +/*
  + * XXX: Since we cannot snoop on the internal apr_file_io buffer
  + * currently the IO is not buffered on the Perl side so every read
  + * requests a char at a time, which is slow. Consider copying the
  + * relevant code from PerlIOBuf to implement our own buffer, similar
  + * to what PerlIOBuf does or push :perlio layer on top of this layer
  + */
  +
   typedef struct {
  -PerlIOBuf base;/* PerlIOBuf stuff */
  +struct _PerlIO base;
   apr_file_t *file;
   apr_pool_t *pool;
   } PerlIOAPR;
   
  -/* clean up any structures linked from PerlIOAPR. a layer can be
  - * popped without being closed if the program is dynamically managing
  - * layers on the stream.
  - */
  -static IV PerlIOAPR_popped(pTHX_ PerlIO *f)
  -{
  -/* PerlIOAPR *st = PerlIOSelf(f, PerlIOAPR); */
   
  -return 0;
  +static IV PerlIOAPR_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg)
  +{
  +IV code = PerlIOBase_pushed(aTHX_ f, mode, arg);
  +if 

cvs commit: modperl-2.0/t/response/TestAPR perlio.pm

2002-06-21 Thread stas

stas2002/06/21 08:45:06

  Modified:t/response/TestAPR perlio.pm
  Log:
  only a comments fixes
  
  Revision  ChangesPath
  1.12  +2 -2  modperl-2.0/t/response/TestAPR/perlio.pm
  
  Index: perlio.pm
  ===
  RCS file: /home/cvs/modperl-2.0/t/response/TestAPR/perlio.pm,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- perlio.pm 21 Jun 2002 15:28:43 -  1.11
  +++ perlio.pm 21 Jun 2002 15:45:06 -  1.12
   -12,8 +12,8 
   use Apache::Const -compile = 'OK';
   use constant HAVE_PERLIO = eval { require APR::PerlIO };
   
  -#XXX: feel free to enable if largefile support is not enabled in Perl
   #XXX: APR::LARGE_FILES_CONFLICT constant?
  +#XXX: you can set to zero if largefile support is not enabled in Perl
   use constant LARGE_FILES_CONFLICT = 1;
   
   sub handler {
   -197,7 +197,7 
   
   # buffer up
   $oldfh = select($wfh); $| = 0; select($oldfh);
  -print $wfh $expected; # must be flushed to disk immediately
  +print $wfh $expected; # should be buffered up and not flushed
   
   ok t_cmp(undef,
scalar($rfh),
  
  
  



cvs commit: modperl-2.0/xs/APR/PerlIO apr_perlio.c

2002-06-21 Thread stas

stas2002/06/21 08:53:40

  Modified:xs/APR/PerlIO apr_perlio.c
  Log:
  a few minor fixes and cleanups
  
  Revision  ChangesPath
  1.17  +3 -7  modperl-2.0/xs/APR/PerlIO/apr_perlio.c
  
  Index: apr_perlio.c
  ===
  RCS file: /home/cvs/modperl-2.0/xs/APR/PerlIO/apr_perlio.c,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- apr_perlio.c  21 Jun 2002 15:28:43 -  1.16
  +++ apr_perlio.c  21 Jun 2002 15:53:40 -  1.17
   -28,7 +28,6 
   apr_pool_t *pool;
   } PerlIOAPR;
   
  -
   static IV PerlIOAPR_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg)
   {
   IV code = PerlIOBase_pushed(aTHX_ f, mode, arg);
   -40,7 +39,6 
   return code;
   }
   
  -
   static PerlIO *PerlIOAPR_open(pTHX_ PerlIO_funcs *self,
 PerlIO_list_t *layers, IV n,
 const char *mode, int fd, int imode,
   -147,7 +145,6 
   return NULL;
   }
   
  -
   static SSize_t PerlIOAPR_read(pTHX_ PerlIO *f, void *vbuf, Size_t count)
   {
   PerlIOAPR *st = PerlIOSelf(f, PerlIOAPR);
   -159,8 +156,8 
   return count;
   }
   else if (rc != APR_SUCCESS) {
  -char errbuf[120];
   #ifdef PERLIO_APR_DEBUG
  +char errbuf[120];
   /* XXX: need to figure way to map APR errno to normal errno,
* so we can use SETERRNO to make the apr errors available to
* Perl's $!  */
   -203,6 +200,7 
   return 0;
   }
   
  +PerlIOBase(f)-flags |= PERLIO_F_ERROR;
   return -1;
   }
   
   -225,7 +223,7 
   
   /* Flush the fill buffer */
   if (PerlIO_flush(f) != 0) {
  - return -1;
  +return -1;
   }
   
   switch(whence) {
   -366,8 +364,6 
   
   return -1;
   }
  -
  -
   
   static PerlIO_funcs PerlIO_APR = {
   APR,
  
  
  



cvs commit: modperl-2.0 Changes

2002-06-21 Thread dougm

dougm   2002/06/21 09:39:44

  Modified:.Changes
  Log:
  update Changes
  
  Revision  ChangesPath
  1.27  +10 -0 modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- Changes   17 Jun 2002 20:00:44 -  1.26
  +++ Changes   21 Jun 2002 16:39:44 -  1.27
   -10,6 +10,16 
   
   =item 1.99_04-dev
   
  +various APR PerlIO updates [Stas Bekman]
  +
  +stop using an apr_pool_t to allocate items for the interpreter pool,
  +safer for threaded MPMs and prevents leaks when interpreters are
  +removed from due to PerlInterpMax{Requests,Spare}
  +
  +implement modperl_sys_dlclose() to avoid apr/pool overhead/thread issues
  +
  +get the -DPERL_CORE optimization working again
  +
   PERL_SET_CONTEXT to the parent interpreter when cloning interpreters at
   request time, else dTHX might be NULL during clone in the given thread,
   which would crash the server.
  
  
  



cvs commit: modperl-2.0/xs/APR/PerlIO apr_perlio.c

2002-06-21 Thread stas

stas2002/06/21 10:37:38

  Modified:xs/APR/PerlIO apr_perlio.c
  Log:
  adjust for PerlIO bleedperl changes
  
  Revision  ChangesPath
  1.18  +3 -2  modperl-2.0/xs/APR/PerlIO/apr_perlio.c
  
  Index: apr_perlio.c
  ===
  RCS file: /home/cvs/modperl-2.0/xs/APR/PerlIO/apr_perlio.c,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- apr_perlio.c  21 Jun 2002 15:53:40 -  1.17
  +++ apr_perlio.c  21 Jun 2002 17:37:38 -  1.18
   -28,9 +28,9 
   apr_pool_t *pool;
   } PerlIOAPR;
   
  -static IV PerlIOAPR_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg)
  +static IV PerlIOAPR_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg, PerlIO_funcs 
*tab)
   {
  -IV code = PerlIOBase_pushed(aTHX_ f, mode, arg);
  +IV code = PerlIOBase_pushed(aTHX_ f, mode, arg, tab);
   if (*PerlIONext(f)) {
   /* XXX: not sure if we can do anything here, but see
* PerlIOUnix_pushed for things that it does
   -366,6 +366,7 
   }
   
   static PerlIO_funcs PerlIO_APR = {
  +sizeof(PerlIO_funcs),
   APR,
   sizeof(PerlIOAPR),
   PERLIO_K_MULTIARG,
  
  
  



cvs commit: modperl-2.0/xs/APR/PerlIO apr_perlio.c

2002-06-21 Thread stas

stas2002/06/21 10:40:18

  Modified:xs/APR/PerlIO apr_perlio.c
  Log:
  wrap the long args line
  
  Revision  ChangesPath
  1.19  +2 -1  modperl-2.0/xs/APR/PerlIO/apr_perlio.c
  
  Index: apr_perlio.c
  ===
  RCS file: /home/cvs/modperl-2.0/xs/APR/PerlIO/apr_perlio.c,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- apr_perlio.c  21 Jun 2002 17:37:38 -  1.18
  +++ apr_perlio.c  21 Jun 2002 17:40:18 -  1.19
   -28,7 +28,8 
   apr_pool_t *pool;
   } PerlIOAPR;
   
  -static IV PerlIOAPR_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg, PerlIO_funcs 
*tab)
  +static IV PerlIOAPR_pushed(pTHX_ PerlIO *f, const char *mode,
  +   SV *arg, PerlIO_funcs *tab)
   {
   IV code = PerlIOBase_pushed(aTHX_ f, mode, arg, tab);
   if (*PerlIONext(f)) {
  
  
  



cvs commit: modperl-2.0/src/modules/perl modperl_log.c modperl_log.h

2002-06-21 Thread dougm

dougm   2002/06/21 13:30:27

  Modified:src/modules/perl modperl_log.c modperl_log.h
  Log:
  modperl_trace needs to use const for the function name (gcc3.1 warns)
  
  Revision  ChangesPath
  1.7   +1 -1  modperl-2.0/src/modules/perl/modperl_log.c
  
  Index: modperl_log.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_log.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- modperl_log.c 12 May 2002 23:01:32 -  1.6
  +++ modperl_log.c 21 Jun 2002 20:30:27 -  1.7
   -19,7 +19,7 
   return debug_level;  
   }
   
  -void modperl_trace(char *func, const char *fmt, ...)
  +void modperl_trace(const char *func, const char *fmt, ...)
   {
   char vstr[8192];
   apr_size_t vstr_len = 0;
  
  
  
  1.9   +1 -1  modperl-2.0/src/modules/perl/modperl_log.h
  
  Index: modperl_log.h
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_log.h,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- modperl_log.h 12 May 2002 23:01:32 -  1.8
  +++ modperl_log.h 21 Jun 2002 20:30:27 -  1.9
   -34,7 +34,7 
   extern unsigned long MP_debug_level;
   #endif
   
  -void modperl_trace(char *func, const char *fmt, ...);
  +void modperl_trace(const char *func, const char *fmt, ...);
   
   void modperl_trace_level_set(server_rec *s, const char *level);
   
  
  
  



cvs commit: modperl-2.0/lib mod_perl.pm

2002-06-21 Thread dougm

dougm   2002/06/21 15:35:49

  Modified:.Changes
   lib  mod_perl.pm
  Log:
  bump version
  
  Revision  ChangesPath
  1.29  +2 -0  modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- Changes   21 Jun 2002 22:25:48 -  1.28
  +++ Changes   21 Jun 2002 22:35:49 -  1.29
   -8,6 +8,8 
   
   =over 3
   
  +=item 1.99_05-dev
  +
   =item 1.99_04 - June 21, 2002
   
   various APR PerlIO updates [Stas Bekman]
  
  
  
  1.5   +1 -1  modperl-2.0/lib/mod_perl.pm
  
  Index: mod_perl.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/mod_perl.pm,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- mod_perl.pm   16 Jun 2002 00:02:58 -  1.4
  +++ mod_perl.pm   21 Jun 2002 22:35:49 -  1.5
   -4,7 +4,7 
   use strict;
   
   BEGIN {
  -our $VERSION = 1.9904;
  +our $VERSION = 1.9905;
   }
   
   1;