New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PATCH] ioctl IOCPARM_LEN(x) should be _IOC_SIZE(x) on Linux, not 256 #8169
Comments
From jvdias@redhat.comCreated by jvdias@redhat.comperl.h incorrectly guessed the IOCPARM_LEN on Linux to be constant 256 . The IOCPARM_LEN(ioctl_number) macro is meant to extract the length / size On Linux, the _IOC_SIZE(ioctl_number) macro is provided for this purpose, if (SvPOK(argsv) || !SvNIOK(argsv)) { "need" was ALWAYS set to '257' on linux . This bug was found to be the root cause of Red Hat Bugzilla #171111: Here's a patch to perl.h which fixes this problem: Inline Patch--- perl-5.8.7/perl.h.IOC_SIZE 2005-05-07 16:11:45.000000000 -0400
+++ perl-5.8.7/perl.h 2005-10-25 16:56:10.000000000 -0400
@@ -2508,11 +2508,17 @@
#ifndef IOCPARM_LEN
# ifdef IOCPARM_MASK
- /* on BSDish systes we're safe */
+ /* on BSDish systems we're safe */
# define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK)
# else
- /* otherwise guess at what's safe */
-# define IOCPARM_LEN(x) 256
+# ifdef _IOC_SIZE
+ /* on Linux systems we're safe */
+# define IOCPARM_LEN(x) _IOC_SIZE(x)
+# else
+ /* otherwise guess at what's safe (we're UNSAFE!) */
+# warning "unsafe assumption of IOCPARM_LEN=256"
+# define IOCPARM_LEN(x) 256
+# endif
# endif
#endif
Please consider applying the above patch, and fix this issue in future Thank You, Jason Vas Dias <jvdias@redhat.com> Perl Info
|
From @rgsJason Vas Dias (via RT) wrote:
No, it's set by the SvPV_force macro.
Thanks, I applied it with a minor tweak as change #25852 in the ==== //depot/perl/perl.h#638 (text) ==== @@ -2959,11 +2959,16 @@ #ifndef IOCPARM_LEN |
The RT System itself - Status changed from 'new' to 'open' |
@rgs - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#37535 (status was 'resolved')
Searchable as RT37535$
The text was updated successfully, but these errors were encountered: