Fix ioctl entries on 32-bit architectures with 64-bit aligned structures

Some ioctl constants are defined to different values on those 32-bit
architectures where structures containing a 64-bit field are aligned on
a 8-byte boundary and have a size multiple of 8 bytes, and on other
32-bit architectures.

* configure.ac: Check the size of a structure containing a 64-bit field.
* linux/32/ioctls_inc.h: Rename to ...
* linux/32/ioctls_inc_align32.h: ... this.
* linux/32/ioctls_inc_align64.h: New file.
* linux/32/ioctls_inc.h: Include either 32/ioctls_inc_align32.h
or ioctls_inc_align64.h depending on SIZEOF_STRUCT_I64_I32.
* Makefile.am (EXTRA_DIST): Add linux/32/ioctls_inc_align32.h and
* linux/32/ioctls_inc_align64.h.
* tests/ioctl.c (main): Test for VIDIOC_ENUMINPUT.
* tests/ioctl.expected: Check VIDIOC_ENUMINPUT decoding.

Reported-by: Philippe De Muyter <phdm@macqel.be>
This commit is contained in:
Дмитрий Левин 2015-05-21 16:19:40 +00:00
parent f95cf99556
commit 8c20d8926c
7 changed files with 5248 additions and 2617 deletions

View File

@ -163,6 +163,8 @@ EXTRA_DIST = \
errnoent.sh \
ioctlsort.c \
linux/32/ioctls_inc.h \
linux/32/ioctls_inc_align32.h \
linux/32/ioctls_inc_align64.h \
linux/32/syscallent.h \
linux/64/ioctls_inc.h \
linux/64/syscallent.h \

View File

@ -716,6 +716,7 @@ AC_CACHE_CHECK([for BLKGETSIZE64], [ac_cv_have_blkgetsize64],
AC_CHECK_SIZEOF([long])
AC_CHECK_SIZEOF([long long])
AC_CHECK_SIZEOF([off_t],,[#include <sys/types.h>])
AC_CHECK_SIZEOF([struct i64_i32],,[struct i64_i32 {long long i64; int i32;};])
AC_CACHE_CHECK([for SIGRTMIN], [st_cv_SIGRTMIN],
[[st_cv_SIGRTMIN="$(echo SIGRTMIN |

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,10 @@
# include <linux/input.h>
#endif
#include <linux/videodev2.h>
#if defined MMTIMER_GETRES \
&& defined VIDIOC_ENUMINPUT \
&& defined HIDIOCGVERSION \
&& defined HIDIOCGPHYS \
&& defined EVIOCGBIT \
@ -31,6 +34,7 @@ main(void )
if (ioctl(-1, TCGETS, &tty) != -1 ||
ioctl(-1, MMTIMER_GETRES, &data) != -1 ||
ioctl(-1, VIDIOC_ENUMINPUT, 0) != -1 ||
ioctl(-1, HIDIOCGVERSION, &data) != -1 ||
ioctl(-1, HIDIOCGPHYS(8), &data) != -1 ||
ioctl(-1, EVIOCGBIT(EV_KEY, 8), &data) != -1 ||

View File

@ -1,5 +1,6 @@
ioctl\(-1, TCGETS, 0x[0-9a-f]+\) += -1 EBADF .*
ioctl\(-1, MMTIMER_GETRES, 0x[0-9a-f]+\) += -1 EBADF .*
ioctl\(-1, VIDIOC_ENUMINPUT, 0\) += -1 EBADF .*
ioctl\(-1, HIDIOCGRDESCSIZE or HIDIOCGVERSION, 0x[0-9a-f]+\) += -1 EBADF .*
ioctl\(-1, HIDIOCGPHYS\(8\), 0x[0-9a-f]+\) += -1 EBADF .*
ioctl\(-1, EVIOCGBIT\(EV_KEY, 8\), 0x[0-9a-f]+\) += -1 EBADF .*