patch for Apache2::SizeLimit under solaris 10

patch for Apache2::SizeLimit under solaris 10

am 06.12.2010 10:11:27 von brett.maxfield

--00151750d868e371650496ba454f
Content-Type: text/plain; charset=ISO-8859-1

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//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

--00151750d868e371650496ba454f
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hello,

Here is a patch for=A0 Apache2::Si=
zeLimit under solaris 10, apache 2.2, unthreaded prefork model :

dif=
f -c ./mod_perl-2.0.4/blib/lib/Apache2/SizeLimit.pm ./SizeLimit.pm
*** .=
/mod_perl-2.0.4/blib/lib/Apache2/SizeLimit.pm    =A0 Mon Dec=A0 6 1=
5:59:43 2010

--- ./SizeLimit.pm    =A0 Mon Dec=A0 6 18:41:04 2010
***********=
****
*** 52,58 ****
        =A0 if Apache2::MPM->i=
s_threaded();

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


        =A0 $HOW_BIG_IS_IT =3D \&solaris_2_6_size_c=
heck;

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

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


        =A0 $HOW_BIG_IS_IT =3D \&solaris_2_6_size_c=
heck;

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

=A0 sub solaris_2_6=
_size_check {
    =A0 my $file =3D "/proc/self/as"; >!     my $size =3D -s $file

        =A0 or &error_log("Fatal Error: $file does=
n't exist or is empty");
    =A0 $size =3D int($size / =
1024); # in Kb
    =A0 return ($size, 0);
--- 133,141 ---- >
=A0 sub solaris_2_6_size_check {

    =A0 my $file =3D "/proc/self/as";
!     my=
$file2 =3D "/proc/$$/as";
!     my $size =3D undef; r>!     $size =3D -s $file or $size =3D -s $file2
    =
    =A0 or &error_log("Fatal Error: $file doesn't exis=
t or is empty");

    =A0 $size =3D int($size / 1024); # in Kb
    =A0 ret=
urn ($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 osv=
er conditional breaks after solaris 9, as for Solaris 10 the version is set=
to 2.10, which is < 2.6 (floating point).






Cheers
Brett




--00151750d868e371650496ba454f--

Re: patch for Apache2::SizeLimit under solaris 10

am 06.12.2010 15:27:16 von Adam Prime

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//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
>