]> granicus.if.org Git - strace/log
strace
9 years agoUpdate SO_* constants
Dmitry V. Levin [Sat, 24 Jan 2015 15:16:23 +0000 (15:16 +0000)]
Update SO_* constants

* xlat/sockoptions.in: Add SO_DOMAIN, SO_MARK, SO_NOFCS, SO_PASSSEC,
SO_PROTOCOL, SO_RCVBUFFORCE, SO_SNDBUFFORCE, SO_TIMESTAMPING,
and SO_TIMESTAMPNS.

9 years agotests: run tests for each supported personality
Dmitry V. Levin [Fri, 23 Jan 2015 22:45:02 +0000 (22:45 +0000)]
tests: run tests for each supported personality

When strace supports more than one personality, run test suite
for each personality supported by the host system.

* bootstrap: Create tests-m32 and tests-mx32 subtrees from tests.
* configure.ac: Check for -m32 and -mx32 runtime support.
(AC_CONFIG_FILES): Add tests-m32/Makefile and tests-mx32/Makefile.
* Makefile.am [HAVE_M32_RUNTIME] (TESTS_M32): Define.
[HAVE_MX32_RUNTIME] (TESTS_MX32): Define.
(SUBDIRS): Add $(TESTS_M32) $(TESTS_MX32).
* .gitignore: Add /tests-m32 and /tests-mx32.

9 years agoFix ILP32 personality struct cmsghdr decoding on LP64 architectures
Dmitry V. Levin [Sat, 24 Jan 2015 01:08:57 +0000 (01:08 +0000)]
Fix ILP32 personality struct cmsghdr decoding on LP64 architectures

* net.c (union_cmsghdr): New union.
[SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4] (cmsghdr32): New structure.
(printcmsghdr): Properly handle the case of current_wordsize < sizeof(long).

9 years agoFix ILP32 personality preadv/pwritev offset decoding on LP64 architectures
Dmitry V. Levin [Fri, 23 Jan 2015 20:04:37 +0000 (20:04 +0000)]
Fix ILP32 personality preadv/pwritev offset decoding on LP64 architectures

* io.c (print_llu_from_low_high_val) [SIZEOF_LONG == SIZEOF_LONG_LONG
&& SUPPORTED_PERSONALITIES > 1]: Properly handle the case of
current_wordsize < sizeof(long).

9 years agoioctl: take all 32 bits of ioctl commands into account
Dmitry V. Levin [Mon, 19 Jan 2015 17:02:16 +0000 (17:02 +0000)]
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.

9 years agoioctl: add decoding for parametrized command names
Gabriel Laskar [Wed, 21 Jan 2015 22:35:27 +0000 (23:35 +0100)]
ioctl: add decoding for parametrized command names

Some ioctl commands from evdev, hiddev, mixer, uinput, spi, and joystick
are parametrized by a size or a number that are variable.  This change
implements printing of these parametrized ioctl command names.

* configure.ac (AC_CHECK_HEADERS): Add linux/input.h.
* defs.h (ioctl_decode_number): New prototype.
* io.c (sys_ioctl): Use ioctl_decode_number.
* ioctl.c (ioctl_decode_number): New function.
* xlat/evdev_abs.in: New file.
* xlat/evdev_ev.in: New file.

Signed-off-by: Gabriel Laskar <gabriel@lse.epita.fr>
9 years agoUpdate auxiliary maintainer mode build tools
Dmitry V. Levin [Wed, 21 Jan 2015 20:50:32 +0000 (20:50 +0000)]
Update auxiliary maintainer mode build tools

* git-set-file-times: Update from rsync.
* git-version-gen: Update from gnulib.
* gitlog-to-changelog: Likewise.

9 years agoUpdate warnings.m4
Dmitry V. Levin [Wed, 21 Jan 2015 20:49:04 +0000 (20:49 +0000)]
Update warnings.m4

* m4/warnings.m4: Update from gnulib.

9 years agopowerpc64: maintain own linux/powerpc64 subdirectory
Dmitry V. Levin [Wed, 21 Jan 2015 17:04:31 +0000 (17:04 +0000)]
powerpc64: maintain own linux/powerpc64 subdirectory

Most architectures supported by strace have their own subdirectory in
linux directory, but powerpc64 didn't, causing inconveniences.

* configure.ac (arch): Define to "powerpc64" on powerpc64.
* linux/powerpc/errnoent1.h: Move to linux/powerpc64/.
* linux/powerpc/ioctlent1.h: Likewise.
* linux/powerpc/signalent1.h: Likewise.
* linux/powerpc/syscallent1.h: Likewise.
* linux/powerpc64/ioctlent.h: New file.
* linux/powerpc64/syscallent.h: Likewise.
* linux/powerpc64/userent.h: Likewise.
* Makefile.am (EXTRA_DIST): Remove linux/powerpc/ioctlent1.h,
linux/powerpc/syscallent1.h, linux/powerpc/errnoent1.h, and
linux/powerpc/signalent1.h; added linux/powerpc64/errnoent1.h,
linux/powerpc64/ioctlent.h, linux/powerpc64/ioctlent1.h,
linux/powerpc64/signalent1.h, linux/powerpc64/syscallent.h,
linux/powerpc64/syscallent1.h, and linux/powerpc64/userent.h.

9 years agoconfigure.ac: remove unused AC_INCLUDEDIR
Dmitry V. Levin [Wed, 21 Jan 2015 16:43:18 +0000 (16:43 +0000)]
configure.ac: remove unused AC_INCLUDEDIR

* configure.ac (AC_INCLUDEDIR): Remove.
* m4/includedir.m4: Remove.

9 years agoioctl: print unrecognized ioctl codes in _IOC(dir,type,nr,size) format
Dmitry V. Levin [Tue, 20 Jan 2015 00:24:36 +0000 (00:24 +0000)]
ioctl: print unrecognized ioctl codes in _IOC(dir,type,nr,size) format

* defs.h (ioctl_print_code): New prototype.
* ioctl.c: Include xlat/ioctl_dirs.h.
(ioctl_print_code): New function.
* io.c (sys_ioctl): Use it.
* xlat/ioctl_dirs.in: New file.

9 years agoioctl: assume that all ioctl commands have unsigned int type
Dmitry V. Levin [Mon, 19 Jan 2015 18:44:21 +0000 (18:44 +0000)]
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.

9 years agoioctlent.sh: cleanup regexps that are used to fetch bases
Dmitry V. Levin [Fri, 16 Jan 2015 20:19:39 +0000 (20:19 +0000)]
ioctlent.sh: cleanup regexps that are used to fetch bases

