patch for Apache2::SizeLimit under solaris 10

"Brett @Google" <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
Hello,

Here is a patch for  Apache2::SizeLimit under solaris 10, apache 2.2,
unthreaded prefork model :

diff -c ./mod_perl-2.0.4/blib/lib/Apache2/SizeLimit.pm ./SizeLimit.pm
*** ./mod_perl-2.0.4/blib/lib/Apache2/SizeLimit.pm      Mon Dec  6 15:59:43
2010
--- ./SizeLimit.pm      Mon Dec  6 18:41:04 2010
***************
*** 52,58 ****
          if Apache2::MPM->is_threaded();

      # decide at compile time how to check for a process' memory size.
!     if (SOLARIS && $Config{'osvers'} >= 2.6) {

          $HOW_BIG_IS_IT = \&solaris_2_6_size_check;

--- 52,58 ----
          if Apache2::MPM->is_threaded();

      # decide at compile time how to check for a process' memory size.
!     if (SOLARIS && $Config{'osvers'} >= 2.6 || $Config{'osvers'} == 2.10)
{

          $HOW_BIG_IS_IT = \&solaris_2_6_size_check;

***************
*** 133,139 ****

  sub solaris_2_6_size_check {
      my $file = "/proc/self/as";
!     my $size = -s $file
          or &error_log("Fatal Error: $file doesn't exist or is empty");
      $size = int($size / 1024); # in Kb
      return ($size, 0);
--- 133,141 ----

  sub solaris_2_6_size_check {
      my $file = "/proc/self/as";
!     my $file2 = "/proc/$$/as";
!     my $size = undef;
!     $size = -s $file or $size = -s $file2
          or &error_log("Fatal Error: $file doesn't exist or is empty");
      $size = int($size / 1024); # in Kb
      return ($size, 0);

Solaris 10 seems to no longer support /proc/self/as (or perhaps just not in
a non-global zone / container)

It does support "/proc/<pid>/as" though, pretty much in the same manner as
2.8. So the thought is just to try both.

The osver conditional breaks after solaris 9, as for Solaris 10 the version
is set to 2.10, which is < 2.6 (floating point).

Cheers
Brett
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.