Commit Graph

4094 Commits

Author SHA1 Message Date
dc0dcf90d6 Remove unused functions
* defs.h (umove_ulong_or_printaddr, umove_ulong_array_or_printaddr):
Remove.
* util.c (umove_ulong_or_printaddr, umove_ulong_array_or_printaddr):
Likewise.
2016-05-07 23:37:53 +00:00
17d1a1633d v4l2.c: use print_array function
* v4l2.c (print_v4l2_ext_control, umoven_or_printaddr_ignore_syserror):
New functions.
(print_v4l2_ext_controls): Use them via print_array.
2016-05-07 23:37:53 +00:00
6469f39ee9 uid.c: use print_array function
* uid.c (print_gid): New function.
(print_groups): Use it via print_array.
2016-05-07 23:37:53 +00:00
f82dcd980d seccomp.c: use print_array function
* seccomp.c (decode_filter, decode_seccomp_fprog): Remove.
(print_bpf_filter): New function.
(print_seccomp_fprog): Use it via print_array.
* tests/seccomp-filter-v.c (main): Update.
2016-05-07 23:37:53 +00:00
48b06a63e8 scsi.c: use print_array function
* scsi.c (print_uchar): New function.
(print_sg_io_buffer): Use it via print_array.
2016-05-07 23:37:53 +00:00
fd2d6a7f52 poll.c: use print_array function
* poll.c (print_pollfd): Change for use as print_array callback.
(decode_poll_entering): Use print_array.
* tests/poll.c: Update.
* tests/poll.test: Update.
2016-05-07 23:37:53 +00:00
636b8c161c numa.c: use print_array function
* numa.c (print_node): New function.
(print_nodemask): Use it via print_array.
(print_page_array, print_int_array): Remove.
(print_addr): New function.
(print_status, print_int): Change for use as print_array callback.
(SYS_FUNC(move_pages)): Use print_addr, print_int, and print_status
via print_array.
* tests/move_pages.c: Update.
* tests/set_mempolicy.c: Likewise.
* tests/set_mempolicy.test: Likewise.
2016-05-07 23:37:52 +00:00
0f04b9d6d1 mem.c: use print_array function
* mem.c [POWERPC] (print_protmap_entry): New function.
[POWERPC] (SYS_FUNC(subpage_prot)): Use it via print_array.
2016-05-07 23:32:30 +00:00
ba4a4c60cf kexec.c: use print_array function
* kexec.c (print_seg): Change for use as print_array callback.
(print_kexec_segments): Use print_array.
2016-05-07 23:32:30 +00:00
0bae8001da ipc_sem.c: use print_array function
* ipc_sem.c (tprint_sembuf): Rename to print_sembuf, change signature
for use as print_array callback.
(tprint_sembuf_array): Use print_array.
2016-05-07 23:32:30 +00:00
4ce3054340 io.c: use print_array function
* io.c (print_iovec_config): New structure.
(print_iovec): New function.
(tprint_iov_upto): Use print_array.
* tests/preadv.c (main): Update.
* tests/pwritev.c (print_iovec, main): Likewise.
2016-05-07 23:32:29 +00:00
02387258cb epoll.c: use print_array function
* epoll.c (print_epoll_event): Change signature for use as print_array
callback, all users updated.
(print_epoll_event_array): Remove.
(epoll_wait_common): Change to use print_array instead
of print_epoll_event_array.
2016-05-07 22:49:39 +00:00
2868e2b941 aio.c: use print_array function
* aio.c (print_iocbp): New function.
(SYS_FUNC(io_submit)): Use it via print_array.  Use widen_to_long
to process long int argument.
(print_io_event): Change to print struct io_event fetched elsewhere.
(SYS_FUNC(io_cancel)): Update use of print_io_event.
(SYS_FUNC(io_getevents)): Use print_io_event via print_array.
Use widen_to_long to print long int arguments.
* tests/aio.c (main): Check decoding of io_submit with negative "nr".
2016-05-07 22:40:06 +00:00
72e4f7af56 Introduce print_array function for consistent decoding of arrays
* defs.h (print_array): New prototype.
* util.c (print_array): New function.
2016-05-07 13:08:36 +00:00
eb5c233d99 Fix corner cases of ICMP_FILTER decoding
* net.c (print_icmp_filter): Print icmp_filter for any positive length.
* tests/net-icmp_filter.c: New file.
* tests/net-icmp_filter.test: New test.
* tests/.gitignore: Add net-icmp_filter.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add net-icmp_filter.test.
2016-05-06 00:22:52 +00:00
1d17ac7c32 xlat: do not strip "1<<" prefix from xlat strings
* xlat/gen.sh (cond_xlat, gen_header): Do not strip "1<<" prefix
from xlat strings to fix incorrect output.
* tests/caps.awk: Update.

Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2016-05-05 22:20:40 +00:00
dcb18a6fd5 tests/xstatfsx.c: fix mips o32 support
mips o32 differs from all other 32-bit architectures by defining
__kernel_fsid_t structure as an array of long ints.