9 years agoioctlent.sh: sync lookup regexps that are used in grep and sed
Dmitry V. Levin [Fri, 16 Jan 2015 19:59:21 +0000 (19:59 +0000)]
ioctlent.sh: sync lookup regexps that are used in grep and sed

ioctlent.sh looks for ioctl command names using grep, and fetches them
with their definitions using sed.  Historically, lookup regexps used in
grep and sed are slightly different, which makes the script more
complicated than necessary.

9 years agoqemu_multiarch_testing: update
Dmitry V. Levin [Thu, 15 Jan 2015 17:01:32 +0000 (17:01 +0000)]
qemu_multiarch_testing: update

* qemu_multiarch_testing/.gitignore: New file.
* qemu_multiarch_testing/README: Update statistics.
* qemu_multiarch_testing/hdc.dir/init2: Run "make check".
* qemu_multiarch_testing/make-hdc-img.sh: Robustify,
automatically calculate hdc image size.
* qemu_multiarch_testing/parallel-build-hdc-img.sh: Reduce
hdb image size.  Report completion of each parallelized task.

9 years agotests: add IPC_STAT to ipc tests, workaround limitiations of old kernels
Dmitry V. Levin [Wed, 14 Jan 2015 16:52:28 +0000 (16:52 +0000)]
tests: add IPC_STAT to ipc tests, workaround limitiations of old kernels

* tests/ipc_msg.c: Include <errno.h>.
(main): Add a test call with IPC_STAT, handle old kernels MSG_STAT behaviour.
* tests/ipc_sem.c: Include <errno.h>.
(main): Add a test call with IPC_STAT, handle old kernels SEM_STAT behaviour.
* tests/ipc_shm.c: Include <errno.h>.
(main): Add a test call with IPC_STAT, handle old kernels SHM_STAT behaviour.

9 years agoChange length type of umoven and umovestr to unsigned
Dmitry V. Levin [Wed, 14 Jan 2015 08:05:45 +0000 (08:05 +0000)]
Change length type of umoven and umovestr to unsigned

* defs.h (umoven, umovestr): Change type of 3rd argument from "int"
to "unsigned int".
* util.c (umoven, umovestr): Likewise.  Adjust the code appropriately.

9 years agotests: skip sendmmsg/recvmmsg test if these syscalls are not implemented in kernel
Dmitry V. Levin [Wed, 14 Jan 2015 12:47:45 +0000 (12:47 +0000)]
tests: skip sendmmsg/recvmmsg test if these syscalls are not implemented in kernel

* tests/mmsg.c: #include <errno.h>
(main): Return 77 if sendmmsg failed with ENOSYS.

9 years agotests: skip ip network tests when the network is not functional
Dmitry V. Levin [Wed, 14 Jan 2015 11:32:38 +0000 (11:32 +0000)]
tests: skip ip network tests when the network is not functional

* tests/inet-accept-connect-send-recv.c (main): Return 77 if inet stream
socket cannot be created or it cannot be bound to INADDR_LOOPBACK.
* tests/net-yy.test: Skip the test if inet-accept-connect-send-recv
returns 77.

9 years agotests: handle the case when all 64 process capability bits are set
Dmitry V. Levin [Wed, 14 Jan 2015 10:36:57 +0000 (10:36 +0000)]
tests: handle the case when all 64 process capability bits are set

* tests/caps.awk: Handle the case when all bits of 64-bit capability
word are set.

9 years agotests: explicitly request gawk when using gawk features
Dmitry V. Levin [Wed, 14 Jan 2015 10:13:59 +0000 (10:13 +0000)]
tests: explicitly request gawk when using gawk features

* tests/uid.test: Check for gawk availability and invoke gawk instead of
plain awk because the test uses gawk's match() feature.

9 years agotests: skip detach tests if kill does not work
Dmitry V. Levin [Wed, 14 Jan 2015 08:08:56 +0000 (08:08 +0000)]
tests: skip detach tests if kill does not work

* tests/detach-running.test: Skip if "kill -0" does not work.
* tests/detach-sleeping.test: Likewise.
* tests/detach-stopped.test: Likewise.

9 years agoARM OABI: fix potential compilation warning
Dmitry V. Levin [Wed, 14 Jan 2015 07:21:36 +0000 (07:21 +0000)]
ARM OABI: fix potential compilation warning

* syscall.c (get_scno) [!__ARM_EABI__ || ENABLE_ARM_OABI]: Fix
"comparison between signed and unsigned" warning reported by some
gcc versions.

9 years agopowerpc: fix potential compilation warning
Dmitry V. Levin [Wed, 14 Jan 2015 07:17:11 +0000 (07:17 +0000)]
powerpc: fix potential compilation warning

* mem.c [POWERPC] (sys_subpage_prot): Fix "comparison between signed
and unsigned" warning reported by some gcc versions.

9 years agosparc, sparc64: remove ioctl header file names from solaris ioctl entries
Dmitry V. Levin [Tue, 13 Jan 2015 16:33:28 +0000 (16:33 +0000)]
sparc, sparc64: remove ioctl header file names from solaris ioctl entries

Starting with commit v4.9-27-g3e252ca, header file names should not be
part of ioctlent files included by syscall.c

* linux/sparc/ioctlent1.h: Remove ioctl header file names.
* linux/sparc64/ioctlent2.h: Remove all entries, include "ioctlent.h".

9 years agomips: enable indirect ipc subcall support
Dmitry V. Levin [Tue, 13 Jan 2015 15:46:43 +0000 (18:46 +0300)]
mips: enable indirect ipc subcall support

* linux/mips/syscallent-n32.h [LINUX_MIPSN32]: Define SYS_socket_subcall,
include "subcall.h".
* linux/mips/syscallent-n64.h [LINUX_MIPSN64]: Likewise.
* linux/mips/syscallent-o32.h [LINUX_MIPSO32]: Likewise.

9 years agomips: remove stub entries from syscallent files, generate stubs at build time
Dmitry V. Levin [Tue, 13 Jan 2015 04:57:27 +0000 (04:57 +0000)]
mips: remove stub entries from syscallent files, generate stubs at build time

* linux/mips/genstub.sh: New file.
* Makefile.am (EXTRA_DIST): Add it.
* configure.ac [MIPS]: Use it to generate syscallent stubs.
* linux/mips/.gitignore: Add syscallent stubs.
* linux/mips/syscallent-n32.h: Remove stub entries, include
the stub file instead.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.

