[PATCH v2 1/5] ntdll: add support for IOCTL_COPYCHUNK.

Alex Xu (Hello71) alex_y_xu at yahoo.ca
Wed Aug 4 20:39:48 CDT 2021


Excerpts from Chip Davis's message of August 4, 2021 2:46 pm:
> August 4, 2021 11:40 AM, "Alex Xu (Hello71)" <alex_y_xu at yahoo.ca> wrote:
> 
>> diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
>> index 45e444d8576..4e355ef8809 100644
>> --- a/dlls/ntdll/unix/file.c
>> +++ b/dlls/ntdll/unix/file.c
>> @@ -333,6 +333,7 @@ NTSTATUS errno_to_status( int err )
>>      TRACE( "errno = %d\n", err );
>>      switch (err)
>>      {
>> +    case 0:         return STATUS_SUCCESS;
> 
> Most syscalls do not clear errno(3) to 0 on success; instead, they leave it untouched. copy_file_range(2) is no exception. This is why we don't have a case for that.

This is a hack to handle explicit errno = 0 in IOCTL_COPYCHUNK 
implementation. I can work on a clearer implementation if that's 
preferred.

>>      case EAGAIN:    return STATUS_SHARING_VIOLATION;
>>      case EBADF:     return STATUS_INVALID_HANDLE;
>>      case EBUSY:     return STATUS_DEVICE_BUSY;
>> @@ -364,6 +365,7 @@ NTSTATUS errno_to_status( int err )
>> #endif
>>      case ENOEXEC:   /* ?? */
>>      case EEXIST:    /* ?? */
>> +    case ENOMEM:    return STATUS_NO_MEMORY;
> 
> This is the wrong place for that. It will cause the ENOEXEC and EEXIST cases to return STATUS_NO_MEMORY, and I don't think we want that.

Yes, of course you are right. I will fix this in the next revision.

Regards,
Alex.



More information about the wine-devel mailing list