* tests/xstatfsx.c (print_statfs): Explicitly cast elements
of PRINT_F_FSID array to unsigned int.
2016-05-05 21:20:58 +00:00
1e56814f77 Mpersify VIDIOC_* ioctl parser
* v4l2.c: Mpersify arch-specific structures.
(v4l2_ioctl): Mpersify.
* tests/ioctl_v4l2.c: New file.
* tests/ioctl_v4l2.test: New test.
* tests/.gitignore: Add ioctl_v4l2.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_v4l2.test.
2016-05-05 21:20:56 +00:00
1822546133 Mpersify ioctl macros
As values of some ioctl macros differ between personalities, these
personality specific ioctl macros should be properly defined for
mpersified code.  Implement this by redefining personality specific
ioctl macros from ioctlent*.h for each file that includes MPERS_DEFS.

* Makefile.am (ioctl_macros_h): New variable.
(ioctl_macros%.h): New rule.
(BUILT_SOURCES, CLEANFILES): Add $(ioctl_macros_h).
(m%_type_defs.h): #include MPERS_$(mpers_PREFIX)IOCTL_MACROS.
* defs.h [HAVE_M32_MPERS] (MPERS_m32_IOCTL_MACROS): New macro.
[HAVE_MX32_MPERS] (MPERS_mx32_IOCTL_MACROS): Likewise.

Acked-by: Elvira Khabirova <lineprinter0@gmail.com>
2016-05-05 21:20:47 +00:00
0a47ff79ca Fix decoding of VIDIOC_* ioctls
* v4l2.c: Fix numerous bugs in decoding of VIDIOC_* ioctls.
* tests/ioctl.c (main): Update.
2016-05-05 21:20:45 +00:00
6331fd4b32 nsyscalls.test: add mips o32 support
Out-of-range syscalls looks differently on mips o32.

* tests/nsyscalls.c (main): Handle LINUX_MIPSO32.
* tests/nsyscalls.test: Trace syscall called "syscall" on mips.
2016-05-05 18:04:33 +00:00
1e9c966398 Remove initialization of big holes in syscallent.h files
There is no need to explicitly initialize big holes after conversion
of syscallent.h files to use designated initializers.  For architectures
that have some data at the end of syscallent.h this initialization of
big holes is no-op, for others it just inflates the table unnecessarily.

* linux/arc/syscallent.h: Remove initialization of arch specific block
at the end of table.
* linux/metag/syscallent.h: Likewise.
* linux/nios2/syscallent.h: Likewise.
* linux/or1k/syscallent.h: Likewise.
* linux/tile/syscallent.h: Likewise.
* linux/tile/syscallent1.h: Likewise.
* linux/arm/syscallent.h: Remove explicit initialization of a big hole
before socket subcalls.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/mips/syscallent-compat.h: Remove explicit initialization
of big holes between different mips ABIs.
* linux/mips/syscallent-n64.h: Remove explicit initialization
of big holes before socket subcalls and between different mips ABIs.
* linux/mips/syscallent-o32.h: Likewise.
2016-04-29 21:51:00 +00:00
7a1c25ebc4 xlat: make "1<<val" syntax work with 64-bit values
* xlat/gen.sh(cond_xlat, gen_header): Generate 1UUL<<val
for 1<<val syntax.

Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2016-04-29 20:12:54 +00:00
070fec2248 Fix typo in XLAT_TYPE_PAIR
* xlat.h (XLAT_TYPE_PAIR): Take "type" parameter.

Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2016-04-29 20:04:38 +00:00
e212a15955 Fix decoding of move_pages syscall
* numa.c (print_page_array, print_status, print_int, print_int_array):
New functions.
(SYS_FUNC(move_pages)): Rewrite using these functions.
* tests/move_pages.c: New file.
* tests/move_pages.test: New test.
* tests/.gitignore: Add move_pages.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add move_pages.test.
2016-04-29 18:21:02 +00:00
900a282d36 tests: check decoding of mbind syscall
* tests/mbind.c: New file.
* tests/mbind.test: New test.
* tests/.gitignore: Add mbind.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add mbind.test.
2016-04-29 18:21:01 +00:00
Jeff Mahoney
9019cf4cf5 Change type of struct xlat.val to uint64_t
Some ioctls have flags fields that are 64-bit.  A 32-bit val means
these flags will never be matched or printed.