9 years agobuild: add $(builddir)/$(OS)/$(ARCH) to the headers search list
Dmitry V. Levin [Tue, 13 Jan 2015 06:12:16 +0000 (06:12 +0000)]
build: add $(builddir)/$(OS)/$(ARCH) to the headers search list

* Makefile.am (AM_CPPFLAGS): Add -I$(builddir)/$(OS)/$(ARCH) before
-I$(srcdir)/$(OS)/$(ARCH).

9 years agobuild: fix build if siginfo_t lacks si_timerid/si_overrun
Dmitry V. Levin [Tue, 13 Jan 2015 06:24:04 +0000 (09:24 +0300)]
build: fix build if siginfo_t lacks si_timerid/si_overrun

* configure.ac (AC_CHECK_MEMBERS): Check for siginfo_t.si_timerid and
siginfo_t.si_overrun.
* signal.c (printsiginfo) [SI_TIMER]: Check HAVE_SIGINFO_T_SI_TIMERID
and HAVE_SIGINFO_T_SI_OVERRUN.

9 years agoconfigure.ac: remove unused AM_CONDITIONAL expressions
Dmitry V. Levin [Tue, 13 Jan 2015 04:06:52 +0000 (04:06 +0000)]
configure.ac: remove unused AM_CONDITIONAL expressions

* configure.ac (AM_CONDITIONAL): Remove I386, X86_64, X32.

9 years agotests: portability fixes
Dmitry V. Levin [Tue, 13 Jan 2015 00:06:09 +0000 (00:06 +0000)]
tests: portability fixes

* tests/stat.test: dd obs= is not portable, use bs= instead.
* tests/stat32-v.test: Likewise.
* tests/stat64-v.test: Likewise.
* tests/net.test: Use $* instead of $@ in the quoted string.
* tests/net-fd.test: Likewise.
* tests/statfs.test: Quote { and } in regexps.
* tests/caps.awk: Likewise.
* tests/getdents.awk: Likewise.
* tests/net-yy-accept.awk: Likewise.
* tests/net-yy-connect.awk: Likewise.
* tests/sigaction.awk: Likewise.
* tests/unix-yy-accept.awk: Likewise.
* tests/unix-yy-connect.awk: Likewise.

9 years agoWire up new syscalls
Dmitry V. Levin [Mon, 12 Jan 2015 18:53:32 +0000 (18:53 +0000)]
Wire up new syscalls

* linux/dummy.h (sys_bpf, sys_execveat, sys_getrandom,
sys_kexec_file_load, sys_memfd_create, sys_seccomp): New stub aliases.
* linux/32/syscallent.h (seccomp, getrandom, memfd_create, bpf,
execveat): New entries.
* linux/64/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/ia64/syscallent.h (getrandom, memfd_create, bpf, execveat):
New entries.
* linux/m68k/syscallent.h: Likewise.
* linux/s390/syscallent.h: (seccomp, getrandom, memfd_create, bpf,
s390_pci_mmio_write, s390_pci_mmio_read, execveat): New entries.
* linux/s390x/syscallent.h: Likewise.
* linux/x86_64/syscallent.h (seccomp, getrandom, memfd_create,
kexec_file_load, bpf, execveat): New entries.
* linux/x32/syscallent.h: Likewise.
* linux/xtensa/syscallent.h (seccomp, getrandom, memfd_create):
New entries.

9 years agos390x: adjust some syscall entries
Dmitry V. Levin [Mon, 12 Jan 2015 17:17:14 +0000 (17:17 +0000)]
s390x: adjust some syscall entries

According to linux/arch/s390/include/uapi/asm/unistd.h, readdir is
defined both on s390 and s390x, while getrlimit, _llseek, sendfile64,
and fadvise64_64 are defined on s390 only.

* linux/s390x/syscallent.h (readdir): Add.
(getrlimit, _llseek, sendfile64, fadvise64_64): Remove.

9 years agoChange syscallent.h files to use designated initializers
Dmitry V. Levin [Sun, 11 Jan 2015 02:42:56 +0000 (02:42 +0000)]
Change syscallent.h files to use designated initializers

Automatically convert all linux syscallent.h files to a form that uses
designated initializers, with subsequent correction of whitespace
indentation.

* linux/alpha/syscallent.h: Use designated initializers.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/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/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.

9 years agoCreate generic 32-bit syscallent.h
Dmitry V. Levin [Sun, 11 Jan 2015 01:04:54 +0000 (04:04 +0300)]
Create generic 32-bit syscallent.h

Since arc/syscallent.h, metag/syscallent.h, or1k/syscallent.h, and
tile/syscallent1.h share a lot of identical syscall entries described in
<asm-generic/unistd.h>, move these entries to a new file 32/syscallent.h
using the following automated conversion with subsequent correction of
whitespace indentation:

sed -e 's|^[[:space:]]*\({[^}]\+},\)[[:space:]]*/\*[[:space:]]\([[:space:]]*[0-9]\+\)[[:space:]]*\*/|[\2] = \1|' -e '/^[[:space:]]*\[[[:space:]]*2\(4[4-9]\|5[0-9]\)/d' linux/arc/syscallent.h

* linux/32/syscallent.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* linux/arc/syscallent.h: Include "32/syscallent.h",
remove generic 32-bit syscall entries, use designated initializers.
* linux/metag/syscallent.h: Likewise.
* linux/or1k/syscallent.h: Likewise.
* linux/tile/syscallent1.h: Likewise.

9 years agotile: fix syscall entries
Dmitry V. Levin [Sun, 11 Jan 2015 00:19:32 +0000 (03:19 +0300)]
tile: fix syscall entries

* linux/tile/syscallent1.h (truncate64, ftruncate64): Change nargs to 3.
(pread64, pwrite64): Change nargs to 5.
(llseek): Change sys_name to _llseek.

9 years agos390: fix fadvise64 and fadvise64_64 syscall entries
Dmitry V. Levin [Sun, 11 Jan 2015 00:15:24 +0000 (03:15 +0300)]
s390: fix fadvise64 and fadvise64_64 syscall entries

* linux/s390/syscallent.h (fadvise64, fadvise64_64): Change sys_func to
printargs until special parsers for 31-bit 31 s390 emulation wrappers
are written.

9 years agoalpha: fix fadvise64 syscall entry
Dmitry V. Levin [Sun, 11 Jan 2015 00:13:23 +0000 (03:13 +0300)]
alpha: fix fadvise64 syscall entry

