You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Brett @Google" <br...@gmail.com> on 2010/12/06 10:11:27 UTC

patch for Apache2::SizeLimit under solaris 10

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

Re: patch for Apache2::SizeLimit under solaris 10

Posted by Adam Prime <ad...@utoronto.ca>.
What version of SizeLimit were you using?  This was fixed in svn in 
r882407, which was released in 0.93 in October

Adam

On 12/6/2010 4:11 AM, Brett @Google wrote:
> 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
>