To:
[email protected] (DJ Delorie)
Copy:
[email protected]
Date: Thu, 9 May 2024 20:20:19 +0200
From: Pali <[email protected]>
Cc: [email protected]
Hello. I have there a change which fixes ioctl and fcntl functions when
file descriptor uses file system extension API. These two functions are
takes variadic arguments and file system extension API takes va_list structure with all corresponding arguments. djgpp code currently do not
pass all arguments to API functions __FSEXT_ioctl and __FSEXT_fcntl.
My fix, which is below, uses __builtin_apply_args() which returns
pointer to va_list-compatible structure of all arguments (including non-variadic). It works for djgpp i386 calling convention. It does not
work on e.g. AMD64, but this is not a djgpp case which is 32-bit x86.
For using __builtin_apply_args, it was required to manually inline __FSEXT_func_wrapper function as it takes variadic arguments and not
va_list structure as the "func" itself.
ISTR that the rest of the arguments can be accessed because they are
on the stack.
Anyway, I'm not familiar with this code well enough to review these
patches, but I do know that the code is tricky because ioctl and fcntl
have "dynamic" signature, and the actual arguments depend on the
IOCTL/FCNTL function being invoked. I hope someone else (DJ?) could
review the patches. Sorry.
And I have there small cleanup, which removes dead code in local static function _unix_ioctl. This function is called only when __FSEXT_ioctl rejected the call and there is no need to call __FSEXT_get_function()
second time if the first time it returned NULL (no FSEXT).
maybe I'm misreading the code, but AFAIU it can call _unix_ioctl also
when FSEXT is non-NULL, but __FSEXT_func_wrapper returned zero. So
I'm not sure this patch is correct.
Thanks.
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)