What is the point of mincore() in reserve_area() in libs/wine/mmap.c?

Charles Davis cdavis at mymail.mines.edu
Tue May 4 11:22:44 CDT 2010


On 5/4/10 10:17 AM, Johann "Myrkraverk" Oskarsson wrote:
> Hi all,
> 
> In the Solaris/BSD implementation of reserve_area() in libs/wine/mmap.c there is
> 
>         for (i = 0; i < size; i += pagesize)
>             if (mincore( (caddr_t)addr + i, pagesize, &vec ) != -1) break;
> 
> &vec is never used again in that function.  What is the point of mincore() ?
It's trying to see if the address is valid. From the manpage:

RETURN VALUES
     Upon successful completion, a value of 0 is returned.  Otherwise,
     a value of -1 is returned and errno is set to indicate the error.

ERRORS
     [EINVAL]           addr is not a valid address for user mode.

     [EFAULT]           an error occurred trying to copy to the output
                        character array vec.

vec is to make sure it failed because the address was invalid, not
because it couldn't write the flags out.

Chip



More information about the wine-devel mailing list