2015-12-17 20:56:48 +03:00
# Configure template for strace.
#
# Copyright (c) 1999-2001 Wichert Akkerman <wichert@deephackmode.org>
# Copyright (c) 2002-2009 Roland McGrath <roland@redhat.com>
2016-01-12 03:02:56 +03:00
# Copyright (c) 2006-2016 Dmitry V. Levin <ldv@altlinux.org>
2015-12-17 20:56:48 +03:00
# Copyright (c) 2008-2015 Mike Frysinger <vapier@gentoo.org>
# Copyright (c) 2015 Elvira Khabirova <lineprinter0@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2002-12-30 03:51:30 +03:00
AC_PREREQ(2.57)
2013-05-01 03:52:12 +04:00
AC_INIT([strace],
m4_esyscmd([./git-version-gen .tarball-version]),
[strace-devel@lists.sourceforge.net])
2002-12-30 03:51:30 +03:00
AC_CONFIG_SRCDIR([strace.c])
2009-10-12 03:25:29 +04:00
AC_CONFIG_AUX_DIR([.])
2013-05-01 06:41:11 +04:00
AC_CONFIG_HEADERS([config.h])
2015-08-27 01:50:58 +03:00
AM_INIT_AUTOMAKE([foreign nostdinc dist-xz no-dist-gzip silent-rules parallel-tests])
2002-12-30 03:51:30 +03:00
AM_MAINTAINER_MODE
AC_CANONICAL_HOST
Add x32 support to strace
X32 support is added to Linux kernel 3.4. In a nutshell, x32 is x86-64 with
32bit pointers. At system call level, x32 is also identical to x86-64,
as shown by many changes like "defined(X86_64) || defined(X32)". The
main differerence bewteen x32 and x86-64 is off_t in x32 is long long
instead of long.
This patch adds x32 support to strace. Tested on Linux/x32.
* configure.ac: Support X32.
* defs.h: Set SUPPORTED_PERSONALITIES to 3 for X86_64,
Set PERSONALITY2_WORDSIZE to 4 for X86_64.
Add tcb::ext_arg for X32.
* file.c (stat): New for X32.
(sys_lseek): Use 64-bit version for X32.
(printstat64): Check current_personality != 1 for X86_64.
* ipc.c (indirect_ipccall): Check current_personality == 1
for X86_64.
* mem.c (sys_mmap64): Also use tcp->u_arg for X32. Print NULL
for zero address. Call printllval for offset for X32.
* pathtrace.c (pathtrace_match): Don't check sys_old_mmap for
X32.
* process.c (ARG_FLAGS): Defined for X32.
(ARG_STACK): Likewise.
(ARG_PTID): Likewise.
(change_syscall): Handle X32.
(struct_user_offsets): Support X32.
(sys_arch_prctl): Likewise.
* signal.c: Include <asm/sigcontext.h> for X32.
(SA_RESTORER): Also define for X32.
* syscall.c (update_personality): Support X32 for X86_64.
(is_restart_error): Likewise.
(syscall_fixup_on_sysenter): Likewise.
(get_syscall_args): Likewise.
(get_syscall_result): Likewise.
(get_error): Likewise.
(__X32_SYSCALL_BIT): Define if not defined.
(__X32_SYSCALL_MASK): Likewise.
(get_scno): Check DS register value for X32. Use
__X32_SYSCALL_MASK on X32 system calls.
* util.c (printllval): Use ext_arg for X32.
(printcall): Support X32.
(change_syscall): Likewise.
(arg0_offset): Likewise.
(arg1_offset): Likewise.
* Makefile.am (EXTRA_DIST): Add linux/x32/errnoent.h,
linux/x32/ioctlent.h.in, linux/x32/signalent.h,
linux/x32/syscallent.h, linux/x86_64/errnoent2.h,
linux/x86_64/ioctlent2.h, linux/x86_64/signalent2.h and
linux/x86_64/syscallent2.h.
* linux/x32/errnoent.h: New.
* linux/x32/ioctlent.h.in: Likewise.
* linux/x32/signalent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/errnoent2.h: Likewise.
* linux/x86_64/ioctlent2.h: Likewise.
* linux/x86_64/signalent2.h: Likewise.
* linux/x86_64/syscallent2.h: Likewise.
Signed-off-by: H.J. Lu <hongjiu.lu@intel.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-04-16 15:00:01 +04:00
AC_PROG_CC
2016-01-13 00:27:36 +03:00
AC_PROG_CPP
2015-02-27 06:22:36 +03:00
AX_PROG_CC_FOR_BUILD
2016-01-13 00:27:36 +03:00
AC_PROG_INSTALL
Add mpers support
Add a subsystem for semi-automatical definition of how parsers should
work with personality-dependent (mpers) types of tracee's data. Create
auxiliary libraries containing mpers syscall parsers and printer
functions, one library for each possible nonnative target personality.
Currently some parsers do not handle differences in definitions of data
types between personalities, namely LP64 and ILP32. When
this is the case, long integers, pointers, and all compound
types containing long and pointer members may be printed incorrectly,
because of differences in sizes, offsets and alignments.
Since in most cases these are the only differences in desired behaviour
of parsers and printers for different personalities, a correct way
would be to compile one source code into multiple parsers, differing
only in definitions of mpers types.
To get a definition of a given type for nonnative personality
a very basic .c file containing a declaration of a variable of this type
is being compiled for this personality (using -m32 or -mx32 compiler
flag). Information about the type is then being extracted from
this binary's DWARF debug info with an awk script and put
into a corresponding header file. Resulting headers are being used to
compile mpers variations of syscall parsers and printer functions.
In addition to syscall parsers, there can occur a need to create mpers
printing functions, which then can be called from many places
in the code (for example, printsiginfo_at). Such functions (printers)
are marked in a special manner.
For each possible nonnative target personality a library is being
created, containing mpers variations of syscall parsers and printers.
Only syscall parsers from files marked in a special manner and specially
marked functions from such files are being recompiled and included
in these libraries.
generate_mpers_am.sh is called by bootstrap to find the files
from strace_SOURCES which include MPERS_DEFS. During compilation,
these files are being inspected for inclusions of DEF_MPERS_TYPE,
and nonnative variations of each included type are being generated
by an awk script.
Mpers parser names are being modified during inclusions of syscallent
headers for nonnative personalities. Pointers to printers are
being stored in structs struct_printers, and a master
pointer printers is being updated on every set_personality.
* README-mpers: New README explaining how to use mpers support.
* empty.h: New empty file.
* generate_mpers_am.sh: New file.
* mpers.awk: Likewise.
* mpers.sh: Likewise.
* mpers_test.sh: Likewise.
* mpers_type.h: Likewise.
* Makefile.am (strace_SOURCES): Add empty.h and mpers_type.h.
(strace_CPPFLAGS, strace_LDFLAGS, strace_LDADD): Move to the beginning
of the file.
(strace_LDADD, noinst_LIBRARIES): Add libmpers-%.a.
(EXTRA_DIST): Add mpers.awk, mpers.sh, mpers_test.sh.
(BUILT_SOURCES, CLEANFILES): Add new generated files:
native_printer_decls.h, native_printer_defs.h, printers.h,
[HAVE_M32_MPERS] $(mpers_m32_targets), and [HAVE_MX32_MPERS]
$(mpers_mx32_targets).
(mpers_NAME, mpers_PREFIX, mpers_DEFS, mpers_INCLUDES, mpers_CPPFLAGS,
mpers_sh_opts, libmpers_CPPFLAGS, libmpers_m[x]32_a_SOURCES,
libmpers_m[x]32_a_CPPFLAGS, mpers_m[x]32_targets): New variables.
(mpers-m[x]32.stamp, m[x]32_defs.h, m[x]32_funcs.h, printers.h,
%_printer_decls.h, %_printer_defs.h, clean-local,
native_printer_decls.h, native_printer_defs.h, $mpers_m[x]32_targets):
New targets.
* bootstrap: Add generate_mpers_am.sh.
* configure.ac: Add AC_PROG_RANLIB.
* m4/mpers.m4: Add HAVE_MPERS variable. Add $st_cv_mpers checks.
* defs.h: Include mpers_type.h.
Include printers.h, native_printer_decls.h, define MPERS_PRINTER_NAME.
Redefine SYS_FUNC_NAME. Define MPERS_PRINTER_DECL.
[HAVE_M32_MPERS]: define PERSONALITY1_INCLUDE_FUNCS,
PERSONALITY1_INCLUDE_PRINTERS_DECLS, PERSONALITY1_INCLUDE_PRINTERS_DEFS
for X86_64, X32.
[HAVE_MX32_MPERS]: define PERSONALITY2_INCLUDE_FUNCS,
PERSONALITY2_INCLUDE_PRINTERS_DECLS, PERSONALITY2_INCLUDE_PRINTERS_DEFS
for X86_64.
Add fallback definitions of
PERSONALITY1_INCLUDE_FUNCS, PERSONALITY2_INCLUDE_FUNCS,
PERSONALITY0_INCLUDE_PRINTERS_DECLS, PERSONALITY0_INCLUDE_PRINTERS_DEFS,
PERSONALITY1_INCLUDE_PRINTERS_DECLS, PERSONALITY1_INCLUDE_PRINTERS_DEFS,
PERSONALITY2_INCLUDE_PRINTERS_DECLS, PERSONALITY2_INCLUDE_PRINTERS_DEFS.
* syscall.c: Include PERSONALITY1_INCLUDE_FUNCS,
PERSONALITY2_INCLUDE_FUNCS,
PERSONALITY0_INCLUDE_PRINTERS_DECLS, PERSONALITY0_INCLUDE_PRINTERS_DEFS,
PERSONALITY1_INCLUDE_PRINTERS_DECLS, PERSONALITY1_INCLUDE_PRINTERS_DEFS,
PERSONALITY2_INCLUDE_PRINTERS_DECLS, PERSONALITY2_INCLUDE_PRINTERS_DEFS.
(printers): New struct. Update it when needed.
* .gitignore: Add libmpers-m32.a, libmpers-mx32.a, m32_defs.h,
m32_funcs.h, m32_printer_decls.h, m32_printer_defs.h, mpers-m32,
mpers-m32.stamp, mpers-mx32, mpers-mx32.stamp, mpers.am, mx32_defs.h,
mx32_funcs.h, mx32_printer_decls.h, mx32_printer_defs.h,
native_printer_decls.h, native_printer_defs.h, and printers.h.
2015-08-04 01:47:02 +03:00
AC_PROG_RANLIB
Add x32 support to strace
X32 support is added to Linux kernel 3.4. In a nutshell, x32 is x86-64 with
32bit pointers. At system call level, x32 is also identical to x86-64,
as shown by many changes like "defined(X86_64) || defined(X32)". The
main differerence bewteen x32 and x86-64 is off_t in x32 is long long
instead of long.
This patch adds x32 support to strace. Tested on Linux/x32.
* configure.ac: Support X32.
* defs.h: Set SUPPORTED_PERSONALITIES to 3 for X86_64,
Set PERSONALITY2_WORDSIZE to 4 for X86_64.
Add tcb::ext_arg for X32.
* file.c (stat): New for X32.
(sys_lseek): Use 64-bit version for X32.
(printstat64): Check current_personality != 1 for X86_64.
* ipc.c (indirect_ipccall): Check current_personality == 1
for X86_64.
* mem.c (sys_mmap64): Also use tcp->u_arg for X32. Print NULL
for zero address. Call printllval for offset for X32.
* pathtrace.c (pathtrace_match): Don't check sys_old_mmap for
X32.
* process.c (ARG_FLAGS): Defined for X32.
(ARG_STACK): Likewise.
(ARG_PTID): Likewise.
(change_syscall): Handle X32.
(struct_user_offsets): Support X32.
(sys_arch_prctl): Likewise.
* signal.c: Include <asm/sigcontext.h> for X32.
(SA_RESTORER): Also define for X32.
* syscall.c (update_personality): Support X32 for X86_64.
(is_restart_error): Likewise.
(syscall_fixup_on_sysenter): Likewise.
(get_syscall_args): Likewise.
(get_syscall_result): Likewise.
(get_error): Likewise.
(__X32_SYSCALL_BIT): Define if not defined.
(__X32_SYSCALL_MASK): Likewise.
(get_scno): Check DS register value for X32. Use
__X32_SYSCALL_MASK on X32 system calls.
* util.c (printllval): Use ext_arg for X32.
(printcall): Support X32.
(change_syscall): Likewise.
(arg0_offset): Likewise.
(arg1_offset): Likewise.
* Makefile.am (EXTRA_DIST): Add linux/x32/errnoent.h,
linux/x32/ioctlent.h.in, linux/x32/signalent.h,
linux/x32/syscallent.h, linux/x86_64/errnoent2.h,
linux/x86_64/ioctlent2.h, linux/x86_64/signalent2.h and
linux/x86_64/syscallent2.h.
* linux/x32/errnoent.h: New.
* linux/x32/ioctlent.h.in: Likewise.
* linux/x32/signalent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/errnoent2.h: Likewise.
* linux/x86_64/ioctlent2.h: Likewise.
* linux/x86_64/signalent2.h: Likewise.
* linux/x86_64/syscallent2.h: Likewise.
Signed-off-by: H.J. Lu <hongjiu.lu@intel.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-04-16 15:00:01 +04:00
2016-01-13 00:27:36 +03:00
AC_USE_SYSTEM_EXTENSIONS
2016-02-01 20:15:39 +03:00
AX_CODE_COVERAGE
2016-01-13 00:27:36 +03:00
2002-12-30 03:51:30 +03:00
AC_MSG_CHECKING([for supported architecture])
2015-12-08 03:13:38 +03:00
arch_m32=
arch_mx32=
2002-12-30 03:51:30 +03:00
case "$host_cpu" in
2008-11-11 01:21:41 +03:00
bfin)
arch=bfin
AC_DEFINE([BFIN], 1, [Define for the Blackfin architecture.])
;;
2002-12-30 03:51:30 +03:00
i[[3456]]86|pentium)
arch=i386
AC_DEFINE([I386], 1, [Define for the i386 architecture.])
;;
ia64)
arch=ia64
AC_DEFINE([IA64], 1, [Define for the IA64 architecture.])
;;
m68k)
arch=m68k
AC_DEFINE([M68K], 1, [Define for the m68k architecture.])
;;
2004-07-07 David S. Miller <davem@nuts.davemloft.net>
* linux/sparc/syscallent.h: Sync with reality.
* linux/sparc/syscall.h (sys_sendfile64, sys_futex, sys_gettid,
sys_sched_setaffinity, sys_sched_getaffinity, sys_setxattr,
sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr,
sys_fgetxattr, sys_listxattr, sys_llistxattr, sys_flistxattr,
sys_removexattr, sys_lremovexattr, sys_fremovexattr,
sys_remap_file_pages, sys_readahead, sys_tgkill, sys_statfs64,
sys_fstatfs64, sys_clock_settime, sys_clock_gettime,
sys_clock_getres, sys_clock_nanosleep, sys_timer_create,
sys_timer_settime, sys_timer_gettime): New declarations.
* linux/sparc64/dummy2.h, linux/sparc64/syscallent2.h,
linux/sparc64/syscall.h, linux/sparc64/errnoent.h,
linux/sparc64/errnoent1.h, linux/sparc64/errnoent2.h,
linux/sparc64/ioctlent.h, linux/sparc64/ioctlent1.h,
linux/sparc64/ioctlent2.h, linux/sparc64/signalent.h,
linux/sparc64/signalent.h, linux/sparc64/signalent.h,
linux/sparc64/signalent1.h, linux/sparc64/signalent2.h,
linux/sparc64/syscall1.h, linux/sparc64/syscallent.h,
linux/sparc64/syscallent1.h: New files.
* defs.h (LINUXSPARC): Define also when SPARC64.
(LINUX && SPARC64): Set SUPPORTED_PERSONALITIES to 3.
Ignore SIGTRAP after execve by defining TCB_WAITEXECVE.
Define possibly missing __NR_exit_group. Declare getrval2.
* configure.ac (sparc64): New architecture case.
* config.h.in (SPARC64): New define.
* file.c (stat_sparc64): New structure.
(printstat_sparc64): New output routine for that.
(printstat): Call it, if personality is 2.
(printstat64): Likewise.
* util.c: Conditionalize ptrace defines on LINUXSPARC
not LINUX && SPARC.
(SPARC64 && LINUX): Define r_pc to r_tpc, and PTRACE_FOOREGS
to PTRACE_FOOREGS64 so that more sparc code can be shared
between 64-bit and 32-bit.
(_hack_syscall5): Correct trap number when SPARC64.
(PTRACE_WRITE{TEXT,DATA}): Add SPARC64 to ifdef guard.
(getpc): Handle SPARC64 && LINUX.
(printcall): Likewise.
(arg fetching/setting): Use same code for SPARC64 LINUX
as for SPARC.
(setbpt): Handle SPARC64 && LINUX.
(clearbpt): Likewise.
* signal.c: Conditionalize ptrace defines on SPARC and
SPARC64.
(SPARC64 && LINUX): Define r_pc to r_tpc, and PTRACE_FOOREGS
to PTRACE_FOOREGS64 so that more sparc code can be shared
between 64-bit and 32-bit.
(m_siginfo): Use same definition on SPARC64 as SPARC.
(sys_sigreturn): Handle LINUX && SPARC64.
* syscall.c: Conditionalize ptrace defines on SPARC and
SPARC64.
(SPARC64 && LINUX): Define r_pc to r_tpc, and PTRACE_FOOREGS
to PTRACE_FOOREGS64 so that more sparc code can be shared
between 64-bit and 32-bit.
(getscno): Use same static state on SPARC64 as SPARC,
and add SPARC64 handling.
(get_error): Handle LINUX && SPARC64.
(force_result): Likewise.
(syscall_enter): Likewise.
(trace_syscall): Handle sys_socketcall and sys_ipc on SPARC64
just like SPARC.
(getrval2): Handle LINUX && SPARC64.
* process.c: Conditionalize ptrace defines on SPARC and
SPARC64.
(SPARC64 && LINUX): Define r_pc to r_tpc, and PTRACE_FOOREGS
to PTRACE_FOOREGS64 so that more sparc code can be shared
between 64-bit and 32-bit.
(change_syscall): Handle LINUX && SPARC64.
(struct_user_offsets): Ifdef out those which do not exist
on SPARC64.
* net.c (sys_pipe): Handle LINUX && SPARC64.
* ioctl.c: Fix initializer typo for nioctlents2, was
nioctlents1 by accident.
2004-07-12 11:44:08 +04:00
sparc64*)
arch=sparc64
2015-12-08 03:13:38 +03:00
arch_m32=sparc
2004-07-07 David S. Miller <davem@nuts.davemloft.net>
* linux/sparc/syscallent.h: Sync with reality.
* linux/sparc/syscall.h (sys_sendfile64, sys_futex, sys_gettid,
sys_sched_setaffinity, sys_sched_getaffinity, sys_setxattr,
sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr,
sys_fgetxattr, sys_listxattr, sys_llistxattr, sys_flistxattr,
sys_removexattr, sys_lremovexattr, sys_fremovexattr,
sys_remap_file_pages, sys_readahead, sys_tgkill, sys_statfs64,
sys_fstatfs64, sys_clock_settime, sys_clock_gettime,
sys_clock_getres, sys_clock_nanosleep, sys_timer_create,
sys_timer_settime, sys_timer_gettime): New declarations.
* linux/sparc64/dummy2.h, linux/sparc64/syscallent2.h,
linux/sparc64/syscall.h, linux/sparc64/errnoent.h,
linux/sparc64/errnoent1.h, linux/sparc64/errnoent2.h,
linux/sparc64/ioctlent.h, linux/sparc64/ioctlent1.h,
linux/sparc64/ioctlent2.h, linux/sparc64/signalent.h,
linux/sparc64/signalent.h, linux/sparc64/signalent.h,
linux/sparc64/signalent1.h, linux/sparc64/signalent2.h,
linux/sparc64/syscall1.h, linux/sparc64/syscallent.h,
linux/sparc64/syscallent1.h: New files.
* defs.h (LINUXSPARC): Define also when SPARC64.
(LINUX && SPARC64): Set SUPPORTED_PERSONALITIES to 3.
Ignore SIGTRAP after execve by defining TCB_WAITEXECVE.
Define possibly missing __NR_exit_group. Declare getrval2.
* configure.ac (sparc64): New architecture case.
* config.h.in (SPARC64): New define.
* file.c (stat_sparc64): New structure.
(printstat_sparc64): New output routine for that.
(printstat): Call it, if personality is 2.
(printstat64): Likewise.
* util.c: Conditionalize ptrace defines on LINUXSPARC
not LINUX && SPARC.
(SPARC64 && LINUX): Define r_pc to r_tpc, and PTRACE_FOOREGS
to PTRACE_FOOREGS64 so that more sparc code can be shared
between 64-bit and 32-bit.
(_hack_syscall5): Correct trap number when SPARC64.
(PTRACE_WRITE{TEXT,DATA}): Add SPARC64 to ifdef guard.
(getpc): Handle SPARC64 && LINUX.
(printcall): Likewise.
(arg fetching/setting): Use same code for SPARC64 LINUX
as for SPARC.
(setbpt): Handle SPARC64 && LINUX.
(clearbpt): Likewise.
* signal.c: Conditionalize ptrace defines on SPARC and
SPARC64.
(SPARC64 && LINUX): Define r_pc to r_tpc, and PTRACE_FOOREGS
to PTRACE_FOOREGS64 so that more sparc code can be shared
between 64-bit and 32-bit.
(m_siginfo): Use same definition on SPARC64 as SPARC.
(sys_sigreturn): Handle LINUX && SPARC64.
* syscall.c: Conditionalize ptrace defines on SPARC and
SPARC64.
(SPARC64 && LINUX): Define r_pc to r_tpc, and PTRACE_FOOREGS
to PTRACE_FOOREGS64 so that more sparc code can be shared
between 64-bit and 32-bit.
(getscno): Use same static state on SPARC64 as SPARC,
and add SPARC64 handling.
(get_error): Handle LINUX && SPARC64.
(force_result): Likewise.
(syscall_enter): Likewise.
(trace_syscall): Handle sys_socketcall and sys_ipc on SPARC64
just like SPARC.
(getrval2): Handle LINUX && SPARC64.
* process.c: Conditionalize ptrace defines on SPARC and
SPARC64.
(SPARC64 && LINUX): Define r_pc to r_tpc, and PTRACE_FOOREGS
to PTRACE_FOOREGS64 so that more sparc code can be shared
between 64-bit and 32-bit.
(change_syscall): Handle LINUX && SPARC64.
(struct_user_offsets): Ifdef out those which do not exist
on SPARC64.
* net.c (sys_pipe): Handle LINUX && SPARC64.
* ioctl.c: Fix initializer typo for nioctlents2, was
nioctlents1 by accident.
2004-07-12 11:44:08 +04:00
AC_DEFINE([SPARC64], 1, [Define for the SPARC64 architecture.])
;;
2002-12-30 03:51:30 +03:00
sparc*)
arch=sparc
AC_DEFINE([SPARC], 1, [Define for the SPARC architecture.])
;;
2013-02-22 18:44:10 +04:00
metag*)
arch=metag
AC_DEFINE([METAG], 1, [Define for the Meta architecture.])
;;
2002-12-30 03:51:30 +03:00
mips*)
arch=mips
AC_DEFINE([MIPS], 1, [Define for the MIPS architecture.])
;;
alpha*)
arch=alpha
AC_DEFINE([ALPHA], 1, [Define for the Alpha architecture.])
;;
2003-01-14 12:59:00 +03:00
powerpc*)
2002-12-30 03:51:30 +03:00
AC_DEFINE([POWERPC], 1, [Define for the PowerPC architecture.])
2013-07-11 06:03:57 +04:00
AC_TRY_COMPILE(
[#ifndef __LP64__
# error 32 bit
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.
2015-01-21 20:04:31 +03:00
#endif], [], arch=powerpc64, arch=powerpc)
if test "$arch" = "powerpc64"; then
2015-12-08 03:13:38 +03:00
arch_m32=powerpc
2010-07-12 23:39:57 +04:00
AC_DEFINE([POWERPC64], 1, [Define for the PowerPC64 architecture.])
fi
2002-12-30 03:51:30 +03:00
;;
arm*)
arch=arm
AC_DEFINE([ARM], 1, [Define for the ARM architecture.])
;;
2012-10-24 20:58:16 +04:00
aarch64*)
arch=aarch64
2015-12-08 03:13:38 +03:00
arch_m32=arm
2012-10-24 20:58:16 +04:00
AC_DEFINE([AARCH64], 1, [Define for the AArch64 architecture.])
;;
2009-02-27 23:32:52 +03:00
avr32*)
arch=avr32
AC_DEFINE([AVR32], 1, [Define for the AVR32 architecture.])
;;
2013-08-16 11:17:06 +04:00
arc*)
arch=arc
AC_DEFINE([ARC], 1, [Define for the ARC architecture.])
;;
2002-12-30 03:51:30 +03:00
s390)
arch=s390
AC_DEFINE([S390], 1, [Define for the S390 architecture.])
;;
s390x)
arch=s390x
AC_DEFINE([S390X], 1, [Define for the S390x architecture.])
;;
hppa*|parisc*)
arch=hppa
AC_DEFINE([HPPA], 1, [Define for the HPPA architecture.])
;;
2007-11-02 00:32:49 +03:00
sh64*)
2003-06-27 02:40:42 +04:00
arch=sh64
AC_DEFINE([SH64], 1, [Define for the SH64 architecture.])
2003-06-02 23:18:58 +04:00
;;
2007-11-02 00:32:49 +03:00
sh*)
arch=sh
AC_DEFINE([SH], 1, [Define for the SH architecture.])
;;
2002-12-30 03:51:30 +03:00
x86?64*)
2015-12-08 03:13:38 +03:00
arch_m32=i386
Add x32 support to strace
X32 support is added to Linux kernel 3.4. In a nutshell, x32 is x86-64 with
32bit pointers. At system call level, x32 is also identical to x86-64,
as shown by many changes like "defined(X86_64) || defined(X32)". The
main differerence bewteen x32 and x86-64 is off_t in x32 is long long
instead of long.
This patch adds x32 support to strace. Tested on Linux/x32.
* configure.ac: Support X32.
* defs.h: Set SUPPORTED_PERSONALITIES to 3 for X86_64,
Set PERSONALITY2_WORDSIZE to 4 for X86_64.
Add tcb::ext_arg for X32.
* file.c (stat): New for X32.
(sys_lseek): Use 64-bit version for X32.
(printstat64): Check current_personality != 1 for X86_64.
* ipc.c (indirect_ipccall): Check current_personality == 1
for X86_64.
* mem.c (sys_mmap64): Also use tcp->u_arg for X32. Print NULL
for zero address. Call printllval for offset for X32.
* pathtrace.c (pathtrace_match): Don't check sys_old_mmap for
X32.
* process.c (ARG_FLAGS): Defined for X32.
(ARG_STACK): Likewise.
(ARG_PTID): Likewise.
(change_syscall): Handle X32.
(struct_user_offsets): Support X32.
(sys_arch_prctl): Likewise.
* signal.c: Include <asm/sigcontext.h> for X32.
(SA_RESTORER): Also define for X32.
* syscall.c (update_personality): Support X32 for X86_64.
(is_restart_error): Likewise.
(syscall_fixup_on_sysenter): Likewise.
(get_syscall_args): Likewise.
(get_syscall_result): Likewise.
(get_error): Likewise.
(__X32_SYSCALL_BIT): Define if not defined.
(__X32_SYSCALL_MASK): Likewise.
(get_scno): Check DS register value for X32. Use
__X32_SYSCALL_MASK on X32 system calls.
* util.c (printllval): Use ext_arg for X32.
(printcall): Support X32.
(change_syscall): Likewise.
(arg0_offset): Likewise.
(arg1_offset): Likewise.
* Makefile.am (EXTRA_DIST): Add linux/x32/errnoent.h,
linux/x32/ioctlent.h.in, linux/x32/signalent.h,
linux/x32/syscallent.h, linux/x86_64/errnoent2.h,
linux/x86_64/ioctlent2.h, linux/x86_64/signalent2.h and
linux/x86_64/syscallent2.h.
* linux/x32/errnoent.h: New.
* linux/x32/ioctlent.h.in: Likewise.
* linux/x32/signalent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/errnoent2.h: Likewise.
* linux/x86_64/ioctlent2.h: Likewise.
* linux/x86_64/signalent2.h: Likewise.
* linux/x86_64/syscallent2.h: Likewise.
Signed-off-by: H.J. Lu <hongjiu.lu@intel.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-04-16 15:00:01 +04:00
AC_TRY_COMPILE(
[#ifndef __ILP32__
# error not x32
#endif], [], arch=x32, arch=x86_64)
if test "$arch" = "x86_64"; then
2015-12-08 03:13:38 +03:00
arch_mx32=x32
Add x32 support to strace
X32 support is added to Linux kernel 3.4. In a nutshell, x32 is x86-64 with
32bit pointers. At system call level, x32 is also identical to x86-64,
as shown by many changes like "defined(X86_64) || defined(X32)". The
main differerence bewteen x32 and x86-64 is off_t in x32 is long long
instead of long.
This patch adds x32 support to strace. Tested on Linux/x32.
* configure.ac: Support X32.
* defs.h: Set SUPPORTED_PERSONALITIES to 3 for X86_64,
Set PERSONALITY2_WORDSIZE to 4 for X86_64.
Add tcb::ext_arg for X32.
* file.c (stat): New for X32.
(sys_lseek): Use 64-bit version for X32.
(printstat64): Check current_personality != 1 for X86_64.
* ipc.c (indirect_ipccall): Check current_personality == 1
for X86_64.
* mem.c (sys_mmap64): Also use tcp->u_arg for X32. Print NULL
for zero address. Call printllval for offset for X32.
* pathtrace.c (pathtrace_match): Don't check sys_old_mmap for
X32.
* process.c (ARG_FLAGS): Defined for X32.
(ARG_STACK): Likewise.
(ARG_PTID): Likewise.
(change_syscall): Handle X32.
(struct_user_offsets): Support X32.
(sys_arch_prctl): Likewise.
* signal.c: Include <asm/sigcontext.h> for X32.
(SA_RESTORER): Also define for X32.
* syscall.c (update_personality): Support X32 for X86_64.
(is_restart_error): Likewise.
(syscall_fixup_on_sysenter): Likewise.
(get_syscall_args): Likewise.
(get_syscall_result): Likewise.
(get_error): Likewise.
(__X32_SYSCALL_BIT): Define if not defined.
(__X32_SYSCALL_MASK): Likewise.
(get_scno): Check DS register value for X32. Use
__X32_SYSCALL_MASK on X32 system calls.
* util.c (printllval): Use ext_arg for X32.
(printcall): Support X32.
(change_syscall): Likewise.
(arg0_offset): Likewise.
(arg1_offset): Likewise.
* Makefile.am (EXTRA_DIST): Add linux/x32/errnoent.h,
linux/x32/ioctlent.h.in, linux/x32/signalent.h,
linux/x32/syscallent.h, linux/x86_64/errnoent2.h,
linux/x86_64/ioctlent2.h, linux/x86_64/signalent2.h and
linux/x86_64/syscallent2.h.
* linux/x32/errnoent.h: New.
* linux/x32/ioctlent.h.in: Likewise.
* linux/x32/signalent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/errnoent2.h: Likewise.
* linux/x86_64/ioctlent2.h: Likewise.
* linux/x86_64/signalent2.h: Likewise.
* linux/x86_64/syscallent2.h: Likewise.
Signed-off-by: H.J. Lu <hongjiu.lu@intel.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-04-16 15:00:01 +04:00
AC_DEFINE([X86_64], 1, [Define for the 64bit AMD x86-64 architecture.])
else
AC_DEFINE([X32], 1, [Define for the 32bit AMD x86-64 architecture.])
fi
2002-12-30 03:51:30 +03:00
;;
2009-02-25 20:08:40 +03:00
cris|crisv10)
arch=crisv10
AC_DEFINE([CRISV10], 1, [Define for the CRISv10 architecture.])
;;
crisv32)
arch=crisv32
AC_DEFINE([CRISV32], 1, [Define for the CRISv32 architecture.])
;;
2009-12-28 18:00:15 +03:00
tile*)
arch=tile
AC_DEFINE([TILE], 1, [Define for the Tile architecture])
;;
2010-07-06 16:21:07 +04:00
microblaze*)
arch=microblaze
AC_DEFINE([MICROBLAZE], 1, [Define for the MicroBlaze architecture.])
;;
2015-04-18 23:33:27 +03:00
nios2*)
arch=nios2
AC_DEFINE([NIOS2], 1, [Define for the Nios-II architecture.])
;;
2013-02-14 16:26:27 +04:00
or1k*)
arch=or1k
AC_DEFINE([OR1K], 1, [Define for the OpenRISC 1000 architecture.])
;;
2013-03-25 21:22:07 +04:00
xtensa*)
arch=xtensa
AC_DEFINE([XTENSA], 1, [Define for the Xtensa architecture])
;;
2002-12-30 03:51:30 +03:00
*)
AC_MSG_RESULT([NO!])
AC_MSG_ERROR([architecture $host_cpu is not supported by strace])
;;
esac
AC_MSG_RESULT($arch)
2015-12-08 03:13:38 +03:00
test -n "$arch_m32" ||
arch_m32=$arch
test -n "$arch_mx32" ||
arch_mx32=$arch
2002-12-30 03:51:30 +03:00
AC_SUBST(arch)
2015-12-08 03:13:38 +03:00
AC_SUBST(arch_m32)
AC_SUBST(arch_mx32)
2002-12-30 03:51:30 +03:00
2015-02-15 04:08:48 +03:00
if test "$arch" = mips; then
2015-08-19 01:53:22 +03:00
AC_CACHE_CHECK([for _MIPS_SIM], [st_cv__MIPS_SIM],
[AC_COMPUTE_INT([st_cv__MIPS_SIM], [_MIPS_SIM],
[#include <sgidefs.h>],
[AC_MSG_ERROR([_MIPS_SIM cannot be determined])])])
AC_CACHE_CHECK([for MIPS ABI], [st_cv_mips_abi],
2015-02-15 04:08:48 +03:00
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <sgidefs.h>]],
[[int i[_MIPS_SIM == _MIPS_SIM_ABI32 ? 1 : - 1];]])],
2015-08-19 01:53:22 +03:00
[st_cv_mips_abi=o32],
2015-02-15 04:08:48 +03:00
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <sgidefs.h>]],
[[int i[_MIPS_SIM == _MIPS_SIM_NABI32 ? 1 : - 1];]])],
2015-08-19 01:53:22 +03:00
[st_cv_mips_abi=n32],
2015-02-15 04:08:48 +03:00
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <sgidefs.h>]],
[[int i[_MIPS_SIM == _MIPS_SIM_ABI64 ? 1 : - 1];]])],
2015-08-19 01:53:22 +03:00
[st_cv_mips_abi=n64],
[st_cv_mips_abi=unknown])])])])
case "$st_cv_mips_abi" in
2015-02-15 04:08:48 +03:00
o32) AC_DEFINE([LINUX_MIPSO32], [1], [Define for _MIPS_SIM_ABI32.]);;
n32) AC_DEFINE([LINUX_MIPSN32], [1], [Define for _MIPS_SIM_NABI32.]);;
n64) AC_DEFINE([LINUX_MIPSN64], [1], [Define for _MIPS_SIM_ABI64.]);;
*) AC_MSG_ERROR([Unsupported _MIPS_SIM]);;
esac
fi
2014-03-19 03:37:43 +04:00
AC_ARG_ENABLE([arm-oabi],
[AS_HELP_STRING([--enable-arm-oabi],
[enable OABI support on ARM EABI])],
[], [enable_arm_oabi=no])
case "$enable_arm_oabi" in
yes) enable_arm_oabi=1 ;;
no) enable_arm_oabi=0 ;;
*) AC_MSG_ERROR([bad value $enable_arm_oabi for arm-oabi option]) ;;
esac
AC_DEFINE_UNQUOTED([ENABLE_ARM_OABI], [$enable_arm_oabi],
[Define to 1 if you want OABI support on ARM EABI.])
2010-09-09 21:41:15 +04:00
gl_WARN_ADD([-Wall])
2010-09-09 21:42:28 +04:00
gl_WARN_ADD([-Wwrite-strings])
2014-09-10 17:46:04 +04:00
gl_WARN_ADD([-Wsign-compare])
2012-05-15 04:50:26 +04:00
AC_ARG_ENABLE([gcc-Werror],
[AS_HELP_STRING([--enable-gcc-Werror], [turn on gcc's -Werror option])],
[case $enableval in
yes) gl_WARN_ADD([-Werror]) ;;
no) ;;
*) AC_MSG_ERROR([bad value $enableval for gcc-Werror option]) ;;
esac]
)
2010-09-09 21:41:15 +04:00
AC_SUBST([WARN_CFLAGS])
2002-12-30 03:51:30 +03:00
2010-09-12 11:39:55 +04:00
AC_C_BIGENDIAN
2016-01-13 00:27:36 +03:00
AC_C_CONST
2016-01-12 03:02:56 +03:00
AC_C_TYPEOF
2002-12-30 03:51:30 +03:00
2016-01-13 00:27:36 +03:00
AC_TYPE_GETGROUPS
AC_TYPE_MODE_T
2002-12-30 03:51:30 +03:00
AC_TYPE_SIGNAL
AC_TYPE_UID_T
2016-01-13 00:27:36 +03:00
AC_HEADER_DIRENT
2002-12-30 03:51:30 +03:00
AC_HEADER_MAJOR
2016-01-13 00:27:36 +03:00
AC_HEADER_STAT
AC_HEADER_STDBOOL
AC_HEADER_STDC
2002-12-30 03:51:30 +03:00
2012-03-25 19:12:16 +04:00
AC_CHECK_FUNCS(m4_normalize([
2015-01-10 03:08:58 +03:00
fanotify_mark
2014-02-26 04:01:00 +04:00
fopen64
2012-03-25 19:12:16 +04:00
fork
2014-02-26 04:01:00 +04:00
fputs_unlocked
2015-12-02 04:02:39 +03:00
fstatat
ftruncate
futimens
2012-03-25 19:12:16 +04:00
if_indextoname
inet_ntop
2015-06-08 17:19:46 +03:00
inet_pton
2015-03-23 03:04:27 +03:00
pipe2
2012-03-25 19:12:16 +04:00
prctl
2014-08-11 10:52:08 +04:00
preadv
2012-03-25 19:12:16 +04:00
process_vm_readv
2014-08-11 10:52:08 +04:00
pwritev
2016-01-12 07:37:06 +03:00
recvmmsg
2014-11-06 19:23:27 +03:00
sendmmsg
2012-03-25 19:12:16 +04:00
sigaction
2015-08-03 12:47:25 +03:00
signalfd
2012-03-25 19:12:16 +04:00
stpcpy
strerror
strsignal
2016-04-06 03:02:08 +03:00
sync_file_range
2015-07-15 18:34:59 +03:00
utimensat
2012-03-25 19:12:16 +04:00
]))
2016-01-13 00:27:36 +03:00
AC_CHECK_TYPES([sig_atomic_t, struct sigcontext],,, [#include <signal.h>])
AC_CHECK_TYPES([struct mmsghdr],,, [#include <sys/socket.h>])
AC_CHECK_TYPES([__kernel_long_t, __kernel_ulong_t],,,
[#include <asm/posix_types.h>])
AC_CHECK_TYPES([struct stat64, struct __old_kernel_stat],,,
[#include <sys/types.h>
#include <asm/stat.h>])
AC_CHECK_TYPES(m4_normalize([
struct pt_all_user_regs,
struct ia64_fpreg,
struct ptrace_peeksiginfo_args
]),,, [#include <sys/ptrace.h>])
AC_CHECK_TYPES(m4_normalize([
struct flock,
struct flock64,
struct __kernel_flock,
struct __kernel_flock64
]),,,
[#include <sys/types.h>
#include <linux/fcntl.h>])
AC_CHECK_MEMBERS(m4_normalize([
struct stat.st_atim.tv_nsec,
struct stat.st_blksize,
struct stat.st_blocks,
struct stat.st_ctim.tv_nsec,
struct stat.st_flags,
struct stat.st_fstype,
struct stat.st_gen,
struct stat.st_mtim.tv_nsec,
struct stat.st_rdev
]))
AC_CHECK_MEMBERS([struct msghdr.msg_control],,, [#include <sys/socket.h>])
AC_CHECK_MEMBERS([struct timex.tai],,, [#include <sys/timex.h>])
AC_CHECK_MEMBERS([struct utsname.domainname],,, [#include <sys/utsname.h>])
AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,
[#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>])
AC_CHECK_MEMBERS(m4_normalize([
struct stat.st_atime_nsec,
struct stat.st_ctime_nsec,
struct stat.st_mtime_nsec
]),,, [#include <sys/types.h>
#include <asm/stat.h>])
AC_CHECK_MEMBERS(m4_normalize([
siginfo_t.si_syscall,
siginfo_t.si_timerid,
siginfo_t.si_overrun
]),,, [#include <signal.h>])
2012-03-25 19:12:16 +04:00
AC_CHECK_HEADERS(m4_normalize([
asm/cachectl.h
asm/sysmips.h
2014-10-03 13:40:28 +04:00
bluetooth/bluetooth.h
2013-03-18 04:52:29 +04:00
elf.h
2012-03-25 19:12:16 +04:00
inttypes.h
ioctls.h
scsi: add bsg support
The Linux kernel supports two different versions of the SG_IO API,
namely v3 and v4. This patch adds support for version 4 of this API.
At least the sg3_utils package supports version 4 of this API. Version
4 of this API is used if /dev/bsg/H:C:I:L is used as device name.
This patch has been tested by inspecting the output of the following
commands:
modprobe scsi_debug dev_size_mb=16 delay=0
dev=$(lsscsi | sed -n '/ scsi_debug /s,^[^/]*,,p')
./strace -eioctl -s256 sg_inq $dev
echo 'Test XDWRITEREAD(10)'
bsg=/dev/bsg/$(lsscsi | sed -n '/ scsi_debug /s,^\[\([^]]\+\)\].*,\1,p')
dd if=/dev/zero bs=512 count=1 |
./strace -eioctl -s256 sg_raw -s 512 -r 1024 $bsg 53 00 00 00 00 01 00 00 01 00
* configure.ac (AC_CHECK_HEADERS): Add linux/bsg.h.
* xlat/bsg_protocol.in: New file.
* xlat/bsg_subprotocol.in: Likewise.
* scsi.c: Include them and <linux/bsg.h>.
(print_sg_io_v3_req, print_sg_io_v3_res, print_sg_io_v4_req,
print_sg_io_v4_res): New functions.
(print_sg_io_req, print_sg_io_res): Use them.
(scsi_ioctl): Update callers.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2015-02-06 15:37:03 +03:00
linux/bsg.h
2014-12-11 22:21:54 +03:00
linux/falloc.h
2015-02-05 02:50:50 +03:00
linux/filter.h
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.
2015-01-19 20:02:16 +03:00
linux/hiddev.h
decode extend getsockopt/setsockopt options
Currently the code assumes the set of valid options between getsockopt
and setsockopt are exactly the same and thus maintains one list. The
kernel unfortunately does not do this -- it allows for different opts
between the get and set functions. See the {g,s}et_opt{min,max} fields
in the various netfilter subcores.
To support this, extend the printxval function to take multiple sets of
xlats as varargs. Then we add the new get/set lists, and pass them down
in the net code when decoding things.
A simple example is iptables; before:
getsockopt(4, SOL_IP, 0x40 /* IP_??? */, ...) = 0
getsockopt(4, SOL_IP, 0x41 /* IP_??? */, ...) = 0
after:
getsockopt(4, SOL_IP, IPT_SO_GET_INFO, ...) = 0
getsockopt(4, SOL_IP, IPT_SO_GET_ENTRIES, ...) = 0
If these were setsockopt calls, then 0x40 & 0x41 would be
IPT_SO_SET_REPLACE & IPT_SO_SET_ADD_COUNTERS.
* configure.ac: Check for netfilter headers.
* defs.h (printxvals): New prototype.
(printxval): Change to a define.
* net.c: Include netfilter headers and new sockopts headers.
(print_sockopt_fd_level_name): Add a is_getsockopt argument. Change SOL_IP
and SOL_IPV6 decoding to use printxvals, and use is_getsockopt to pass more
xlats down.
(getsockopt): Call print_sockopt_fd_level_name with is_getsockopt as true.
(setsockopt): Call print_sockopt_fd_level_name with is_getsockopt as false.
* util.c (printxval): Rename to ...
(printxvals): ... this. Rewrite to be varargs based.
* xlat/getsockipoptions.in: New xlat list.
* xlat/getsockipv6options.in, xlat/setsockipoptions.in,
xlat/setsockipv6options.in: Likewise.
2015-08-19 20:29:27 +03:00
linux/ip_vs.h
Support C libraries without System V shared memory/ipc
Some systems (like Bionic) omit support for SysV related code. That
means no C library headers for strace to include. Add configure tests
to probe the headers from the kernel and use them when they are
available.
It might make more sense to never rely on the C library's headers as
there is no guarantee or requirement that the structure layout between
apps and the C library match that what is passed to the kernel.
* configure.ac (AC_CHECK_HEADERS): Check for linux/ipc.h,
linux/mqueue.h, linux/msg.h, linux/sem.h, linux/shm.h,
sys/ipc.h, sys/msg.h, sys/sem.h, and sys/shm.h.
* ipc_defs.h: Include <sys/ipc.h> or <linux/ipc.h> depending
on what is available.
* ipc_msg.c: Replace <sys/ipc.h> with "ipc_defs.h".
Fallback to <linux/msg.h> when available.
* ipc_msgctl.c: Include <sys/msg.h>, <asm/msgbuf.h>, or <linux/msg.h>
based on what is available. Note missing support for old ipc structs.
* ipc_sem.c: Include <sys/sem.h> or <linux/sem.h> depending
on what is available. Only decode sembuf when available.
* ipc_shm.c: Fallback to <linux/shm.h> when available.
* ipc_shmctl.c: Include <sys/shm.h>, <asm/shmbuf.h>, or <linux/shm.h>
based on what is available. Note missing support for old ipc structs.
* print_mq_attr.c: Fallback to <linux/mqueue.h> when available.
2015-10-31 07:47:53 +03:00
linux/ipc.h
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.
2015-01-19 20:02:16 +03:00
linux/mmtimer.h
Support C libraries without System V shared memory/ipc
Some systems (like Bionic) omit support for SysV related code. That
means no C library headers for strace to include. Add configure tests
to probe the headers from the kernel and use them when they are
available.
It might make more sense to never rely on the C library's headers as
there is no guarantee or requirement that the structure layout between
apps and the C library match that what is passed to the kernel.
* configure.ac (AC_CHECK_HEADERS): Check for linux/ipc.h,
linux/mqueue.h, linux/msg.h, linux/sem.h, linux/shm.h,
sys/ipc.h, sys/msg.h, sys/sem.h, and sys/shm.h.
* ipc_defs.h: Include <sys/ipc.h> or <linux/ipc.h> depending
on what is available.
* ipc_msg.c: Replace <sys/ipc.h> with "ipc_defs.h".
Fallback to <linux/msg.h> when available.
* ipc_msgctl.c: Include <sys/msg.h>, <asm/msgbuf.h>, or <linux/msg.h>
based on what is available. Note missing support for old ipc structs.
* ipc_sem.c: Include <sys/sem.h> or <linux/sem.h> depending
on what is available. Only decode sembuf when available.
* ipc_shm.c: Fallback to <linux/shm.h> when available.
* ipc_shmctl.c: Include <sys/shm.h>, <asm/shmbuf.h>, or <linux/shm.h>
based on what is available. Note missing support for old ipc structs.
* print_mq_attr.c: Fallback to <linux/mqueue.h> when available.
2015-10-31 07:47:53 +03:00
linux/msg.h
2013-02-04 03:04:57 +04:00
linux/perf_event.h
2015-02-05 02:50:50 +03:00
linux/seccomp.h
2015-02-14 04:51:03 +03:00
linux/securebits.h
Support C libraries without System V shared memory/ipc
Some systems (like Bionic) omit support for SysV related code. That
means no C library headers for strace to include. Add configure tests
to probe the headers from the kernel and use them when they are
available.
It might make more sense to never rely on the C library's headers as
there is no guarantee or requirement that the structure layout between
apps and the C library match that what is passed to the kernel.
* configure.ac (AC_CHECK_HEADERS): Check for linux/ipc.h,
linux/mqueue.h, linux/msg.h, linux/sem.h, linux/shm.h,
sys/ipc.h, sys/msg.h, sys/sem.h, and sys/shm.h.
* ipc_defs.h: Include <sys/ipc.h> or <linux/ipc.h> depending
on what is available.
* ipc_msg.c: Replace <sys/ipc.h> with "ipc_defs.h".
Fallback to <linux/msg.h> when available.
* ipc_msgctl.c: Include <sys/msg.h>, <asm/msgbuf.h>, or <linux/msg.h>
based on what is available. Note missing support for old ipc structs.
* ipc_sem.c: Include <sys/sem.h> or <linux/sem.h> depending
on what is available. Only decode sembuf when available.
* ipc_shm.c: Fallback to <linux/shm.h> when available.
* ipc_shmctl.c: Include <sys/shm.h>, <asm/shmbuf.h>, or <linux/shm.h>
based on what is available. Note missing support for old ipc structs.
* print_mq_attr.c: Fallback to <linux/mqueue.h> when available.
2015-10-31 07:47:53 +03:00
linux/sem.h
linux/shm.h
2012-03-25 19:12:16 +04:00
linux/utsname.h
mqueue.h
netinet/sctp.h
2014-02-26 03:04:55 +04:00
scsi/sg.h
2012-03-25 19:12:16 +04:00
stropts.h
sys/conf.h
sys/epoll.h
2015-08-02 00:08:13 +03:00
sys/eventfd.h
2015-01-10 03:08:58 +03:00
sys/fanotify.h
2012-03-25 19:12:16 +04:00
sys/ioctl.h
Support C libraries without System V shared memory/ipc
Some systems (like Bionic) omit support for SysV related code. That
means no C library headers for strace to include. Add configure tests
to probe the headers from the kernel and use them when they are
available.
It might make more sense to never rely on the C library's headers as
there is no guarantee or requirement that the structure layout between
apps and the C library match that what is passed to the kernel.
* configure.ac (AC_CHECK_HEADERS): Check for linux/ipc.h,
linux/mqueue.h, linux/msg.h, linux/sem.h, linux/shm.h,
sys/ipc.h, sys/msg.h, sys/sem.h, and sys/shm.h.
* ipc_defs.h: Include <sys/ipc.h> or <linux/ipc.h> depending
on what is available.
* ipc_msg.c: Replace <sys/ipc.h> with "ipc_defs.h".
Fallback to <linux/msg.h> when available.
* ipc_msgctl.c: Include <sys/msg.h>, <asm/msgbuf.h>, or <linux/msg.h>
based on what is available. Note missing support for old ipc structs.
* ipc_sem.c: Include <sys/sem.h> or <linux/sem.h> depending
on what is available. Only decode sembuf when available.
* ipc_shm.c: Fallback to <linux/shm.h> when available.
* ipc_shmctl.c: Include <sys/shm.h>, <asm/shmbuf.h>, or <linux/shm.h>
based on what is available. Note missing support for old ipc structs.
* print_mq_attr.c: Fallback to <linux/mqueue.h> when available.
2015-10-31 07:47:53 +03:00
sys/ipc.h
sys/msg.h
2012-03-25 19:12:16 +04:00
sys/reg.h
Support C libraries without System V shared memory/ipc
Some systems (like Bionic) omit support for SysV related code. That
means no C library headers for strace to include. Add configure tests
to probe the headers from the kernel and use them when they are
available.
It might make more sense to never rely on the C library's headers as
there is no guarantee or requirement that the structure layout between
apps and the C library match that what is passed to the kernel.
* configure.ac (AC_CHECK_HEADERS): Check for linux/ipc.h,
linux/mqueue.h, linux/msg.h, linux/sem.h, linux/shm.h,
sys/ipc.h, sys/msg.h, sys/sem.h, and sys/shm.h.
* ipc_defs.h: Include <sys/ipc.h> or <linux/ipc.h> depending
on what is available.
* ipc_msg.c: Replace <sys/ipc.h> with "ipc_defs.h".
Fallback to <linux/msg.h> when available.
* ipc_msgctl.c: Include <sys/msg.h>, <asm/msgbuf.h>, or <linux/msg.h>
based on what is available. Note missing support for old ipc structs.
* ipc_sem.c: Include <sys/sem.h> or <linux/sem.h> depending
on what is available. Only decode sembuf when available.
* ipc_shm.c: Fallback to <linux/shm.h> when available.
* ipc_shmctl.c: Include <sys/shm.h>, <asm/shmbuf.h>, or <linux/shm.h>
based on what is available. Note missing support for old ipc structs.
* print_mq_attr.c: Fallback to <linux/mqueue.h> when available.
2015-10-31 07:47:53 +03:00
sys/sem.h
sys/shm.h
2015-08-03 12:47:25 +03:00
sys/signalfd.h
2014-11-22 13:03:33 +03:00
sys/xattr.h
2012-03-25 19:12:16 +04:00
]))
2016-01-13 00:27:36 +03:00
AC_CHECK_HEADERS([asm/sigcontext.h],,, [#include <signal.h>])
AC_CHECK_HEADERS([netinet/tcp.h netinet/udp.h],,, [#include <netinet/in.h>])
Support C libraries without System V shared memory/ipc
Some systems (like Bionic) omit support for SysV related code. That
means no C library headers for strace to include. Add configure tests
to probe the headers from the kernel and use them when they are
available.
It might make more sense to never rely on the C library's headers as
there is no guarantee or requirement that the structure layout between
apps and the C library match that what is passed to the kernel.
* configure.ac (AC_CHECK_HEADERS): Check for linux/ipc.h,
linux/mqueue.h, linux/msg.h, linux/sem.h, linux/shm.h,
sys/ipc.h, sys/msg.h, sys/sem.h, and sys/shm.h.
* ipc_defs.h: Include <sys/ipc.h> or <linux/ipc.h> depending
on what is available.
* ipc_msg.c: Replace <sys/ipc.h> with "ipc_defs.h".
Fallback to <linux/msg.h> when available.
* ipc_msgctl.c: Include <sys/msg.h>, <asm/msgbuf.h>, or <linux/msg.h>
based on what is available. Note missing support for old ipc structs.
* ipc_sem.c: Include <sys/sem.h> or <linux/sem.h> depending
on what is available. Only decode sembuf when available.
* ipc_shm.c: Fallback to <linux/shm.h> when available.
* ipc_shmctl.c: Include <sys/shm.h>, <asm/shmbuf.h>, or <linux/shm.h>
based on what is available. Note missing support for old ipc structs.
* print_mq_attr.c: Fallback to <linux/mqueue.h> when available.
2015-10-31 07:47:53 +03:00
AC_CHECK_HEADERS([linux/mqueue.h],,, [#include <linux/types.h>])
2016-01-13 00:27:36 +03:00
AC_CHECK_HEADERS([linux/icmp.h linux/in6.h linux/netlink.h linux/if_packet.h],,,
[#include <stddef.h>
2010-03-08 18:07:52 +03:00
#include <sys/socket.h>
#include <asm/types.h>])
2016-01-13 00:27:36 +03:00
decode extend getsockopt/setsockopt options
Currently the code assumes the set of valid options between getsockopt
and setsockopt are exactly the same and thus maintains one list. The
kernel unfortunately does not do this -- it allows for different opts
between the get and set functions. See the {g,s}et_opt{min,max} fields
in the various netfilter subcores.
To support this, extend the printxval function to take multiple sets of
xlats as varargs. Then we add the new get/set lists, and pass them down
in the net code when decoding things.
A simple example is iptables; before:
getsockopt(4, SOL_IP, 0x40 /* IP_??? */, ...) = 0
getsockopt(4, SOL_IP, 0x41 /* IP_??? */, ...) = 0
after:
getsockopt(4, SOL_IP, IPT_SO_GET_INFO, ...) = 0
getsockopt(4, SOL_IP, IPT_SO_GET_ENTRIES, ...) = 0
If these were setsockopt calls, then 0x40 & 0x41 would be
IPT_SO_SET_REPLACE & IPT_SO_SET_ADD_COUNTERS.
* configure.ac: Check for netfilter headers.
* defs.h (printxvals): New prototype.
(printxval): Change to a define.
* net.c: Include netfilter headers and new sockopts headers.
(print_sockopt_fd_level_name): Add a is_getsockopt argument. Change SOL_IP
and SOL_IPV6 decoding to use printxvals, and use is_getsockopt to pass more
xlats down.
(getsockopt): Call print_sockopt_fd_level_name with is_getsockopt as true.
(setsockopt): Call print_sockopt_fd_level_name with is_getsockopt as false.
* util.c (printxval): Rename to ...
(printxvals): ... this. Rewrite to be varargs based.
* xlat/getsockipoptions.in: New xlat list.
* xlat/getsockipv6options.in, xlat/setsockipoptions.in,
xlat/setsockipv6options.in: Likewise.
2015-08-19 20:29:27 +03:00
AC_CHECK_HEADERS(m4_normalize([
linux/netfilter_arp/arp_tables.h
linux/netfilter_bridge/ebtables.h
linux/netfilter_ipv4/ip_tables.h
linux/netfilter_ipv6/ip6_tables.h
2016-01-13 00:27:36 +03:00
]),,, [#include <netinet/in.h>
decode extend getsockopt/setsockopt options
Currently the code assumes the set of valid options between getsockopt
and setsockopt are exactly the same and thus maintains one list. The
kernel unfortunately does not do this -- it allows for different opts
between the get and set functions. See the {g,s}et_opt{min,max} fields
in the various netfilter subcores.
To support this, extend the printxval function to take multiple sets of
xlats as varargs. Then we add the new get/set lists, and pass them down
in the net code when decoding things.
A simple example is iptables; before:
getsockopt(4, SOL_IP, 0x40 /* IP_??? */, ...) = 0
getsockopt(4, SOL_IP, 0x41 /* IP_??? */, ...) = 0
after:
getsockopt(4, SOL_IP, IPT_SO_GET_INFO, ...) = 0
getsockopt(4, SOL_IP, IPT_SO_GET_ENTRIES, ...) = 0
If these were setsockopt calls, then 0x40 & 0x41 would be
IPT_SO_SET_REPLACE & IPT_SO_SET_ADD_COUNTERS.
* configure.ac: Check for netfilter headers.
* defs.h (printxvals): New prototype.
(printxval): Change to a define.
* net.c: Include netfilter headers and new sockopts headers.
(print_sockopt_fd_level_name): Add a is_getsockopt argument. Change SOL_IP
and SOL_IPV6 decoding to use printxvals, and use is_getsockopt to pass more
xlats down.
(getsockopt): Call print_sockopt_fd_level_name with is_getsockopt as true.
(setsockopt): Call print_sockopt_fd_level_name with is_getsockopt as false.
* util.c (printxval): Rename to ...
(printxvals): ... this. Rewrite to be varargs based.
* xlat/getsockipoptions.in: New xlat list.
* xlat/getsockipv6options.in, xlat/setsockipoptions.in,
xlat/setsockipv6options.in: Likewise.
2015-08-19 20:29:27 +03:00
#include <net/if.h>])
2002-12-30 03:51:30 +03:00
evdev: fix build with old kernel headers
* configure.ac: Check whether struct input_absinfo.resolution is defined
in <linux/input.h>.
* evdev.c (SYN_MAX): Add fallback definition.
(abs_ioctl): Wrap use of struct input_absinfo.resolution in #ifdef check.
(keycode_V2_ioctl, mtslots_ioctl, repeat_ioctl): Wrap in #ifdef checks.
(evdev_read_ioctl): Wrap in #ifdef checks the code that uses EV_SW,
EVIOCGREP, EVIOCGKEYCODE_V2, EVIOCGMTSLOTS, EVIOCGPROP, and EVIOCGSW.
(evdev_write_ioctl): Wrap in #ifdef checks the code that uses EVIOCSREP,
EVIOCSKEYCODE_V2, EVIOCSCLOCKID, and EVIOCREVOKE.
2015-02-22 02:50:33 +03:00
AC_CHECK_HEADERS([linux/input.h], [
AC_CHECK_MEMBERS([struct input_absinfo.resolution],,, [#include <linux/input.h>])
])
2015-07-29 19:27:16 +03:00
AC_CHECK_HEADERS([linux/bpf.h], [
AC_CACHE_CHECK([whether union bpf_attr.log_buf initialization works],
[st_cv_have_union_bpf_attr_log_buf],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <linux/bpf.h>]],
[[union bpf_attr a = { .log_buf = 0 };]])],
[st_cv_have_union_bpf_attr_log_buf=yes],
[st_cv_have_union_bpf_attr_log_buf=no])])
if test $st_cv_have_union_bpf_attr_log_buf = yes; then
AC_DEFINE(HAVE_UNION_BPF_ATTR_LOG_BUF, [1],
[Define to 1 if union bpf_attr.log_buf initialization works])
fi
])
Fix decoding of statfs family syscalls
Fix decoders of fstatfs, fstatfs64, statfs, and statfs64 syscalls
by rewriting them using mpers infrastructure.
* fetch_struct_statfs.c: New file.
* fstatfs.c: Likewise.
* fstatfs64.c: Likewise.
* print_statfs.c: Likewise.
* statfs.h: Likewise.
* statfs64.c: Likewise.
* statfs.c: Remove everything except SYS_FUNC(statfs).
* configure.ac: Remove the check for struct statfs64 in <sys/vfs.h>.
Add checks for struct statfs and struct statfs64 in <asm/statfs.h>.
Add checks for f_frsize and f_flags members of these structures.
* defs.h (struct strace_statfs): New forward declaration.
(print_struct_statfs, print_struct_statfs64): New prototypes.
* Makefile.am (libstrace_a_SOURCES): Add fstatfs.c, fstatfs64.c,
statfs.c, and statfs64.c.
(strace_SOURCES): Add fetch_struct_statfs.c, print_statfs.c,
and statfs.h.
* NEWS: Mention this fix.
* tests/fstatfs.c: New file.
* tests/fstatfs64.c: Likewise.
* tests/statfs64.c: Likewise.
* tests/xstatfs.c: Likewise.
* tests/xstatfs64.c: Likewise.
* tests/xstatfsx.c: Likewise.
* tests/fstatfs.test: New test.
* tests/fstatfs64.test: Likewise.
* tests/statfs64.test: Likewise.
* tests/statfs.c: Rewrite using xstatfs.c.
* tests/statfs.test: Update.
* tests/.gitignore: Add fstatfs, fstatfs64, and statfs64.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add fstatfs.test, fstatfs64.test, and statfs64.test.
(EXTRA_DIST): Add xstatfs.c, xstatfs64.c, and xstatfsx.c.
2016-04-26 03:21:26 +03:00
AC_CHECK_TYPES([struct statfs], [
AC_CHECK_MEMBERS([struct statfs.f_frsize],,, [#include <linux/types.h>
#include <asm/statfs.h>])
AC_CHECK_MEMBERS([struct statfs.f_flags],,, [#include <linux/types.h>
#include <asm/statfs.h>])
AC_CHECK_MEMBERS([struct statfs.f_fsid.val],,, [#include <linux/types.h>
#include <asm/statfs.h>])
AC_CHECK_MEMBERS([struct statfs.f_fsid.__val],,, [#include <linux/types.h>
#include <asm/statfs.h>])
],, [#include <linux/types.h>
#include <asm/statfs.h>])
AC_CHECK_TYPES([struct statfs64], [
AC_CHECK_MEMBERS([struct statfs64.f_frsize],,, [#include <linux/types.h>
#include <asm/statfs.h>])
AC_CHECK_MEMBERS([struct statfs64.f_flags],,, [#include <linux/types.h>
#include <asm/statfs.h>])
AC_CHECK_MEMBERS([struct statfs64.f_fsid.val],,, [#include <linux/types.h>
#include <asm/statfs.h>])
AC_CHECK_MEMBERS([struct statfs64.f_fsid.__val],,, [#include <linux/types.h>
#include <asm/statfs.h>])
],, [#include <linux/types.h>
#include <asm/statfs.h>])
2002-12-30 03:51:30 +03:00
AC_CHECK_DECLS([sys_errlist])
2012-03-25 19:12:16 +04:00
AC_CHECK_DECLS(m4_normalize([
2013-11-13 01:20:50 +04:00
PTRACE_PEEKUSER,
2015-02-13 03:26:38 +03:00
PTRACE_POKEUSER
2012-03-25 19:12:16 +04:00
]),,, [#include <sys/ptrace.h>])
2002-12-30 03:51:30 +03:00
2014-04-26 19:22:08 +04:00
AC_CHECK_DECLS(m4_normalize([
P_PID,
P_PPID,
P_PGID,
P_SID,
P_CID,
P_UID,
P_GID,
P_ALL,
P_LWPID
]),,, [#include <sys/wait.h>])
2012-05-02 14:21:49 +04:00
AC_CHECK_DECLS(m4_normalize([
2014-04-26 18:12:33 +04:00
LO_FLAGS_READ_ONLY,
2012-05-02 14:21:49 +04:00
LO_FLAGS_AUTOCLEAR,
LO_FLAGS_PARTSCAN
]),,, [#include <linux/loop.h>])
2014-04-26 17:54:12 +04:00
AC_CHECK_DECLS(m4_normalize([
CTL_KERN,
CTL_VM,
CTL_NET,
CTL_PROC,
CTL_FS,
CTL_DEBUG,
CTL_DEV,
CTL_BUS,
CTL_ABI,
CTL_CPU,
CTL_ARLAN,
CTL_S390DBF,
CTL_SUNRPC,
CTL_PM,
CTL_FRV,
KERN_OSTYPE,
KERN_OSRELEASE,
KERN_OSREV,
KERN_VERSION,
KERN_SECUREMASK,
KERN_PROF,
KERN_NODENAME,
KERN_DOMAINNAME,
KERN_PANIC,
KERN_REALROOTDEV,
KERN_SPARC_REBOOT,
KERN_CTLALTDEL,
KERN_PRINTK,
KERN_NAMETRANS,
KERN_PPC_HTABRECLAIM,
KERN_PPC_ZEROPAGED,
KERN_PPC_POWERSAVE_NAP,
KERN_MODPROBE,
KERN_SG_BIG_BUFF,
KERN_ACCT,
KERN_PPC_L2CR,
KERN_RTSIGNR,
KERN_RTSIGMAX,
KERN_SHMMAX,
KERN_MSGMAX,
KERN_MSGMNB,
KERN_MSGPOOL,
KERN_SYSRQ,
KERN_MAX_THREADS,
KERN_RANDOM,
KERN_SHMALL,
KERN_MSGMNI,
KERN_SEM,
KERN_SPARC_STOP_A,
KERN_SHMMNI,
KERN_OVERFLOWUID,
KERN_OVERFLOWGID,
KERN_SHMPATH,
KERN_HOTPLUG,
KERN_IEEE_EMULATION_WARNINGS,
KERN_S390_USER_DEBUG_LOGGING,
KERN_CORE_USES_PID,
KERN_TAINTED,
KERN_CADPID,
KERN_PIDMAX,
KERN_CORE_PATTERN,
KERN_PANIC_ON_OOPS,
KERN_HPPA_PWRSW,
KERN_HPPA_UNALIGNED,
KERN_PRINTK_RATELIMIT,
KERN_PRINTK_RATELIMIT_BURST,
KERN_PTY,
KERN_NGROUPS_MAX,
KERN_SPARC_SCONS_PWROFF,
KERN_HZ_TIMER,
KERN_UNKNOWN_NMI_PANIC,
KERN_BOOTLOADER_TYPE,
KERN_RANDOMIZE,
KERN_SETUID_DUMPABLE,
KERN_SPIN_RETRY,
KERN_ACPI_VIDEO_FLAGS,
KERN_IA64_UNALIGNED,
KERN_COMPAT_LOG,
KERN_MAX_LOCK_DEPTH,
KERN_NMI_WATCHDOG,
KERN_PANIC_ON_NMI,
NET_CORE,
NET_ETHER,
NET_802,
NET_UNIX,
NET_IPV4,
NET_IPX,
NET_ATALK,
NET_NETROM,
NET_AX25,
NET_BRIDGE,
NET_ROSE,
NET_IPV6,
NET_X25,
NET_TR,
NET_DECNET,
NET_ECONET,
NET_SCTP,
NET_LLC,
NET_NETFILTER,
NET_DCCP,
NET_IRDA,
NET_CORE_WMEM_MAX,
NET_CORE_RMEM_MAX,
NET_CORE_WMEM_DEFAULT,
NET_CORE_RMEM_DEFAULT,
NET_CORE_DESTROY_DELAY,
NET_CORE_MAX_BACKLOG,
NET_CORE_FASTROUTE,
NET_CORE_MSG_COST,
NET_CORE_MSG_BURST,
NET_CORE_OPTMEM_MAX,
NET_CORE_HOT_LIST_LENGTH,
NET_CORE_DIVERT_VERSION,
NET_CORE_NO_CONG_THRESH,
NET_CORE_NO_CONG,
NET_CORE_LO_CONG,
NET_CORE_MOD_CONG,
NET_CORE_DEV_WEIGHT,
NET_CORE_SOMAXCONN,
NET_CORE_BUDGET,
NET_CORE_AEVENT_ETIME,
NET_CORE_AEVENT_RSEQTH,
NET_CORE_WARNINGS,
NET_IPV4_FORWARD,
NET_IPV4_DYNADDR,
NET_IPV4_CONF,
NET_IPV4_NEIGH,
NET_IPV4_ROUTE,
NET_IPV4_FIB_HASH,
NET_IPV4_NETFILTER,
NET_IPV4_TCP_TIMESTAMPS,
NET_IPV4_TCP_WINDOW_SCALING,
NET_IPV4_TCP_SACK,
NET_IPV4_TCP_RETRANS_COLLAPSE,
NET_IPV4_DEFAULT_TTL,
NET_IPV4_AUTOCONFIG,
NET_IPV4_NO_PMTU_DISC,
NET_IPV4_TCP_SYN_RETRIES,
NET_IPV4_IPFRAG_HIGH_THRESH,
NET_IPV4_IPFRAG_LOW_THRESH,
NET_IPV4_IPFRAG_TIME,
NET_IPV4_TCP_MAX_KA_PROBES,
NET_IPV4_TCP_KEEPALIVE_TIME,
NET_IPV4_TCP_KEEPALIVE_PROBES,
NET_IPV4_TCP_RETRIES1,
NET_IPV4_TCP_RETRIES2,
NET_IPV4_TCP_FIN_TIMEOUT,
NET_IPV4_IP_MASQ_DEBUG,
NET_TCP_SYNCOOKIES,
NET_TCP_STDURG,
NET_TCP_RFC1337,
NET_TCP_SYN_TAILDROP,
NET_TCP_MAX_SYN_BACKLOG,
NET_IPV4_LOCAL_PORT_RANGE,
NET_IPV4_ICMP_ECHO_IGNORE_ALL,
NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS,
NET_IPV4_ICMP_SOURCEQUENCH_RATE,
NET_IPV4_ICMP_DESTUNREACH_RATE,
NET_IPV4_ICMP_TIMEEXCEED_RATE,
NET_IPV4_ICMP_PARAMPROB_RATE,
NET_IPV4_ICMP_ECHOREPLY_RATE,
NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES,
NET_IPV4_IGMP_MAX_MEMBERSHIPS,
NET_TCP_TW_RECYCLE,
NET_IPV4_ALWAYS_DEFRAG,
NET_IPV4_TCP_KEEPALIVE_INTVL,
NET_IPV4_INET_PEER_THRESHOLD,
NET_IPV4_INET_PEER_MINTTL,
NET_IPV4_INET_PEER_MAXTTL,
NET_IPV4_INET_PEER_GC_MINTIME,
NET_IPV4_INET_PEER_GC_MAXTIME,
NET_TCP_ORPHAN_RETRIES,
NET_TCP_ABORT_ON_OVERFLOW,
NET_TCP_SYNACK_RETRIES,
NET_TCP_MAX_ORPHANS,
NET_TCP_MAX_TW_BUCKETS,
NET_TCP_FACK,
NET_TCP_REORDERING,
NET_TCP_ECN,
NET_TCP_DSACK,
NET_TCP_MEM,
NET_TCP_WMEM,
NET_TCP_RMEM,
NET_TCP_APP_WIN,
NET_TCP_ADV_WIN_SCALE,
NET_IPV4_NONLOCAL_BIND,
NET_IPV4_ICMP_RATELIMIT,
NET_IPV4_ICMP_RATEMASK,
NET_TCP_TW_REUSE,
NET_TCP_FRTO,
NET_TCP_LOW_LATENCY,
NET_IPV4_IPFRAG_SECRET_INTERVAL,
NET_IPV4_IGMP_MAX_MSF,
NET_TCP_NO_METRICS_SAVE,
NET_TCP_DEFAULT_WIN_SCALE,
NET_TCP_MODERATE_RCVBUF,
NET_TCP_TSO_WIN_DIVISOR,
NET_TCP_BIC_BETA,
NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR,
NET_TCP_CONG_CONTROL,
NET_TCP_ABC,
NET_IPV4_IPFRAG_MAX_DIST,
NET_TCP_MTU_PROBING,
NET_TCP_BASE_MSS,
NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS,
NET_TCP_DMA_COPYBREAK,
NET_TCP_SLOW_START_AFTER_IDLE,
NET_CIPSOV4_CACHE_ENABLE,
NET_CIPSOV4_CACHE_BUCKET_SIZE,
NET_CIPSOV4_RBM_OPTFMT,
NET_CIPSOV4_RBM_STRICTVALID,
NET_TCP_AVAIL_CONG_CONTROL,
NET_TCP_ALLOWED_CONG_CONTROL,
NET_TCP_MAX_SSTHRESH,
NET_TCP_FRTO_RESPONSE,
NET_IPV4_ROUTE_FLUSH,
NET_IPV4_ROUTE_MIN_DELAY,
NET_IPV4_ROUTE_MAX_DELAY,
NET_IPV4_ROUTE_GC_THRESH,
NET_IPV4_ROUTE_MAX_SIZE,
NET_IPV4_ROUTE_GC_MIN_INTERVAL,
NET_IPV4_ROUTE_GC_TIMEOUT,
NET_IPV4_ROUTE_GC_INTERVAL,
NET_IPV4_ROUTE_REDIRECT_LOAD,
NET_IPV4_ROUTE_REDIRECT_NUMBER,
NET_IPV4_ROUTE_REDIRECT_SILENCE,
NET_IPV4_ROUTE_ERROR_COST,
NET_IPV4_ROUTE_ERROR_BURST,
NET_IPV4_ROUTE_GC_ELASTICITY,
NET_IPV4_ROUTE_MTU_EXPIRES,
NET_IPV4_ROUTE_MIN_PMTU,
NET_IPV4_ROUTE_MIN_ADVMSS,
NET_IPV4_ROUTE_SECRET_INTERVAL,
NET_IPV4_ROUTE_GC_MIN_INTERVAL_MS,
NET_IPV4_CONF_FORWARDING,
NET_IPV4_CONF_MC_FORWARDING,
NET_IPV4_CONF_PROXY_ARP,
NET_IPV4_CONF_ACCEPT_REDIRECTS,
NET_IPV4_CONF_SECURE_REDIRECTS,
NET_IPV4_CONF_SEND_REDIRECTS,
NET_IPV4_CONF_SHARED_MEDIA,
NET_IPV4_CONF_RP_FILTER,
NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE,
NET_IPV4_CONF_BOOTP_RELAY,
NET_IPV4_CONF_LOG_MARTIANS,
NET_IPV4_CONF_TAG,
NET_IPV4_CONF_ARPFILTER,
NET_IPV4_CONF_MEDIUM_ID,
NET_IPV4_CONF_NOXFRM,
NET_IPV4_CONF_NOPOLICY,
NET_IPV4_CONF_FORCE_IGMP_VERSION,
NET_IPV4_CONF_ARP_ANNOUNCE,
NET_IPV4_CONF_ARP_IGNORE,
NET_IPV4_CONF_PROMOTE_SECONDARIES,
NET_IPV4_CONF_ARP_ACCEPT,
NET_IPV4_CONF_ARP_NOTIFY,
NET_IPV6_CONF,
NET_IPV6_NEIGH,
NET_IPV6_ROUTE,
NET_IPV6_ICMP,
NET_IPV6_BINDV6ONLY,
NET_IPV6_IP6FRAG_HIGH_THRESH,
NET_IPV6_IP6FRAG_LOW_THRESH,
NET_IPV6_IP6FRAG_TIME,
NET_IPV6_IP6FRAG_SECRET_INTERVAL,
NET_IPV6_MLD_MAX_MSF,
NET_IPV6_ROUTE_FLUSH,
NET_IPV6_ROUTE_GC_THRESH,
NET_IPV6_ROUTE_MAX_SIZE,
NET_IPV6_ROUTE_GC_MIN_INTERVAL,
NET_IPV6_ROUTE_GC_TIMEOUT,
NET_IPV6_ROUTE_GC_INTERVAL,
NET_IPV6_ROUTE_GC_ELASTICITY,
NET_IPV6_ROUTE_MTU_EXPIRES,
NET_IPV6_ROUTE_MIN_ADVMSS,
NET_IPV6_ROUTE_GC_MIN_INTERVAL_MS,
NET_UNIX_DESTROY_DELAY,
NET_UNIX_DELETE_DELAY,
NET_UNIX_MAX_DGRAM_QLEN,
VM_OVERCOMMIT_MEMORY,
VM_PAGE_CLUSTER,
VM_DIRTY_BACKGROUND,
VM_DIRTY_RATIO,
VM_DIRTY_WB_CS,
VM_DIRTY_EXPIRE_CS,
VM_NR_PDFLUSH_THREADS,
VM_OVERCOMMIT_RATIO,
VM_PAGEBUF,
VM_HUGETLB_PAGES,
VM_SWAPPINESS,
VM_LOWMEM_RESERVE_RATIO,
VM_MIN_FREE_KBYTES,
VM_MAX_MAP_COUNT,
VM_LAPTOP_MODE,
VM_BLOCK_DUMP,
VM_HUGETLB_GROUP,
VM_VFS_CACHE_PRESSURE,
VM_LEGACY_VA_LAYOUT,
VM_SWAP_TOKEN_TIMEOUT
]),,,
[#include <sys/types.h>
#include <linux/sysctl.h>])
2014-11-03 23:27:40 +03:00
AC_CHECK_DECLS(m4_normalize([
V4L2_FIELD_ANY,
V4L2_FIELD_NONE,
V4L2_FIELD_TOP,
V4L2_FIELD_BOTTOM,
V4L2_FIELD_INTERLACED,
V4L2_FIELD_SEQ_TB,
V4L2_FIELD_SEQ_BT,
V4L2_FIELD_ALTERNATE,
V4L2_FIELD_INTERLACED_TB,
V4L2_FIELD_INTERLACED_BT,
V4L2_BUF_TYPE_VIDEO_CAPTURE,
V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
V4L2_BUF_TYPE_VIDEO_OUTPUT,
V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
V4L2_BUF_TYPE_VIDEO_OVERLAY,
V4L2_BUF_TYPE_VBI_CAPTURE,
V4L2_BUF_TYPE_VBI_OUTPUT,
V4L2_BUF_TYPE_SLICED_VBI_CAPTURE,
V4L2_BUF_TYPE_SLICED_VBI_OUTPUT,
V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY,
V4L2_TUNER_RADIO,
V4L2_TUNER_ANALOG_TV,
V4L2_TUNER_DIGITAL_TV,
V4L2_MEMORY_MMAP,
V4L2_MEMORY_USERPTR,
V4L2_MEMORY_OVERLAY,
V4L2_MEMORY_DMABUF,
V4L2_COLORSPACE_SMPTE170M,
V4L2_COLORSPACE_SMPTE240M,
V4L2_COLORSPACE_REC709,
V4L2_COLORSPACE_BT878,
V4L2_COLORSPACE_470_SYSTEM_M,
V4L2_COLORSPACE_470_SYSTEM_BG,
V4L2_COLORSPACE_JPEG,
V4L2_COLORSPACE_SRGB,
V4L2_PRIORITY_UNSET,
V4L2_PRIORITY_BACKGROUND,
V4L2_PRIORITY_INTERACTIVE,
V4L2_PRIORITY_RECORD,
V4L2_FRMSIZE_TYPE_DISCRETE,
V4L2_FRMSIZE_TYPE_CONTINUOUS,
V4L2_FRMSIZE_TYPE_STEPWISE,
V4L2_FRMIVAL_TYPE_DISCRETE,
V4L2_FRMIVAL_TYPE_CONTINUOUS,
V4L2_FRMIVAL_TYPE_STEPWISE,
V4L2_CTRL_TYPE_INTEGER,
V4L2_CTRL_TYPE_BOOLEAN,
V4L2_CTRL_TYPE_MENU,
V4L2_CTRL_TYPE_BUTTON,
V4L2_CTRL_TYPE_INTEGER64,
V4L2_CTRL_TYPE_CTRL_CLASS,
V4L2_CTRL_TYPE_STRING,
V4L2_CTRL_TYPE_BITMASK,
V4L2_CTRL_TYPE_INTEGER_MENU
]),,, [#include <linux/videodev2.h>])
2011-08-17 01:36:16 +04:00
AC_CACHE_CHECK([for BLKGETSIZE64], [ac_cv_have_blkgetsize64],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
#include <stdlib.h>
#include <linux/fs.h>], [return !BLKGETSIZE64;])],
[ac_cv_have_blkgetsize64=yes], [ac_cv_have_blkgetsize64=no])]
if test $ac_cv_have_blkgetsize64 = yes; then
AC_DEFINE([HAVE_BLKGETSIZE64], [1], [Define to 1 if you have BLKGETSIZE64.])
fi)
2012-03-16 00:42:46 +04:00
AC_CHECK_SIZEOF([long])
2013-05-04 23:51:57 +04:00
AC_CHECK_SIZEOF([long long])
2014-03-04 03:09:47 +04:00
AC_CHECK_SIZEOF([off_t],,[#include <sys/types.h>])
2015-05-21 19:19:40 +03:00
AC_CHECK_SIZEOF([struct i64_i32],,[struct i64_i32 {long long i64; int i32;};])
2012-03-16 00:42:46 +04:00
2015-03-05 08:03:41 +03:00
AC_CACHE_CHECK([for SIGRTMIN], [st_cv_SIGRTMIN],
[[st_cv_SIGRTMIN="$(echo SIGRTMIN |
$CPP $CPPFLAGS -P -imacros asm/signal.h - |
grep '^[0-9]')"
test -n "$st_cv_SIGRTMIN" || st_cv_SIGRTMIN=no]])
if test "x$st_cv_SIGRTMIN" != xno; then
AC_DEFINE_UNQUOTED([ASM_SIGRTMIN], [$st_cv_SIGRTMIN],
[SIGRTMIN defined in <asm/signal.h>])
fi
AC_CACHE_CHECK([for SA_RESTORER], [st_cv_SA_RESTORER],
[st_cv_SA_RESTORER="$(echo SA_RESTORER |
2014-02-08 04:15:52 +04:00
$CPP $CPPFLAGS -P -imacros asm/signal.h - |
grep ^0x)"
2015-03-05 08:03:41 +03:00
test -n "$st_cv_SA_RESTORER" || st_cv_SA_RESTORER=no])
if test "x$st_cv_SA_RESTORER" != xno; then
AC_DEFINE_UNQUOTED([ASM_SA_RESTORER], [$st_cv_SA_RESTORER],
2014-02-08 04:15:52 +04:00
[SA_RESTORER defined in <asm/signal.h>])
fi
Rewrite signal mask decoding without sigset_t
The sigset_t provided by libc is not quite convenient.
In glibc, sigset_t is an array with space for 1024 bits, which is much
more than required: all architectures supported by Linux have only 64
signals except MIPS, which has 128.
In bionic libc, LP32 sigset_t is only 4 bytes long, which is less than
necessary.
With this change, signal mask is decoded without use of intermediate
sigset_t structure, which saves us some cpu cycles in case of glibc with
its inflated sigset_t, and enables build with libcs where sigset_t is
broken.
Old implementation used to check each signal number in the given signal
mask twice using sigismember().
New implementation is based on popcount and next_set_bit() so it's
noticeably faster.
* configure.ac: Check for __builtin_popcount.
* signal.c: Ensure that NSIG >= 32.
(sprintsigmask, sprintsigmask_long, printsigmask): Remove.
(popcount32, sprintsigmask_n): New functions.
(tprintsigmask_addr, sprintsigmask_val, tprintsigmask_val): New macros.
(print_sigset_addr_len, sys_sigsetmask, sys_sigreturn, sys_siggetmask,
sys_sigsuspend, sys_sigprocmask, decode_new_sigaction): Update to use
new signal mask decoding interface.
* tests/sigaction.c (main): Add a test with almost filled signal mask.
* tests/sigaction.awk: Update.
2014-02-26 20:51:28 +04:00
AC_CACHE_CHECK([for __builtin_popcount], [st_cv_have___builtin_popcount],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([], [__builtin_popcount(0)])],
[st_cv_have___builtin_popcount=yes],
[st_cv_have___builtin_popcount=no])])
if test "x$st_cv_have___builtin_popcount" = xyes; then
AC_DEFINE([HAVE___BUILTIN_POPCOUNT], [1],
[Define to 1 if the system provides __builtin_popcount function])
fi
2015-02-27 08:01:25 +03:00
AC_CHECK_LIB([dl], [dladdr], [dl_LIBS='-ldl'], [dl_LIBS=])
2015-02-27 07:09:56 +03:00
if test "x$ac_cv_lib_dl_dladdr" = xyes; then
AC_DEFINE([HAVE_DLADDR], [1], [Define to 1 if the system provides dladdr])
fi
AC_SUBST(dl_LIBS)
2002-12-30 03:51:30 +03:00
AC_PATH_PROG([PERL], [perl])
2013-07-23 11:11:35 +04:00
dnl stack trace with libunwind
libunwind_CPPFLAGS=
libunwind_LDFLAGS=
libunwind_LIBS=
AC_ARG_WITH([libunwind],
[AS_HELP_STRING([--with-libunwind],
[use libunwind to implement stack tracing support])],
[case "${withval}" in
yes|no|check) ;;
*) with_libunwind=yes
libunwind_CPPFLAGS="-I${withval}/include"
libunwind_LDFLAGS="-L${withval}/lib" ;;
esac],
[with_libunwind=check]
)
use_libunwind=no
AS_IF([test "x$with_libunwind" != xno],
[saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $libunwind_CPPFLAGS"
AC_CHECK_HEADERS([libunwind-ptrace.h],
[saved_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $libunwind_LDFLAGS"
AC_CHECK_LIB([unwind], [backtrace],
[libunwind_LIBS="-lunwind $libunwind_LIBS"
AC_MSG_CHECKING([for unw_create_addr_space in libunwind-generic])
saved_LIBS="$LIBS"
LIBS="-lunwind-generic $libunwind_LIBS $LIBS"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <libunwind-ptrace.h>]],
[[return !unw_create_addr_space(0, 0)]])
],
[AC_MSG_RESULT([yes])
libunwind_LIBS="-lunwind-generic $libunwind_LIBS"
AC_CHECK_LIB([unwind-ptrace], [_UPT_create],
[libunwind_LIBS="-lunwind-ptrace $libunwind_LIBS"
use_libunwind=yes
],
[if test "x$with_libunwind" != xcheck; then
AC_MSG_FAILURE([failed to find _UPT_create in libunwind-ptrace])
fi
],
[$libunwind_LIBS]
)
],
[AC_MSG_RESULT([no])
if test "x$with_libunwind" != xcheck; then
AC_MSG_FAILURE([failed to find unw_create_addr_space in libunwind-generic])
fi
]
)
LIBS="$saved_LIBS"
],
[if test "x$with_libunwind" != xcheck; then
AC_MSG_FAILURE([failed to find libunwind])
fi
],
[$libunwind_LIBS]
)
LDFLAGS="$saved_LDFLAGS"
],
[if test "x$with_libunwind" != xcheck; then
AC_MSG_FAILURE([failed to find libunwind-ptrace.h])
fi
]
)
CPPFLAGS="$saved_CPPFLAGS"
]
)
dnl enable libunwind
AC_MSG_CHECKING([whether to enable stack tracing support using libunwind])
if test "x$use_libunwind" = xyes; then
AC_DEFINE([USE_LIBUNWIND], 1, [Compile stack tracing functionality])
AC_SUBST(libunwind_LIBS)
AC_SUBST(libunwind_LDFLAGS)
AC_SUBST(libunwind_CPPFLAGS)
fi
AM_CONDITIONAL([USE_LIBUNWIND], [test "x$use_libunwind" = xyes])
AC_MSG_RESULT([$use_libunwind])
2015-01-13 07:57:27 +03:00
if test "$arch" = mips && test "$no_create" != yes; then
mkdir -p linux/mips
if $srcdir/linux/mips/genstub.sh linux/mips; then
AC_MSG_RESULT([Generated MIPS syscallent stubs])
else
AC_MSG_FAILURE([Failed to generate syscallent stubs])
fi
fi
2015-07-23 14:19:47 +03:00
st_MPERS([m32], [aarch64|powerpc64|sparc64|tile|x32|x86_64])
st_MPERS([mx32], [x86_64])
2015-01-24 01:45:02 +03:00
AC_CONFIG_FILES([Makefile tests/Makefile tests-m32/Makefile tests-mx32/Makefile])
2002-12-30 03:51:30 +03:00
AC_OUTPUT