fadvise: change printing of len argument to unsigned in fadvise64 syscall
The kernel declares fadvise64 as
long sys_fadvise64(int fd, loff_t offset, size_t len, int advice);
* fadvise.c (SYS_FUNC(fadvise64)): Change conversion specifier from
"%ld" to "%lu" for printing len argument since kernel expects argument
of type size_t.
fallocate: change print format of offset and len arguments to signed
Since types of these arguments are off_t and kernel actually expects
signed values in order to fail when negative values are provided,
lets display these values as signed.
* fallocate.c (SYS_FUNC(fallocate)): Change conversion specifier for
printing "offset" and "len" syscall arguments from %llu to %lld.
quota: remove legacy subcommand decoding support code
Support for these quota subcommands by linux kernels has been dropped
long time ago (between 2.5.16 and 2.5.17), so lets drop it in order
to minimize amount of code which should be subjected to testing and
structured conversion.
quota: add packed attribute to struct if_dqblk definition
Since the only difference between 32-bit and 64-bit environments
regarding this structure is its padding, lets just add packed attribute
to its definition instead of going full mpers.
Q_XQUOTASYNC is no-op, but it does not require id/addr arguments anyway.
* quota.c (decode_cmd_data): Add Q_SYNC and Q_XQUOTASYNC to subcommand
dispatch switch since id/addr arguments for these subcommands are known
to be ignored.
quota: avoid printing id argument for those commands that ignore it
As id argument is not used for Q_QUOTAOFF, Q_GETFMT, Q_V2_GETINFO,
Q_GETINFO, Q_V2_SEETINFO, Q_SETINFO, Q_SYNC, Q_XQUOTAON, Q_XQUOTAOFF,
Q_XQUOTARM, Q_XGETQSTAT, Q_XGETQSTATV, Q_XQUOTASYNC, Q_V1_GETSTATS, and
Q_V2_GETSTATS subcommands, do not print it for these subcommands.
* quota.c (decode_cmd_data): Add id argument parameter, add printing
of id argument for Q_GETQUOTA, Q_SETQUOTA, Q_GETNEXTQUOTA,
Q_V1_GETQUOTA, Q_V1_SETQUOTA, Q_V2_GETQUOTA, Q_V2_SETQUOTA,
Q_XGETQUOTA, Q_XGETNEXTQUOTA, Q_XSETQLIM, and unknown subcommands.
(SYS_FUNC(quotactl)): Remove printing of id argument, pass it
to decode_cmd_data.
* quota.c (SYS_FUNC(quotactl)): Since id call argument is used for
user/group/project ID which all have special semantics for -1,
print it the same way as UIDs are printed.
decode_open: print the mode argument when O_TMPFILE flag is set
O_TMPFILE reqires the mode argument (just like O_CREAT), so print it.
* open.c (STRACE_O_TMPFILE): New macro.
(decode_open): Print the mode argument when O_TMPFILE flag is set.
* tests/open.c (main): Check it.
Fixes RH#1377846.
* xlat/fsmagic.in: Add BFS_MAGIC, GFS2_MAGIC, and ROMFS_MAGIC constants
defined in linux/bfs_fs.h, linux/gfs2_ondisk.h, and linux/romfs_fs.h,
respectively.
* tests/ipc_msg.c: Additional msgget (parameter format) and msgctl
(parameter format, decoding of struct msqid_ds in IPC_SET/IPC_STAT
commands) checks.
* tests/ipc_sem.c: Additional semget and semctl checks.
* tests/ipc_shm.c: Additional shmget and shmctl checks.
* tests/semop.c: Additional semop checks. Add checks for semtimedop.
* tests/semop.test: Add explicit -e parameter in order to trace both
semop and semtimedop.
* tests/shmxt.c: Additional shmat and shmdt checks.
* linux/64/ioctls_inc.h: Update from linux v4.8 using ioctls_gen.sh.
* linux/32/ioctls_inc_align32.h: Likewise.
* linux/32/ioctls_inc_align64.h: Likewise.
ipc: fix printing of nsops argument of semop and semtimedop syscalls
According to POSIX, nsops argument of semop syscall has type size_t,
but the kernel treats nsops argument of semop and semtimedop syscalls
as unsigned int.
* ipc_sem.c (tprint_sembuf_array): Change type of "count" argument
from unsigned long to unsigned int, print it using %u format.
Mark io_setup and io_destroy as memory mapping related syscalls
As io_setup syscall allocates some memory using do_mmap_pgoff, and
io_destroy deallocates this memory using vm_munmap, set TRACE_MEMORY
flag for all sysentries of io_setup and io_destroy using the following
oneliner:
sed -ri '/io_setup|io_destroy/ s/0,/TM,/' linux/*/syscallent*.h
* linux/*/syscallent*.h (io_setup, io_destroy): Change sys_flags to TM.
It was incorrectly assumed that __*64 types are long long on all
platforms, despite strace having specially crafted macros in order
to handle precisely this architecture discrepancy.
The commit fixes this oversight.
* tests/aio.c (main): Use PRI__*64 macros for correct format conversion
specifiers for __*64-typed values.
* ipc_msgctl.c (SYS_FUNC(msgctl)): As msqid argument is treated as int
by the kernel, cast it to int and print it using %d format.
* ipc_sem.c (SYS_FUNC(semop), SYS_FUNC(semtimedop)): Likewise,
for semid argument.
(SYS_FUNC(semget)): Likewise, for nsems argument.
(SYS_FUNC(semctl)): Likewise, for semid and semnum arguments.
* ipc_shm.c (SYS_FUNC(shmat)): Likewise, for shmid argument.
* ipc_shmctl.c (SYS_FUNC(shmctl)): Likewise.
ipc: fix printing key_t arguments of msgget, semget, and shmget syscalls
* ipc_msg.c (SYS_FUNC(msgget)): As key_t type in the kernel
is __kernel_key_t (i.e. int), cast key_t argument to int
and print it using %#x format.
* ipc_sem.c (SYS_FUNC(semget)): Likewise.
* ipc_shm.c (SYS_FUNC(shmget)): Likewise.
* tests/ipc_msg.c (main): Test it.
* tests/ipc_sem.c (main): Likewise.
* tests/ipc_shm.c (main): Likewise.
New sprintrc_grep function is sprintrc function equivalent suitable for
tests where grep-base pattern matching is employed.
* tests/tests.h (sprintrc_grep): New prototype.
* tests/sprintrc.c (enum sprintrc_fmt): New sprintrc format enumeration.
(sprintrc_ex): New function, renamed from sprintrc and updated to
support different formats.
(sprintrc): Change to use sprintrc_ex with SPRINTRC_FMT_RAW.
(sprintrc_grep): New function, calls sprintrc_ex with SPRINTRC_FMT_GREP.
tests: perform more strict structure allocation in sched_xetattr test
Use tail_alloc with precise size of the structure.
* tests/sched_xetattr.c (main): Eliminate usage of anonymous union type.
Rename sched to sched_attr. Change type of sched_attr to struct
pointer. Use tail_alloc for sched_attr allocation, update printf
statements accrodingly.
* tests/aio.c (main): Do not pass 64-bit aio_context_t to io_submit
and io_getevents until strace learns how to print 64-bit pointers on x32
and on x86_64 for x32 personality.
tests: add more tests for sched_getscheduler and sched_xetscheduler
* tests/sched_xetscheduler.c (main): Check for decoding of invalid PID
in sched_getscheduler and sched_setscheduler, invalid address
of sched_param structure, and invalid policy value.
struct iocb contains two fields with fd semantics: aio_fildes and
aio_resfd. It is quite reasonable to use the appropriate function for
printing them (apart from just "%d").
* aio.c (print_common_flags): Add struct tcb pointer to parameter list;
use printfd for printing aio_resfd field.
(print_iocb_header): Add struct tcb pointer to parameter list;
use printfd for printing aio_fildes field.
(print_iocb): Provide tcp argument to print_iocb_header
and print_common_flags.
(SYS_FUNC(io_cancel)): Likewise.