History log of /external/strace/ioctlsort.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
3460dc486d333231998de0f19918204aacee9ae3 28-Mar-2015 Felix Janda <felix.janda@posteo.de> Include <linux/ioctl.h> for _IOC_* macros

Fix a compilation failure with musl libc.

* evdev.c: Include <linux/ioctl.h>.
* ioctl.c: Include <linux/ioctl.h> instead of <asm/ioctl.h>.
* ioctlsort.c: Likewise.

Reported-by: Dima Krasner <dima@dimakrasner.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
/external/strace/ioctlsort.c
047365efde4edf5983bfdb03942ff399fceeeb03 15-Feb-2015 Dmitry V. Levin <ldv@altlinux.org> mips: move ABI check to configure.ac

* configure.ac [MIPS]: Check for MIPS ABI.
* defs.h [MIPS]: Remove MIPS ABI check.
* ioctlsort.c: Likewise.
/external/strace/ioctlsort.c
df7aa2b19e6f69c19fbe09180bf1ec4fb52e2615 19-Jan-2015 Dmitry V. Levin <ldv@altlinux.org> ioctl: take all 32 bits of ioctl commands into account

Historically, only 16 bits (8-bit number and 8-bit type) of 32-bit ioctl
commands were used for decoding, which was the source for numerous
annoying collisions like this:

ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(0, MGSL_IOCGPARAMS or MMTIMER_GETRES or MTIOCTOP or SNDCTL_MIDI_MPUMODE, 0x7fffd47f7338) = -1 ENOTTY (Inappropriate ioctl for device)

The solution is to use all 32 bits for decoding, not just "number" and
"type", but also "size" and "direction".

As some architectures override defaults that come from asm-generic/ and
provide alternative definitions for some ioctl commands, we support
per-architecture ioctl definitions and merge them with common
definitions at build time. During the merge, we used to keep both
generic and architecture-specific definitions, now architecture-specific
definitions have precedence over generic ones -- ioctlsort omits
definitions from asm-generic/ for those ioctl names that have different
definitions in asm/.

Additional bits of "direction" are architecture specific -- the number
of bits and their values differ between architectures. To reduce
architecture differences in the source code, we keep "direction" in
symbolic form and compile it in ioctlsort.

Additional bits of "size" are also architecture specific -- not only the
number of bits differ between architectures, but sizes of many types
depend on sizeof(long). To reduce architecture differences in the
source code, we keep 32-bit and 64-bit versions of common ioctl
definitions, and use the appropriate version for each architecture and
personality.

To implement this, the tools for generating ioctl definitions from
kernel headers have been rewritten, and the source format of ioctl
definitions has been extended. The final ioctlent*.h files that are
included by syscall.c are now generated from source ioctls_inc*.h and
ioctls_arch*.h files at build time with ioctlsort.