* linux/alpha/syscallent.h (fadvise64): Change sys_name to fadvise64.

9 years agotile: fix fadvise64_64 syscall entry
Dmitry V. Levin [Sun, 11 Jan 2015 00:10:48 +0000 (03:10 +0300)]
tile: fix fadvise64_64 syscall entry

* linux/tile/syscallent1.h (fadvise64_64): Fix nargs, sys_func,
and sys_name.

9 years agoFix getrlimit and ugetrlimit syscall entries
Dmitry V. Levin [Sat, 10 Jan 2015 23:48:55 +0000 (02:48 +0300)]
Fix getrlimit and ugetrlimit syscall entries

* linux/arm/syscallent.h (getrlimit, ugetrlimit): Fix sys_name.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/avr32/syscallent.h (getrlimit): Fix sys_name.
* linux/or1k/syscallent.h: Likewise.
* linux/s390/syscallent.h (ugetrlimit): Fix sys_name.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.

9 years agoFix umount and umount2 syscall entries
Dmitry V. Levin [Sat, 10 Jan 2015 23:16:39 +0000 (02:16 +0300)]
Fix umount and umount2 syscall entries

* linux/aarch64/syscallent1.h (umount): Change nargs to 1.
* linux/avr32/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* linux/ia64/syscallent.h (umount2): Change nargs to 2.
* linux/arm/syscallent.h (umount, umount2): Fix sys_name.
* linux/bfin/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/powerpc/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/metag/syscallent.h: (umount2): Fix sys_name.
* linux/or1k/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.

9 years agoFix sendfile64 syscall entries
Dmitry V. Levin [Sat, 10 Jan 2015 22:41:25 +0000 (01:41 +0300)]
Fix sendfile64 syscall entries

* linux/arc/syscallent.h (sendfile64): Change sys_name to sendfile64.
* linux/metag/syscallent.h: Likewise.
* linux/or1k/syscallent.h: Likewise.

9 years agoFix number of arguments in ipc family syscall entries
Dmitry V. Levin [Sat, 10 Jan 2015 20:51:40 +0000 (23:51 +0300)]
Fix number of arguments in ipc family syscall entries

* linux/64/syscallent.h (msgget, semget, semtimedop, semop, shmget,
shmctl, shmat, shmdt): Fix nargs for direct ipc syscalls.
* linux/alpha/syscallent.h (msgctl, msgget, msgrcv, semget, shmctl,
shmdt, shmget, semtimedop): Likewise.
* linux/avr32/syscallent.h (msgget, semget, semop, semtimedop, shmat,
shmget, shmdt, shmctl): Likewise.
* linux/bfin/syscallent.h (semget, semop, msgctl, msgget, msgrcv, shmat,
* shmctl, shmdt, shmget, semtimedop): Likewise.
* linux/hppa/syscallent.h (semop, semget, msgrcv, msgget, msgctl,
semtimedop): Likewise.
* linux/microblaze/syscallent.h (semtimedop, semget, semop, msgctl,
msgget, msgrcv, shmat, shmctl, shmdt, shmget): Likewise.
* linux/ia64/syscallent.h (semtimedop): Likewise.
* linux/mips/syscallent-n32.h (semtimedop): Likewise.
* linux/mips/syscallent-n64.h (semtimedop): Likewise.
* linux/or1k/syscallent.h (msgget, msgctl, msgrcv, semget, semtimedop,
semop, shmget, shmctl, shmat, shmdt): Likewise.
* linux/sh64/syscallent.h (semget, msgget, shmget): Likewise.
* linux/tile/syscallent1.h (msgget, semget, semtimedop, semop, shmget,
shmctl, shmat, shmdt): Likewise.
* linux/x32/syscallent.h (shmget, shmat, shmctl, semget, semop, shmdt,
msgget, semtimedop): Likewise.
* linux/x86_64/syscallent.h (shmget, shmat, shmctl, semget, semop,
shmdt, msgget, semtimedop): Likewise.
* linux/xtensa/syscallent.h (shmget, shmat, shmctl, shmdt, semtimedop,
semget, semop, msgget, msgrcv, msgctl): Likewise.

9 years agoCreate generic 64-bit syscallent.h
Dmitry V. Levin [Sat, 10 Jan 2015 17:51:37 +0000 (20:51 +0300)]
Create generic 64-bit syscallent.h

Since aarch64/syscallent1.h and tile/syscallent.h share a lot of
identical syscall entries described in <asm-generic/unistd.h>, move
these entries to a new file 64/syscallent.h using the following
automated conversion with subsequent correction of whitespace
indentation:

sed -e 's|^[[:space:]]*\({[^}]\+},\)[[:space:]]*/\*[[:space:]]\([[:space:]]*[0-9]\+\)[[:space:]]*\*/|[\2] = \1|' -e '/^\[[[:space:]]*2\(4[4-9]\|5[0-9]\)\]/d' linux/tile/syscallent.h

* linux/64/syscallent.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* linux/aarch64/syscallent1.h: Include "64/syscallent.h",
remove generic 64-bit syscall entries, use designated initializers.
* linux/tile/syscallent.h: Likewise.

9 years agoFix nfsservctl syscall entries
Dmitry V. Levin [Sat, 10 Jan 2015 17:07:37 +0000 (20:07 +0300)]
Fix nfsservctl syscall entries

* linux/arc/syscallent.h (nfsservctl): Set nargs, sys_func, and sys_name.
* linux/metag/syscallent.h: Likewise.

9 years agoAdd missing syscall entries for sched_[gs]etattr and renameat2
Dmitry V. Levin [Sat, 10 Jan 2015 16:45:08 +0000 (19:45 +0300)]
Add missing syscall entries for sched_[gs]etattr and renameat2

* linux/alpha/syscallent.h (sched_setattr, sched_getattr, renameat2):
New syscall entries.
* linux/arc/syscallent.h: Likewise.
* linux/metag/syscallent.h: Likewise.
* linux/or1k/syscallent.h: Likewise.
* linux/tile/syscallent.h: Likewise.
* linux/tile/syscallent1.h: Likewise.

9 years agoFix NUMA related syscall entries
Dmitry V. Levin [Sat, 10 Jan 2015 16:32:43 +0000 (19:32 +0300)]
Fix NUMA related syscall entries

