This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: fixincl mmap problem on Solaris


Bruce Korb wrote:
> 
>[snip]
> 
>
> Way too much work.  Instead:
> 
>   data_map_size = stbf.st_size;
>   ...
> 
>   if ((data_map_size & (PAGESIZE-1)) == 0)
>      res = BAD_ADDR
>   else
>      res = (char*)mmap ((void*)NULL, data_map_size, PROT_READ,
>                         MAP_PRIVATE, data_map_fd, 0);
>   if (res == (char*)BAD_ADDR)
>     {
>       curr_data_mapped = BOOL_FALSE;
>       res = load_file_data ( fdopen (data_map_fd, "r"));
>     }

Actually it's the file size we need to check so this needs to be

>   if (((data_map_size-1) & (PAGESIZE-1)) == 0)
>      res = BAD_ADDR

I've just noticed that in fixincl.c we use both

	#if HAVE_MMAP_FILE

and

	#ifdef HAVE_MMAP_FILE

which could cause problems if HAVE_MMAP_FILE is ever defined to be 0.
I'm not sure it actually makes any difference in practice because
I believe that HAVE_MMAP_FILE is only ever defined with the value
1 or is left undefined.

Graham

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]