* ioctl.c (ioctl_lookup): Use all 32 bits of ioctl command code.
* ioctlsort.c: Rewritten.
* linux/32/ioctls_inc.h: New file.
* linux/64/ioctls_inc.h: New file.
* linux/aarch64/ioctls_arch0.h: New file.
* linux/aarch64/ioctls_arch1.h: New file.
* linux/aarch64/ioctls_inc0.h: New file.
* linux/aarch64/ioctls_inc1.h: New file.
* linux/alpha/ioctls_arch0.h: New file.
* linux/alpha/ioctls_inc0.h: New file.
* linux/arc/ioctls_arch0.h: New file.
* linux/arc/ioctls_inc0.h: New file.
* linux/arm/ioctls_arch0.h: New file.
* linux/arm/ioctls_inc0.h: New file.
* linux/avr32/ioctls_arch0.h: New file.
* linux/avr32/ioctls_inc0.h: New file.
* linux/bfin/ioctls_arch0.h: New file.
* linux/bfin/ioctls_inc0.h: New file.
* linux/hppa/ioctls_arch0.h: New file.
* linux/hppa/ioctls_inc0.h: New file.
* linux/i386/ioctls_arch0.h: New file.
* linux/i386/ioctls_inc0.h: New file.
* linux/ia64/ioctls_arch0.h: New file.
* linux/ia64/ioctls_inc0.h: New file.
* linux/m68k/ioctls_arch0.h: New file.
* linux/m68k/ioctls_inc0.h: New file.
* linux/metag/ioctls_arch0.h: New file.
* linux/metag/ioctls_inc0.h: New file.
* linux/microblaze/ioctls_arch0.h: New file.
* linux/microblaze/ioctls_inc0.h: New file.
* linux/mips/ioctls_arch0.h: New file.
* linux/mips/ioctls_inc0.h: New file.
* linux/or1k/ioctls_arch0.h: New file.
* linux/or1k/ioctls_inc0.h: New file.
* linux/powerpc/ioctls_arch0.h: New file.
* linux/powerpc/ioctls_inc0.h: New file.
* linux/powerpc64/ioctls_arch0.h: New file.
* linux/powerpc64/ioctls_arch1.h: New file.
* linux/powerpc64/ioctls_inc0.h: New file.
* linux/powerpc64/ioctls_inc1.h: New file.
* linux/s390/ioctls_arch0.h: New file.
* linux/s390/ioctls_inc0.h: New file.
* linux/s390x/ioctls_arch0.h: New file.
* linux/s390x/ioctls_inc0.h: New file.
* linux/sh/ioctls_arch0.h: New file.
* linux/sh/ioctls_inc0.h: New file.
* linux/sh64/ioctls_arch0.h: New file.
* linux/sh64/ioctls_inc0.h: New file.
* linux/sparc/ioctls_arch0.h: New file.
* linux/sparc/ioctls_inc0.h: New file.
* linux/sparc64/ioctls_arch0.h: New file.
* linux/sparc64/ioctls_arch2.h: New file.
* linux/sparc64/ioctls_inc0.h: New file.
* linux/sparc64/ioctls_inc2.h: New file.
* linux/tile/ioctls_arch0.h: New file.
* linux/tile/ioctls_arch1.h: New file.
* linux/tile/ioctls_inc0.h: New file.
* linux/tile/ioctls_inc1.h: New file.
* linux/x32/ioctls_arch0.h: New file.
* linux/x32/ioctls_arch1.h: New file.
* linux/x32/ioctls_inc0.h: New file.
* linux/x32/ioctls_inc1.h: New file.
* linux/x86_64/ioctls_arch0.h: New file.
* linux/x86_64/ioctls_arch1.h: New file.
* linux/x86_64/ioctls_inc0.h: New file.
* linux/x86_64/ioctls_inc1.h: New file.
* linux/xtensa/ioctls_arch0.h: New file.
* linux/xtensa/ioctls_inc0.h: New file.
* linux/aarch64/ioctlent.h.in: Remove.
* linux/aarch64/ioctlent1.h: Remove.
* linux/alpha/ioctlent.h.in: Remove.
* linux/arc/ioctlent.h.in: Remove.
* linux/arm/ioctlent.h.in: Remove.
* linux/avr32/ioctlent.h.in: Remove.
* linux/bfin/ioctlent.h.in: Remove.
* linux/hppa/ioctlent.h.in: Remove.
* linux/i386/ioctlent.h.in: Remove.
* linux/ia64/ioctlent.h.in: Remove.
* linux/ioctlent.h.in: Remove.
* linux/ioctlent.sh: Remove.
* linux/m68k/ioctlent.h.in: Remove.
* linux/metag/ioctlent.h.in: Remove.
* linux/microblaze/ioctlent.h.in: Remove.
* linux/mips/ioctlent.h.in: Remove.
* linux/mips/ioctlent.sh: Remove.
* linux/or1k/ioctlent.h.in: Remove.
* linux/powerpc/ioctlent.h.in: Remove.
* linux/powerpc64/ioctlent.h: Remove.
* linux/powerpc64/ioctlent1.h: Remove.
* linux/s390/ioctlent.h.in: Remove.
* linux/s390x/ioctlent.h.in: Remove.
* linux/sh/ioctlent.h.in: Remove.
* linux/sh64/ioctlent.h.in: Remove.
* linux/sparc/ioctlent.h.in: Remove.
* linux/sparc64/ioctlent.h.in: Remove.
* linux/sparc64/ioctlent2.h: Remove.
* linux/tile/ioctlent.h.in: Remove.
* linux/tile/ioctlent1.h: Remove.
* linux/x32/ioctlent.h.in: Remove.
* linux/x32/ioctlent1.h: Remove.
* linux/x86_64/ioctlent.h.in: Remove.
* linux/x86_64/ioctlent1.h: Remove.
* linux/xtensa/ioctlent.h.in: Remove.
* linux/x86_64/ioctlent2.h: Include ioctlent0.h instead of ioctlent.h.
* syscall.c (struct_ioctlent ioctlent0): Likewise.
* Makefile.am: Remove all ioctlent-related definitions.
Define the list of ioctlent*.h files that have to be generated by
presence of $(srcdir)/$(OS)/$(ARCH)/ioctls_inc*.h files.
Add rules for ioctlent*.h files generation.
(EXTRA_DIST): Update.
* maint/ioctls_gen.sh: New file.
* maint/ioctls_hex.sh: New file.
* maint/ioctls_sym.sh: New file.
* maint/print_ioctlent.c: New file.
* HACKING-scripts: Update for ioctlent.sh -> ioctls_gen.sh migration.
* .gitignore: Add ioctlent[012].h and ioctls_all[012].h.
* configure.ac (AC_CHECK_HEADERS): Add linux/hiddev.h
and linux/mmtimer.h for tests.
* tests/ioctl.c: New file.
* tests/ioctl.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add ioctl.
(TESTS): Add ioctl.test.
* tests/.gitignore: Add ioctl.
/external/strace/ioctlsort.c
c7afb4881f14e44968f3a78ae5988f04ecc66b68 19-Jan-2015 Dmitry V. Levin <ldv@altlinux.org> ioctl: assume that all ioctl commands have unsigned int type

