[issue16124] fcntl_ioctl still not 100% sane with unsigned longs

Garrett Cooper report at bugs.python.org
Sun Feb 15 10:57:46 CET 2015


Garrett Cooper added the comment:

Yes, it's a duplicate. That being said, documentation alone it should be unsigned long for Darwin (OS/X), FreeBSD, OpenBSD. Looking at the definition for ioctl(2), the below example would cause a failure.

I need to hunt around for a practical example as I don't have one offhand (it's something that was found a long time ago in a couple of python 2.6 at my current employer because they have ioctl's that go beyond the 32-bit boundary IIRC...)

fuji:~ ngie$ clang -Wall -c test_ioctl.c
fuji:~ ngie$ clang -DBROKEN -Wall -c test_ioctl.c
test_ioctl.c:9:9: warning: incompatible pointer types initializing 'ioctl_t'
      (aka 'int (*)(int, int, ...)') with an expression of type 'int (int,
      unsigned long, ...)' [-Wincompatible-pointer-types]
ioctl_t _ioctl = ioctl;
        ^        ~~~~~
1 warning generated.
fuji:~ ngie$ cat test_ioctl.c 
#include <sys/ioctl.h>

#ifdef BROKEN
typedef int (*ioctl_t)(int, int, ...);
#else
typedef int (*ioctl_t)(int, unsigned long, ...);
#endif

ioctl_t _ioctl = ioctl;
fuji:~ ngie$ uname -a
Darwin fuji.local 13.4.0 Darwin Kernel Version 13.4.0: Wed Dec 17 19:05:52 PST 2014; root:xnu-2422.115.10~1/RELEASE_X86_64 x86_64

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16124>
_______________________________________


More information about the Python-bugs-list mailing list