* linux/alpha/syscallent.h (mbind, get_mempolicy, set_mempolicy):
Set sys_func.
* linux/hppa/syscallent.h (mbind, get_mempolicy, set_mempolicy):
Fix nargs, set sys_func.
* linux/microblaze/syscallent.h (mbind): Fix nargs.
* linux/mips/syscallent-n32.h (move_pages): Set sys_func.
* linux/mips/syscallent-n64.h (move_pages): Likewise.
* linux/mips/syscallent-o32.h (mbind): Fix nargs.
* linux/or1k/syscallent.h (migrate_pages): Likewise.
* linux/powerpc/syscallent.h (migrate_pages): Likewise.
* linux/sh/syscallent.h (mbind): Likewise.
* linux/sh64/syscallent.h (mbind): Likewise.

9 years agoxtensa: fix syscall entries
Dmitry V. Levin [Sat, 10 Jan 2015 16:12:11 +0000 (19:12 +0300)]
xtensa: fix syscall entries

* linux/xtensa/syscallent.h (sendmmsg): Fix sys_func and sys_name.
(restart_syscall, io_setup, io_destroy, io_submit, io_getevents,
io_cancel, add_key, request_key, keyctl): Set sys_func.
(migrate_pages, mbind, get_mempolicy, set_mempolicy, move_pages,
fstatat64): Fix nargs.
(renameat2): New entry.

9 years agoFix sched_setparam syscall entries
Dmitry V. Levin [Sat, 10 Jan 2015 05:28:06 +0000 (08:28 +0300)]
Fix sched_setparam syscall entries

* linux/aarch64/syscallent1.h (sched_setparam): Change nargs to 2.
* linux/arm/syscallent.h (sched_setparam): Likewise.
* linux/avr32/syscallent.h (sched_setparam): Likewise.
* linux/bfin/syscallent.h (sched_setparam): Likewise.
* linux/i386/syscallent.h (sched_setparam): Likewise.
* linux/m68k/syscallent.h (sched_setparam): Likewise.
* linux/microblaze/syscallent.h (sched_setparam): Likewise.
* linux/s390/syscallent.h (sched_setparam): Likewise.
* linux/s390x/syscallent.h (sched_setparam): Likewise.
* linux/sh/syscallent.h (sched_setparam): Likewise.
* linux/sh64/syscallent.h (sched_setparam): Likewise.
* linux/tile/syscallent.h (sched_setparam): Likewise.
* linux/tile/syscallent1.h (sched_setparam): Likewise.
* linux/x32/syscallent.h (sched_setparam): Likewise.
* linux/x86_64/syscallent.h (sched_setparam): Likewise.

9 years agoarc: fix fanotify_mark syscall entry
Dmitry V. Levin [Sat, 10 Jan 2015 05:02:12 +0000 (05:02 +0000)]
arc: fix fanotify_mark syscall entry

* linux/arc/syscallent.h (fanotify_mark): Change nargs to 6.

9 years agoia64: add fallocate syscall entry
Dmitry V. Levin [Sat, 10 Jan 2015 04:49:42 +0000 (04:49 +0000)]
ia64: add fallocate syscall entry

* linux/ia64/syscallent.h (fallocate): Add syscall entry.

9 years agoFix lookup_dcookie syscall entries
Dmitry V. Levin [Sat, 10 Jan 2015 04:40:29 +0000 (07:40 +0300)]
Fix lookup_dcookie syscall entries

* linux/s390/syscallent.h (lookup_dcookie): Add syscall entry.
* linux/s390x/syscallent.h (lookup_dcookie): Likewise.
* linux/tile/syscallent.h (lookup_dcookie): Change nargs to 3.
* linux/x32/syscallent.h (lookup_dcookie): Likewise.

9 years agoaarch64: fix syscall names for statfs, fstatfs, truncate, and ftruncate
Dmitry V. Levin [Sat, 10 Jan 2015 04:22:50 +0000 (07:22 +0300)]
aarch64: fix syscall names for statfs, fstatfs, truncate, and ftruncate

* linux/aarch64/syscallent1.h (statfs, fstatfs, truncate, ftruncate):
Use correct syscall names.

9 years agoaarch64: fix mlock syscall entry
Dmitry V. Levin [Sat, 10 Jan 2015 03:53:45 +0000 (03:53 +0000)]
aarch64: fix mlock syscall entry

* linux/aarch64/syscallent1.h (mlock): Change to mlock entry.

9 years agosh, sh64: fix mlock syscall entry
Dmitry V. Levin [Sat, 10 Jan 2015 03:51:03 +0000 (03:51 +0000)]
sh, sh64: fix mlock syscall entry

* linux/sh/syscallent.h (mlock): Change nargs to 2.
* linux/sh64/syscallent.h (mlock): Likewise.

9 years agotile: fix swapon syscall entries
Dmitry V. Levin [Sat, 10 Jan 2015 03:48:15 +0000 (03:48 +0000)]
tile: fix swapon syscall entries

* linux/tile/syscallent.h (swapon): Change nargs to 2.
* linux/tile/syscallent1.h (swapon): Likewise.

9 years agoARM EABI: reserve some space for new syscalls
Dmitry V. Levin [Sun, 11 Jan 2015 17:35:37 +0000 (17:35 +0000)]
ARM EABI: reserve some space for new syscalls

Reserve the same space for new syscalls on EABI as it is already
reserved on OABI.

* linux/arm/syscallent.h [__ARM_EABI__] (ARM_FIRST_SHUFFLED_SYSCALL):
Raise to 400.

9 years agoarm: rewrite shuffle_scno in a bit more readable way
Dmitry V. Levin [Sun, 11 Jan 2015 17:26:29 +0000 (17:26 +0000)]
arm: rewrite shuffle_scno in a bit more readable way

* linux/arm/syscallent.h: Define ARM_FIRST_SHUFFLED_SYSCALL instead of
ARM_LAST_ORDINARY_SYSCALL.
* syscall.c [ARM || AARCH64] (shuffle_scno): Update.

9 years agotests: add tests for ipc syscalls decoding
Dmitry V. Levin [Mon, 12 Jan 2015 16:08:59 +0000 (16:08 +0000)]
tests: add tests for ipc syscalls decoding

* tests/ipc_msg.c: New file.
* tests/ipc_sem.c: Likewise.
* tests/ipc_shm.c: Likewise.
* tests/ipc_msg.test: New test.
* tests/ipc_sem.test: Likewise.
* tests/ipc_shm.test: Likewise.
* tests/Makefile.am (check_PROGRAMS): Add ipc_msg, ipc_sem, and ipc_shm.
(TESTS): Add ipc_msg.test, ipc_sem.test, and ipc_shm.test.
* tests/.gitignore: Add ipc_msg, ipc_sem, and ipc_shm.