In linux, ioctl command number has a 32-bit unsigned integer type:
fs/ioctl.c:SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, unsigned long, arg)
If the kernel completely ignores other bits on 64-bit architectures,
why should strace care?
Let's follow the kernel and treat it as unsigned int.

* defs.h (struct_ioctlent): Change "code" type to "unsigned int".
(ioctl_decode, ioctl_lookup, block_ioctl, loop_ioctl, mtd_ioctl,
ubi_ioctl, ptp_ioctl, scsi_ioctl, sock_ioctl, term_ioctl, rtc_ioctl,
v4l2_ioctl): Likewise.
* ioctl.c (ioctl_decode, ioctl_lookup, compare, ioctl_next_match):
Likewise.
* block.c (block_ioctl): Likewise.
* loop.c (loop_ioctl): Likewise.
* mtd.c (mtd_ioctl, ubi_ioctl): Likewise.
* ptp.c (ptp_ioctl): Likewise.
* scsi.c (scsi_ioctl): Likewise.
* sock.c (sock_ioctl): Likewise.
* term.c (term_ioctl): Likewise.
* time.c (rtc_ioctl): Likewise.
* v4l2.c (v4l2_ioctl): Likewise.
* ioctlsort.c (struct ioctlent, compare, main): Likewise.
/external/strace/ioctlsort.c
00119f63fa91ee3612a95b91872abc89ac6ff7e1 04-Nov-2014 Dmitry V. Levin <ldv@altlinux.org> ioctlsort: rewrite build rules using noinst_PROGRAMS

