[HACK] Re: Who understands this code?

Donald Smith dss-lfs at cfl.rr.com
Sat Mar 15 18:49:07 PST 2003


Greg Schafer wrote:
> On Sat, Mar 15, 2003 at 05:54:41PM -0500, Donald Smith wrote:
> 
>>//okay put this after the char *x,...
>>
>>int i;
>>
>>//then before the if (y != x + pg):
>>
>>for (i = 0; i < 8; i++) /* limit to 8 tries */
>>  {
>>    if (y != x + pg)
>>      {
>>        x = y;
>>        y = anonmap(pg);
>>        if (y == (char *)MAP_FAILED)
>>          perror_exit ("test 3 mmap 3", 15);
>>      }
>>    else
>>        break; /* got one */
>>  }
>>
>>// this code is untested! don't even know if it compiles. I think break 
>>is the correct instruction to use.
> 
> 
> Thanks Don. It compiles and even appears to do the right thing! I just tried
> ld.so.cache sizes of 3102, 6151 & 29741 and it seemed to do the right thing
> on all accounts.
> 
> The straces are attached for your perusal.
> 
> Greg

straces look good. I guess break was correct!

The correct fix would be an even more invasive and probably with a while 
loop, but it's only a test program. The above patch could be submitted 
to the gcc guys.

I did learn something though. From the straces I would guess that the 
loader kicks off a thread to load the shared libraries while the main 
program continues on its merry way. That's pretty cool. Gets the program 
going faster instead of waiting for all the libraries to be loaded 
before starting anything.

don

-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe lfs-dev' in the subject header of the message



More information about the lfs-dev mailing list