* xlat.h: Include <stdint.h>.
(struct xlat): Change type of val to uint64_t.
2016-04-29 01:12:14 +00:00
9ae46690bd xlat: extend syntax with #val_type directive
When #val_type directive is encountered, gen.sh starts using
XLAT_TYPE/XLAT_TYPE_PAIR macros instead of XLAT/XLAT_PAIR,
with #val_type's argument as a type.

For example, "#val_type uint64_t" means values of type uint64_t.

* xlat/gen.sh (gen_header, print_xlat, print_xlat_pair):
Add val_type support.
2016-04-29 01:12:14 +00:00
6b040fc505 xlat/gen.sh: prepare for adding #val_type directive support
This is essentially a no-op change that makes the following change
easier to read.

* xlat/gen.sh (print_xlat, print_xlat_pair): New functions.
(cond_xlat, gen_header): Use them.
2016-04-29 01:12:14 +00:00
0f4982691e Introduce XLAT_TYPE and XLAT_TYPE_PAIR macros
* xlat.h (XLAT_TYPE): New macro, similar to XLAT but casts
to the specified type instead of unsigned int.
(XLAT_TYPE_PAIR): New macro, similar to XLAT_PAIR but casts
to the specified type instead of unsigned int.
2016-04-29 00:15:01 +00:00
3f25b65d63 xlat: generate xlat pairs using new XLAT_PAIR macro
Before this change there were two forms of xlat entries: those that use XLAT
or XLAT_END macros, and others verbatim entries.  This change converts
the latter to use new XLAT_PAIR macro.

This is necessary for the upcoming change of xlat.val type.

* xlat.h (XLAT_PAIR): New macro.
* xlat/gen.sh (cond_xlat, gen_header): Use it.
2016-04-29 00:15:01 +00:00
a9f956d279 Explicitly cast argument of XLAT macro to unsigned int
This is necessary for the upcoming change of xlat.val type.

* xlat.h (XLAT): Cast the argument to unsigned int.
2016-04-29 00:15:01 +00:00
dd9a511c17 Change type of {s,t}print_open_modes's argument to unsigned
As "flags" argument of sprint_open_modes and tprint_open_modes is
involved only in bit operations, change its type to unsigned.

* defs.h.c (sprint_open_modes, tprint_open_modes): Change type
to unsigned int.
* open.c (sprint_open_modes, tprint_open_modes): Likewise.
2016-04-29 00:13:20 +00:00
909e664a2e tests/remap_file_pages.c: fix for the upcoming change of xlat.val type
The "flags" argument of remap_file_page syscall has type "unsigned
long", so it is not correct to load most significant bits with garbage
ans assume they are going to be ignored.

* tests/remap_file_pages.c (main): Remove artificial garbage from flags.
2016-04-28 21:14:54 +00:00
00beed61a4 Introduce printflags64 function
This is necessary for the upcoming change of xlat.val type.

* defs.h (printflags): Rename to printflags64, change type of integer
argument to uint64_t.
(printflags): New static inline function.
* util.c (printflags): Rename to printflags64, change type of integer
argument to uint64_t.  Print it using PRIx64 format.
Based on patch by Jeff Mahoney <jeffm@suse.com>.
2016-04-28 19:05:13 +00:00
01c910ccc3 Introduce sprintflags64 function
This is necessary for the upcoming change of xlat.val type.

* defs.h (sprintflags): Rename to sprintflags64, change type of integer
argument to uint64_t.
(sprintflags): New static inline function.
* util.c (sprintflags): Rename to sprintflags64, change type of integer
argument to uint64_t.  Print it using PRIx64 format.
Based on patch by Jeff Mahoney <jeffm@suse.com>.
2016-04-28 19:04:38 +00:00
c1328100d4 printxvals: change type of integer argument to uint64_t
This is necessary for the upcoming change of xlat.val type.
All users of printxvals are already prepared for this change.