* linux/ioctlsort.c: Rename to ioctlsort.c
* Makefile.am (EXTRA_DIST): Rename linux/ioctlsort.c to ioctlsort.c.
[MAINTAINER_MODE] (noinst_PROGRAMS): Add ioctlsort.
(ioctlsort_SOURCES): Add ioctlsort.c.
(nodist_ioctlsort_SOURCES): Add ioctls.h and ioctldefs.h.
(CLEANFILES): Add $(nodist_ioctlsort_SOURCES).
(ioctlsort.$(OBJEXT)): Likewise.
(ioctlsort): Remove.
/external/strace/ioctlsort.c
1d912aff16f51b055668cf639d0ee89ab262efe1 28-Feb-2014 Dmitry V. Levin <ldv@altlinux.org> Remove obsolete ioctlsort.c

The generic version of ioctlsort.c became obsolete after commit
v4.6-240-g5afdf12 that removed its last non-Linux users.

* ioctlsort.c: Remove.
* Makefile.am (EXTRA_DIST): Remove ioctlsort.c.

Reported-by: Elliott Hughes <enh@google.com>
/external/strace/ioctlsort.c
a6d91ded3f2d5401e09a9c2fa442aabfbfe593a8 16-Mar-2012 Denys Vlasenko <vda.linux@googlemail.com> Tidy up includes and copyright notices, fix indentation

The files not mentioned in changelog below had only
copyright notices fixes and indentation fixes.

* defs.h: Include <stdint.h> and <inttypes.h>.
* file.c: Do not include <inttypes.h>.
Move struct kernel_dirent declaration below top include block.
* block.c: Do not include <stdint.h> and <inttypes.h>.
* quota.c: Likewise.
* desc.c: Likewise.
* signal.c: Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
/external/strace/ioctlsort.c
e83e157021177930b64ec4aa4983bbe13b39e91b 25-Feb-2012 Dmitry V. Levin <ldv@altlinux.org> Compress blank lines

Suppress repeated empty lines left after automated code removal.
This change was made by filtering every source code file through
"cat -s".
/external/strace/ioctlsort.c
30145dda9d7ff70df1d5ad750a183572c73e8963 07-Sep-2010 Dmitry V. Levin <ldv@altlinux.org> Fix const-correctness issues uncovered by gcc -Wwrite-strings

* defs.h (struct xlat): Add const qualifier to the field of
type "char *".
(set_sortby, qualify, printnum, printnum_int): Add const qualifier to
arguments of type "char *".
* count.c (set_sortby): Add const qualifier to the argument and
automatic variable of type "char *".
* desc.c (decode_select): Add const qualifier to automatic variables of
type "char *".
* ioctlsort.c (struct ioctlent): Add const qualifier to fields of
type "char *".
(main): Add const qualifier to argv.
* process.c (printargv): Add const qualifier to the argument and
automatic variable of type "char *".
(printargc) Add const qualifier to argument of type "char *".
* signal.c (sprintsigmask, parse_sigset_t): Add const qualifier to
arguments of type "char *".
* strace.c (progname): Add const qualifier.
(detach): Add const qualifier to automatic variable of type "char *".
* stream.c (struct strbuf): Add const qualifier to the field of
type "char *".
* syscall.c (struct qual_options): Add const qualifier to fields of
type "char *".
(qual_syscall, qual_fault, qual_desc, lookup_class): Add const qualifier
to arguments of type "char *".
(qual_signal): Add const qualifier to the argument of type "char *",
avoid modification of constant argument.
(qualify): Likewise.
* util.c (printflags): Add const qualifier to automatic variable of
type "char *".
(printnum, printnum_int): Add const qualifier to arguments of
type "char *".
/external/strace/ioctlsort.c
a966785753cbabaf44b39c75d387adf423e44caa 17-Mar-2001 Wichert Akkerman <wichert@deephackmode.org> Implement new way to get the ioctl list for Linux: instead of
trying to #include every possible kernel header grab all the relevant
#defines from them and use those directly.
/external/strace/ioctlsort.c
76baf7c9f6dd61a15524ad43c1b690c252cf5b7c 19-Feb-1999 Wichert Akkerman <wichert@deephackmode.org> Initial revision
/external/strace/ioctlsort.c