9 years agoFix indirect ipc subcall handling
Dmitry V. Levin [Sat, 10 Jan 2015 19:01:35 +0000 (22:01 +0300)]
Fix indirect ipc subcall handling

indirect_ipccall used to guess whether currently decoded ipc syscall is
an indirect subcall or not based on generic knowledge, while there is a
robust method to identify indirect ipc subcalls.

* defs.h (TRACE_INDIRECT_SUBCALL): New flag.
* ipc.c (indirect_ipccall): Check it.
* linux/subcall.h: Set it.

9 years agoMove socket and ipc subcall entries to subcall.h
Dmitry V. Levin [Sun, 11 Jan 2015 13:56:40 +0000 (13:56 +0000)]
Move socket and ipc subcall entries to subcall.h

Syscall entries for socket and ipc subcalls are the same on all
architectures, or at least they should be the same, so move them
to the single file.

* linux/subcall.h: Add syscall entries for socket and ipc subcalls.
* linux/arm/syscallent.h: Remove entries for socket and ipc subcalls.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/powerpc/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.

9 years agosh: fix typo introduced by commit v4.9-121-gd535b8b
Dmitry V. Levin [Sat, 10 Jan 2015 00:40:10 +0000 (00:40 +0000)]
sh: fix typo introduced by commit v4.9-121-gd535b8b

* linux/sh/syscallent.h (getresgid32): Fix typo in sys_func and sys_name.

9 years agoFix fanotify_mark decoding on 32-bit architectures
Dmitry V. Levin [Sat, 10 Jan 2015 00:08:58 +0000 (00:08 +0000)]
Fix fanotify_mark decoding on 32-bit architectures

The fanotify_mark syscall takes a 64-bit mask, and on 32-bit
architectures it is split up into two syscall arguments.

* configure.ac (AC_CHECK_FUNCS): Add fanotify_mark.
(AC_CHECK_HEADERS): Add sys/fanotify.h.
* defs.h (getllval): New prototype.
* util.c (getllval): New function based on printllval.
(printllval): Use getllval.
* fanotify.c (sys_fanotify_mark): Use getllval to properly decode
64-bit mask and two syscall arguments followed by it.
* tests/fanotify_mark.c: New file.
* tests/fanotify_mark.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add fanotify_mark.
(TESTS): Add fanotify_mark.test.
* tests/.gitignore: Add fanotify_mark.

9 years agov4l2: fix build on systems with older kernel headers
Dmitry V. Levin [Fri, 9 Jan 2015 04:53:19 +0000 (04:53 +0000)]
v4l2: fix build on systems with older kernel headers

* v4l2.c (print_v4l2_format_fmt): Do not use
V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY unless it is defined.
(v4l2_ioctl): Do not use VIDIOC_ENUM_FRAMESIZES and
VIDIOC_ENUM_FRAMEINTERVALS unless they are defined.

9 years agotests: fix build with awk that does not support switch-case
Dmitry V. Levin [Fri, 9 Jan 2015 04:10:54 +0000 (04:10 +0000)]
tests: fix build with awk that does not support switch-case

The switch-case statement is a gawk-specific feature which is not
necessarily available, let's use traditional if-else statements instead.

* tests/uid.awk: Rewrite without switch-case statements.

9 years agoFix build on systems that lack O_CLOEXEC definition
Dmitry V. Levin [Fri, 9 Jan 2015 03:47:23 +0000 (03:47 +0000)]
Fix build on systems that lack O_CLOEXEC definition

* xlat/timerfdflags.in [!TFD_CLOEXEC]: Check that O_CLOEXEC is defined.

9 years agoFix build on systems that lack NETLINK_SOCK_DIAG definition
Dmitry V. Levin [Fri, 9 Jan 2015 03:03:39 +0000 (03:03 +0000)]
Fix build on systems that lack NETLINK_SOCK_DIAG definition

NETLINK_INET_DIAG was introduced in linux v2.6.14,
NETLINK_SOCK_DIAG was added much later in linux v3.3.

* net.c [!NETLINK_SOCK_DIAG && NETLINK_INET_DIAG]
(NETLINK_SOCK_DIAG): Define.
* socketutils.c: Likewise.
* tests/netlink_unix_diag.c: Likewise.

9 years agoCleanup local copy of linux/fanotify.h
Dmitry V. Levin [Fri, 9 Jan 2015 02:18:03 +0000 (02:18 +0000)]
Cleanup local copy of linux/fanotify.h

* linux/fanotify.h: Remove macros and structures not used by
fanotify_init and fanotify_mark parsers.

9 years agoFix "make dist" regression introduced by commit v4.9-125-g120e5db
Dmitry V. Levin [Fri, 9 Jan 2015 02:02:39 +0000 (02:02 +0000)]
Fix "make dist" regression introduced by commit v4.9-125-g120e5db

* Makefile.am (EXTRA_DIST): Add linux/unix_diag.h.

9 years agotests: fix build with fresh glibc
Dmitry V. Levin [Thu, 8 Jan 2015 22:29:12 +0000 (22:29 +0000)]
tests: fix build with fresh glibc

* tests/netlink_unix_diag.c: Include <stdint.h>.

9 years agoioctlent.sh: handle linux/aufs_type.h properly
Dmitry V. Levin [Thu, 8 Jan 2015 19:11:05 +0000 (19:11 +0000)]
ioctlent.sh: handle linux/aufs_type.h properly

Before this change, ioctlent.sh could not recognize unusual constants
defined by linux/aufs_type.h, resulting to ioctls.h with references to
these constants without appropriate definitions in ioctldefs.h.

* linux/ioctlent.sh: Update the regexp that is used to lookup constants
referenced by generated ioctls.h.

9 years agotests: fix distcheck
Dmitry V. Levin [Thu, 8 Jan 2015 18:46:30 +0000 (18:46 +0000)]
tests: fix distcheck

* tests/stat32-v.test: Remove work files if the test is skipped.

9 years agoFix printing of time_t values set in the distant future
Dmitry V. Levin [Thu, 8 Jan 2015 15:08:16 +0000 (15:08 +0000)]
Fix printing of time_t values set in the distant future

* util.c (sprinttime): Increase buffer size.
* tests/stat64-v.test: Try to set modification time of the sample file
to a value set in the distant future.

9 years agoUse AC_CHECK_TYPES to check for struct statfs64
Dmitry V. Levin [Thu, 8 Jan 2015 04:12:29 +0000 (04:12 +0000)]
Use AC_CHECK_TYPES to check for struct statfs64