* defs.h (printxvals): Change type of integer argument to uint64_t.
* util.c (printxvals): Likewise.  Print it using PRIx64 format.
Patch by Jeff Mahoney <jeffm@suse.com>.
2016-04-28 19:04:02 +00:00
43242e6656 xlat_search: change type of integer argument to uint64_t
This is necessary for the upcoming change of xlat.val type.
All users of addflags are already prepared for this change.

* defs.h (xlat_search): Change type of integer argument to uint64_t.
* util.c (xlat_search): Likewise.  Pass it by pointer.
(xlat_bsearch_compare): Treat first argument as a pointer.
Patch by Jeff Mahoney <jeffm@suse.com>.
2016-04-28 19:04:02 +00:00
ed92d87f1c Introduce xlookup64 function
This is necessary for the upcoming change of xlat.val type.

* defs.h (xlookup): Rename to xlookup64, change type of integer argument
to uint64_t.
(xlookup): New static inline function.
* util.c (xlookup): Rename to xlookup64, change type of integer
argument to uint64_t.
Based on patch by Jeff Mahoney <jeffm@suse.com>.
2016-04-28 19:04:02 +00:00
c9146ebef8 addflags: change type of integer argument to uint64_t
This is necessary for the upcoming change of xlat.val type.
All users of addflags are already prepared for this change.

* defs.h (addflags): Change type of integer argument to uint64_t.
* util.c (addflags): Likewise.  Print it using PRIx64 format.
Based on patch by Jeff Mahoney <jeffm@suse.com>.
2016-04-28 19:04:02 +00:00
482bab05a0 Introduce printxval64 wrapper
This is necessary for the upcoming change of xlat.val type.

* defs.h (printxval64): New static inline function.
2016-04-28 19:04:01 +00:00
7d63aa5ef3 Turn printxval macro into a static inline function
This is necessary for the upcoming change of xlat.val type.

* defs.h (printxval): Change to static inline function.
2016-04-28 19:03:21 +00:00
38ed916d1b tests: check decoding of migrate_pages syscall
* tests/migrate_pages.c: New file.
* tests/migrate_pages.test: New test.
* tests/.gitignore: Add migrate_pages.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add migrate_pages.test.
2016-04-28 01:20:19 +00:00
c8c7a5333e Fix decoding of migrate_pages syscall
* numa.c (SYS_FUNC(migrate_pages)): Print syscall arguments
in the right order.
2016-04-28 01:20:19 +00:00
d10a95548c tests: check decoding of set_mempolicy syscall
* tests/set_mempolicy.c: New file.
* tests/set_mempolicy.test: New test.
* tests/.gitignore: Add set_mempolicy.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add set_mempolicy.test.
2016-04-28 01:17:39 +00:00
aa1ed760c8 tests: check decoding of get_mempolicy syscall
* tests/get_mempolicy.c: New file.
* tests/get_mempolicy.test: New test.
* tests/.gitignore: Add get_mempolicy.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add get_mempolicy.test.
2016-04-28 01:17:39 +00:00
9547c4526e numa: fix decoding of nodemask arrays
* numa.c (get_nodes): Rewrite an rename to print_nodemask.
All callers updated.
(SYS_FUNC(mbind), SYS_FUNC(set_mempolicy), SYS_FUNC(get_mempolicy)):
Print a delimiter before nodemask argument.
2016-04-28 01:17:05 +00:00
fb1ae073e9 Fix decoding of policy argument of get_mempolicy syscall
* numa.c (SYS_FUNC(get_mempolicy)): Print policy argument in square
brackets to indicate indirect access.
2016-04-27 22:36:07 +00:00
45a3e460bc Fix decoding of pid_t argument of migrate_pages syscall
* numa.c (SYS_FUNC(migrate_pages)): Print pid_t syscall
argument using %d format.
2016-04-27 22:09:41 +00:00
a182d8c6c1 tests: add printxval function to libtests
* tests/tests.h (printxval): New prototype.
* tests/printxval.c: New file.
* tests/Makefile.am  (libtests_a_SOURCES): Add it.
2016-04-27 20:31:34 +00:00