Update ADJ_* constants

* time.c (adjtimex_modes): Add ADJ_TAI, ADJ_SETOFFSET, ADJ_MICRO,
ADJ_NANO, ADJ_OFFSET_SS_READ.

Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
Decode dynamic posix clocks

* time.c (cpuclocknames): New xlat structure.
(printclockname): New function that decodes posix clock names,
including dynamic fd encoded clocks.
(sys_clock_settime, sys_clock_gettime, sys_clock_nanosleep,
sys_clock_adjtime, sys_timer_create, sys_timerfd, sys_timerfd_create):
Use it.

Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
Decode ptp ioctls

* defs.h (ptp_ioctl): New prototype.
* ioctl.c (ioctl_decode): Call ptp_ioctl when code is '='.
* Makefile.am (strace_SOURCES): Add ptp.c.
(EXTRA_DIST): Add linux/ptp_clock.h.
* ptp.c: New file.
* linux/ptp_clock.h: New file.

Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Introduce XLAT macro to ease maintenance of xlat structures

* defs.h (XLAT): New macro.

Suggested-by: Mike Frysinger <vapier@gentoo.org>
Use XLAT macro

Automatically convert all xlat structures to XLAT form
using the following sed regexp:
s/^[[:space:]]*{[[:space:]]*\([^",}[:space:]]\+\)[[:space:]]*,[[:space:]]*"\1",\?[[:space:]]*}[[:space:]]*/\tXLAT(\1)/
Convert sigev_value to XLAT form

* time.c (sigev_value): Convert to XLAT form.
(printsigevent32, printsigevent): Update use of sigev_value.
Convert futexops to XLAT form

* process.c: Define FUTEX_*_PRIVATE macros.
(futexops): Convert to XLAT form.
Convert personality_options to XLAT form

* linux/personality.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* system.c: Include <linux/personality.h>.
(personality_options): Update PER_* constants, convert to XLAT form.
Itroduce XLAT_END macro to make xlat structures more compact

* defs.h (XLAT_END): New macro.
Use XLAT_END macro

Automatically update all xlat structures using the following sed regexp:
s/^[[:space:]]*{[[:space:]]*0[[:space:]]*,[[:space:]]*NULL[[:space:]]*,\?[[:space:]]*}[[:space:]]*,\?[[:space:]]*/\tXLAT_END/
Implement fanotify_init and fanotify_mark decoding

* fanotify.c: New file.
* linux/fanotify.h: Likewise.
* Makefile.am (strace_SOURCES): Add fanotify.c.
(EXTRA_DIST): Add linux/fanotify.h.
* defs.h (print_dirfd): New prototype.
* file.c (print_dirfd): Export.
* linux/dummy.h (sys_fanotify_init, sys_fanotify_mark): Remove.
* linux/syscall.h (sys_fanotify_init, sys_fanotify_mark): New
prototypes.
* pathtrace.c (pathtrace_match): Handle sys_fanotify_init and
sys_fanotify_mark.
Use prepared editions of recently imported linux headers

* linux/fanotify.h: Replace with edition prepared with headers_install.sh.
* linux/personality.h: Likewise.
Implement kexec_load decoding

* kexec.c: New file.
* linux/kexec.h: Likewise.
* Makefile.am (strace_SOURCES): Add kexec.c.
(EXTRA_DIST): Add linux/kexec.h.
* linux/dummy.h (sys_kexec_load): Remove.
* linux/syscall.h (sys_kexec_load): New prototype.
Enhance reboot decoding

* linux/reboot.h: New file.
* system.c (bootflags1, bootflags2, bootflags3, sys_reboot): Move...
* reboot.c: ... here.
(bootflags2, bootflags3): Update constants.
* Makefile.am (strace_SOURCES): Add reboot.c.
(EXTRA_DIST): Add linux/reboot.h.
Cleanup inotify syscalls decoding

* linux/inotify.h: New file.
* file.c (inotify_modes, inotify_init_flags, sys_inotify_add_watch,
sys_inotify_rm_watch, sys_inotify_init1): Move...
* inotify.c: ... here.
(inotify_modes): Rename to inotify_flags, convert to XLAT form.
(inotify_init_flags): Convert to XLAT form.
* Makefile.am (strace_SOURCES): Add inotify.c.
(EXTRA_DIST): Add linux/inotify.h.
Implement finit_module decoding

* bjm.c (module_init_flags): New xlat structure.
(sys_finit_module): New function.
* linux/dummy.h (sys_finit_module): Remove.
* linux/syscall.h (sys_finit_module): New prototype.
Implement ioprio_get and ioprio_set decoding

* ioprio.c: New file.
* Makefile.am (strace_SOURCES): Add ioprio.c.
* linux/dummy.h (sys_ioprio_get, sys_ioprio_set): Remove.
* linux/syscall.h (sys_ioprio_get, sys_ioprio_set): New prototypes.
Implement add_key, keyctl, and request_key decoding

* keyctl.c: New file.
* linux/keyctl.h: Likewise.
* Makefile.am (strace_SOURCES): Add keyctl.c.
(EXTRA_DIST): Add linux/keyctl.h.
* linux/dummy.h (sys_add_key, sys_keyctl, sys_request_key): Remove.
* linux/syscall.h (sys_add_key, sys_keyctl, sys_request_key): New
prototypes.
Add support for Altera's Nios-II softcore architecture

This commit adds strace support for Altera's Nios-II official
kernel port as found in git://git.rocketboards.org/linux-socfpga.git

Notice that this an out-of-tree kernel architectural port, and uses the
legacy (non-generic) system call ABI. In particular, the port doesn't
support PTRACE_GETREGSET, so the implementation is based on PTRACE_GETREGS.

Given it's mandatory for new architectures to support the generic
syscall ABI and PTRACE_GETREGSET, if the nios2 architecure is ever
mainlined, the strace support will have to be re-factored accordingly.

* linux/nios2/ioctlent.h.in: New file.
* linux/nios2/syscallent.h: Likewise.
* Makefile.am (EXTRA_DIST): Add linux/nios2/ioctlent.h.in and
linux/nios2/syscallent.h.
* configure.ac: Add NIOS2 to the list of supported architectures.
* defs.h [NIOS2]: Use register reading system.
* process.c (struct_user_offsets): Add NIOS2 support.
* syscall.c (get_regs, get_scno, get_syscall_args,
get_syscall_result, get_error): Likewise.
* util.c (change_syscall): Likewise.
* mem.c (sys_getpagesize): Define on NIOS2.
* system.c [NIOS2] (sys_cacheflush, sys_nios2cmpxchg): New functions.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Acked-by: Mike Frysinger <vapier@gentoo.org>
kexec: fix typo

* kexec.c (print_kexec_segments) [SUPPORTED_PERSONALITIES == 1]: Fix typo.