* m4/statfs.m4: Remove.
* configure.ac (AC_STATFS64): Remove.
(AC_CHECK_TYPES): Add struct statfs64.
* statfs.c: Replace HAVE_STATFS64 with HAVE_STRUCT_STATFS64.

9 years agoUse AC_CHECK_TYPES to check for struct stat64
Dmitry V. Levin [Thu, 8 Jan 2015 04:06:06 +0000 (04:06 +0000)]
Use AC_CHECK_TYPES to check for struct stat64

* m4/stat.m4: Remove.
* configure.ac (AC_STAT64): Remove.
(AC_CHECK_TYPES): Add struct stat64.
* file.c: Replace HAVE_STAT64 with HAVE_STRUCT_STAT64.

9 years agofile.c: fix 32-bit stat decoding on 64-bit architectures
Dmitry V. Levin [Tue, 30 Dec 2014 11:18:47 +0000 (11:18 +0000)]
file.c: fix 32-bit stat decoding on 64-bit architectures

* file.c [SPARC || SPARC64] (struct stat): Remove, use generic
definition from <asm/stat.h>.
[SPARC64] (struct stat_sparc64, printstat_sparc64): Remove.
[AARCH64 || X86_64 || X32 || POWERPC64 || SPARC64] (struct stat32,
STAT32_PERSONALITY): Define.
[STAT32_PERSONALITY] (struct stat_powerpc32): Rename to struct stat32.
[STAT32_PERSONALITY] (printstat_powerpc32): Rename to printstat32.
(printstat) [STAT32_PERSONALITY]: Call printstat32 when
current_personality == STAT32_PERSONALITY.
[HAVE_STAT64] (printstat64) [STAT32_PERSONALITY]: Call printstat when
current_personality != STAT32_PERSONALITY.
[!HAVE_STAT64] (sys_stat64): Fallback to sys_stat.
[!HAVE_STAT64] (sys_fstat64): Fallback to sys_fstat.

9 years agosparc: reuse struct stat parser code for struct solstat decoding
Dmitry V. Levin [Thu, 8 Jan 2015 03:13:59 +0000 (03:13 +0000)]
sparc: reuse struct stat parser code for struct solstat decoding

* printstat.h: Parametrize major() and minor().
* file.c [SPARC || SPARC64]: Define do_printstat_sol by instantiating
printstat.h template.
[SPARC || SPARC64] (printstatsol): Use do_printstat_sol.

9 years agoppc64: reuse struct stat parser code for struct stat_powerpc32 decoding
Dmitry V. Levin [Thu, 8 Jan 2015 02:59:04 +0000 (02:59 +0000)]
ppc64: reuse struct stat parser code for struct stat_powerpc32 decoding

* file.c [POWERPC64]: Define do_printstat32 by instantiating printstat.h
template.
[POWERPC64] (printstat_powerpc32): Use do_printstat32.

9 years agofile.c: group related parsers together
Dmitry V. Levin [Thu, 8 Jan 2015 01:14:53 +0000 (01:14 +0000)]
file.c: group related parsers together

* file.c (sys_stat, sys_fstat): Collect in one place right before
the definition of printstat64.
(sys_stat64, sys_fstat64): Collect in one place right after the
definition of printstat64.

9 years agofile.c: collect scattered __old_kernel_stat related code
Dmitry V. Levin [Sun, 28 Dec 2014 19:10:58 +0000 (19:10 +0000)]
file.c: collect scattered __old_kernel_stat related code

* file.c [HAVE_STRUCT___OLD_KERNEL_STAT] (convertoldstat, printoldstat,
sys_oldstat, sys_oldfstat): Collect functions in one place.

9 years agoUse the same source code for struct stat/stat64 decoding
Dmitry V. Levin [Sun, 28 Dec 2014 18:56:23 +0000 (18:56 +0000)]
Use the same source code for struct stat/stat64 decoding

* file.c: Define do_printstat64 by instantiating printstat.h template.
(printstat64): Use do_printstat64.

9 years agox32: use generic printstat/printstat64 parsers
Dmitry V. Levin [Sun, 28 Dec 2014 18:41:20 +0000 (21:41 +0300)]
x32: use generic printstat/printstat64 parsers

* file.c (printstat) [X32]: Define.
(printstat64) [X32]: Use "struct stat64" instead of "struct stat".
Use printstat for x32 personality processes.
(printstat64_x32): Remove.
(sys_stat64, sys_fstat64) [X32]: Use printstat64 instead of
printstat64_x32.

9 years agox32: remove redundant definitions
Dmitry V. Levin [Sun, 28 Dec 2014 16:41:24 +0000 (16:41 +0000)]
x32: remove redundant definitions

* file.c [X32]: Do not define "struct stat" and "struct
__old_kernel_stat" locally, use definitions provided by <asm/stat.h>.
Do not define "struct stat64" exclusively, reuse another definition
added earlier for X86_64.

9 years agoConvert do_printstat to a template function
Dmitry V. Levin [Sun, 28 Dec 2014 18:15:25 +0000 (18:15 +0000)]
Convert do_printstat to a template function

* printstat.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Include "printstat.h".
(do_printstat): Move to printstat.h, parametrize its name
and struct stat.

9 years agofile.c: prepare realprintstat for parametrization
Dmitry V. Levin [Sun, 28 Dec 2014 18:00:39 +0000 (18:00 +0000)]
file.c: prepare realprintstat for parametrization

* file.c (realprintstat): Adjust format strings so that all 64-bit
integer fields are printed with %llu format, and %u format is used for
all the rest.  Rename to do_printstat.
(printstat, printoldstat): Update callers.

9 years agotests: cleanup stat.test
Dmitry V. Levin [Thu, 8 Jan 2015 00:32:35 +0000 (00:32 +0000)]
tests: cleanup stat.test

* tests/stat.test: Rewrite in a more readable way.

9 years agotests: check verbose decoding of 32-bit and 64-bit struct stat
Dmitry V. Levin [Wed, 7 Jan 2015 19:30:37 +0000 (19:30 +0000)]
tests: check verbose decoding of 32-bit and 64-bit struct stat

* tests/stat.c: New file.
* tests/stat32.c: Likewise.
* tests/stat32-v.test: New file.
* tests/stat64-v.test: Likewise.
* tests/Makefile.am (check_PROGRAMS): Add stat and stat32.
(stat_CFLAGS): Define.
(TESTS): Add stat32-v.test and stat64-v.test.
* tests/.gitignore: Add stat and stat32.

9 years agoCleanup struct stat.st_flags decoding
Dmitry V. Levin [Sun, 28 Dec 2014 17:44:13 +0000 (17:44 +0000)]
Cleanup struct stat.st_flags decoding

There are no symbolic constants defined for struct stat.st_flags,
so decode this rare field as unsigned int.

* xlat/fileflags.in: Remove.
* file.c (realprintstat, printstat64) [HAVE_STRUCT_STAT_ST_FLAGS]:
Decode struct stat.st_flags as unsigned int.

9 years agoDrop struct stat.st_aclcnt and stat.st_level support
Dmitry V. Levin [Sun, 28 Dec 2014 17:27:33 +0000 (17:27 +0000)]
Drop struct stat.st_aclcnt and stat.st_level support

Remove the code that supports struct stat.st_aclcnt and stat.st_level
decoding -- these fields are not defined in system headers.

* configure.ac (AC_CHECK_MEMBERS): Remove struct stat.st_aclcnt and
struct stat.st_level.
* file.c (realprintstat, printstat64)
[HAVE_STRUCT_STAT_ST_ACLCNT || HAVE_STRUCT_STAT_ST_LEVEL]: Remove.

9 years agotests: fix race condition in net-accept-connect based tests
Dmitry V. Levin [Wed, 7 Jan 2015 20:14:19 +0000 (20:14 +0000)]
tests: fix race condition in net-accept-connect based tests

Change all net-accept-connect based tests to use different unix domain
socket addresses, so that these tests could be safely run in parallel.

* tests/net-accept-connect.c: Parametrize unix domain socket address.
* tests/net-fd.test: Pass socket address to net-accept-connect.
* tests/net.test: Likewise.
* tests/unix-yy.test: Likewise.
* tests/unix-yy-accept.awk: Update regexps.
* tests/unix-yy-connect.awk: Likewise.

9 years agotimerfd: update flags decoding
Mike Frysinger [Wed, 31 Dec 2014 00:08:50 +0000 (19:08 -0500)]
timerfd: update flags decoding

The current code only decodes TFD_TIMER_ABSTIME when the kernel has
a bunch of newer flags.  We have to handle fallbacks for all of them
since the kernel doesn't currently export things to userspace.

* time.c: Include fcntl.h for O_* defines.
(TFD_TIMER_ABSTIME): Move to xlat/timerfdflags.in.
* xlat/timerfdflags.in: Add more definitions.

9 years agosparc: fix fxstat decoding
Dmitry V. Levin [Mon, 29 Dec 2014 03:15:42 +0000 (03:15 +0000)]
sparc: fix fxstat decoding

* file.c [SPARC || SPARC64] (sys_fxstat): Print file descriptor
using printfd.

9 years agosparc: drop _STAT64_VER support
Dmitry V. Levin [Mon, 29 Dec 2014 03:08:53 +0000 (03:08 +0000)]
sparc: drop _STAT64_VER support

Starting with commit v4.6-240-g5afdf12, nobody compiles this
non-Linux code.

* file.c [SPARC || SPARC64] (sys_xstat, sys_fxstat): Remove
_STAT64_VER code.

9 years agosparc: remove redundant sys_lxstat
Dmitry V. Levin [Mon, 29 Dec 2014 03:04:11 +0000 (03:04 +0000)]
sparc: remove redundant sys_lxstat

* file.c [SPARC || SPARC64] (sys_lxstat): Remove.
* linux/sparc/dummy2.h (solaris_lxstat): Alias to sys_xstat.
* linux/sparc64/dummy2.h (solaris_lxstat): Likewise.

9 years agofile.c: do not include unused headers
Dmitry V. Levin [Sun, 28 Dec 2014 15:24:21 +0000 (15:24 +0000)]
file.c: do not include unused headers

* file.c: Do not include <fcntl.h>.

9 years agoCleanup UTIME_NOW/UTIME_OMIT decoding
Dmitry V. Levin [Fri, 26 Dec 2014 23:55:38 +0000 (23:55 +0000)]
Cleanup UTIME_NOW/UTIME_OMIT decoding

Move the code that's present in two copies from sprinttv()
to a new helper function.

* time.c (do_sprinttv): New function.
(sprinttv): Use it.

9 years agoFix UTIME_NOW/UTIME_OMIT decoding
Elliott Hughes [Tue, 23 Dec 2014 18:42:40 +0000 (10:42 -0800)]
Fix UTIME_NOW/UTIME_OMIT decoding

The kernel doesn't actually care what tv_sec is set to --- it only checks
tv_nsec when looking for the special values.

9 years agoMake -yy output for inet sockets consistent with unix domain sockets
Dmitry V. Levin [Fri, 26 Dec 2014 23:29:26 +0000 (23:29 +0000)]
Make -yy output for inet sockets consistent with unix domain sockets

Prepend -yy output generated for INET/INET6 TCP/UDP sockets with their
protocol name obtained using getxattr.

* socketutils.c (inet_parse_response): Add proto_name argument.
Print proto_name for connected and unconnected sockets.
(receive_responses): Add proto_name argument, pass it to the parser.
(inet_print): Add proto_name argument, pass it to receive_responses.
(unix_parse_response): Add proto_name argument.
(print_sockaddr_by_inode): Pass protocol name to inet_print calls.
* tests/net-yy-accept.awk: Update to match new output format.
* tests/net-yy-connect.awk: Likewise.

9 years agotests: robustify unix domain socket decoding test
Dmitry V. Levin [Thu, 25 Dec 2014 00:32:23 +0000 (00:32 +0000)]
tests: robustify unix domain socket decoding test

Unix domain socket address family name is not universally decoded as
AF_LOCAL, other names like AF_UNIX and AF_FILE are valid synonyms.
Similarly, PF_UNIX and PF_FILE are valid synonyms for PF_LOCAL.

Some test regexps have to be properly initialized before they could
be used, so make sure they are initialized before use.

9 years agotests: fix unix domain socket decoding availability test
Dmitry V. Levin [Thu, 25 Dec 2014 00:11:40 +0000 (00:11 +0000)]
tests: fix unix domain socket decoding availability test

Since inet_diag and unix_diag interfaces are implemented by different
kernel modules, they have to be tested separately.

* tests/netlink_unix_diag.c: New file.
* tests/unix-yy.test: Use it.
* tests/Makefile.am (check_PROGRAMS): Add it.
* tests/.gitignore: Likewise.