[PATCH v2] Cygwin: mmap: fix mmap_is_attached_or_noreserve

Ken Brown kbrown@cornell.edu
Tue Jan 7 20:59:34 GMT 2025


Hi Corinna,

Happy New Year to you too!

On 1/7/2025 2:15 PM, Corinna Vinschen wrote:
> On Dec 27 11:46, Ken Brown wrote:
> Your patch looks good, only...
> 
>> @@ -784,23 +788,27 @@ mmap_is_attached_or_noreserve (void *addr, size_t len)
>>   	  ret = MMAP_RAISE_SIGBUS;
>>   	  break;
>>   	}
>> -      if (!rec->noreserve ())
>> -	break;
>> +      if (nocover)
>> +	/* We need to continue in case we encounter an attached mmap
>> +	   later in the list. */
>> +	continue;
>>   
>> -      size_t commit_len = u_len - (start_addr - u_addr);
>> -      if (commit_len > len)
>> -	commit_len = len;
>> +      if (!rec->noreserve ())
>> +	{
>> +	  nocover = true;
>> +	  continue;
>> +	}
> 
> What about merging the two conditionals into one?  E. g.
> 
>    if (nocover || !rec->noreserve ())
>      {
>        nocover = true;
>        continue;
>      }
> 
> It's a minor style issue, if you like your version better, go for it.
I like your version better.  I'll fix it and push.

Thanks.

Ken


More information about the Cygwin-patches mailing list