This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #37535] [PATCH] ioctl IOCPARM_LEN(x) should be _IOC_SIZE(x) on Linux, not 256
authorJason Vas Dias <unknown>
Tue, 25 Oct 2005 15:27:28 +0000 (08:27 -0700)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Wed, 26 Oct 2005 09:37:25 +0000 (09:37 +0000)
From: Jason Vas Dias (via RT) <perlbug-followup@perl.org>
Message-ID: <rt-3.0.11-37535-123290.14.118037538994@perl.org>

p4raw-id: //depot/perl@25852

perl.h

diff --git a/perl.h b/perl.h
index 97e8058..001bd69 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -2959,11 +2959,16 @@ typedef pthread_key_t   perl_key;
 
 #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
+#      if defined(_IOC_SIZE) && defined(__GLIBC__)
+       /* on Linux systems we're safe */
+#          define IOCPARM_LEN(x) _IOC_SIZE(x)
+#      else
        /* otherwise guess at what's safe */
-#      define IOCPARM_LEN(x)   256
+#          define IOCPARM_LEN(x)       256
+#      endif
 #   endif
 #endif