[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-modperl
Subject:    Re: [mp1] strange build problem with request_rec structure breaks
From:       Stas Bekman <stas () stason ! org>
Date:       2002-12-23 1:25:50
[Download RAW message or body]

[...]
> I've tracked the difference down as to where it is in the structure: all
> elements before and including "finfo" (type: struct stat) are in sync,
> and all elements after and including "parsed_uri" (type: uri_components)
> are 8 bytes off (extra 8 bytes in apache-mod_perl).
> 
> Either "finfo" is eight bytes longer in apache-mod_perl, or
> apache-mod_perl has slipped some other element between "finfo" and
> "parsed_uri".
> 
> Somehow apache-mod_perl and apache-vanilla have a different ideas of the
> request_rec structure. Because I compile mod_ssl using apxs from
> apache-vanilla it works with apace-vanilla but not apache-mod_perl.

it's the struct stat that's different, not the request_rec. And no, 
mod_perl doesn't mangle the Apache datastructures.

Check this out:

/* sizeof.c */
#include <stdio.h>
#include <sys/stat.h>

int main()
{
     printf("size of struct stat is: %d\n", sizeof(struct stat));
     return 0;
}

# sizeof.pl
use Inline C;

foo();

__END__
__C__
////
int foo()
{
     printf("size of struct stat is: %d\n", sizeof(struct stat));
     return 0;
}


% gcc -o sizeof sizeof.c ; ./sizeof
size of struct stat is: 88

% /home/stas/perl/5.6.0/bin/perl ./sizeof.pl
size of struct stat is: 96

tested with other perls on the same machine and the result is the same 
(beware to delete _Inline before each try, since it won't recompile the 
code if you use a different perl version, but the C code haven't changed)

So as you can see there is indeed 8 bytes difference. This is because 
some of the members of the struct stat aren't of the same size when 
compiled with perl and C. You may want to dig deeper and figure out the 
one that's different. But first compare perl -V of the older perl build 
under which things worked and the output of the newly built perl. I 
suspect that the latter has the USE_LARGE_FILES enabled, whereas the 
older doesn't. On my machine /usr/include/bits/stat.h uses a different 
struct stat when large files are enabled.

Ah, indeed that seems to be the issue:

gcc -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -o sizeof sizeof.c ; ./sizeof
size of struct stat is: 96

here you go -D_FILE_OFFSET_BITS=64 is the one that causes the prob.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic