From d6c71dd0611e7e337edaf36c35ad51a90f404b14 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Sun, 30 Dec 2018 15:35:21 +0000 Subject: [PATCH] Fix preprocessor indentation Indent the C preprocessor directives to reflect their nesting using the following script: $ cppi -l $(git grep -El '^[[:space:]]*#[[:space:]]*(if|ifdef|ifndef|elif|else|endif|define|pragma)[[:space:]]' |grep -v '\.sh$') |while read f; do cppi < "$f" > "$f".cppi; mv "$f".cppi "$f" done --- arch_defs.h | 6 +- block.c | 2 +- bpf_attr.h | 106 ++--- bpf_filter.h | 2 +- bpf_fprog.h | 2 +- btrfs.c | 136 +++---- cacheflush.c | 28 +- defs.h | 600 ++++++++++++++-------------- delay.h | 2 +- dm.c | 2 +- error_prints.h | 22 +- evdev.c | 2 +- evdev_mpers.c | 2 +- f_owner_ex.h | 14 +- filter.h | 2 +- flock.h | 24 +- gcc_compat.h | 188 ++++----- get_personality.h | 4 +- ipc_defs.h | 22 +- kernel_types.h | 40 +- keyctl_kdf_params.h | 10 +- kill_save_errno.h | 8 +- kvm.c | 2 +- largefile_wrappers.h | 40 +- linux/aarch64/raw_syscall.h | 2 +- linux/alpha/raw_syscall.h | 2 +- linux/arc/raw_syscall.h | 2 +- linux/arm/raw_syscall.h | 8 +- linux/asm_stat.h | 2 +- linux/avr32/raw_syscall.h | 2 +- linux/bfin/raw_syscall.h | 2 +- linux/bfin/rt_sigframe.h | 4 +- linux/dummy.h | 230 +++++------ linux/hppa/raw_syscall.h | 2 +- linux/hppa/rt_sigframe.h | 4 +- linux/i386/raw_syscall.h | 2 +- linux/i386/rt_sigframe.h | 4 +- linux/ia64/raw_syscall.h | 2 +- linux/ia64/rt_sigframe.h | 6 +- linux/inet_diag.h | 6 +- linux/m68k/raw_syscall.h | 2 +- linux/m68k/rt_sigframe.h | 4 +- linux/metag/raw_syscall.h | 2 +- linux/microblaze/raw_syscall.h | 2 +- linux/mips/raw_syscall.h | 2 +- linux/mips/rt_sigframe.h | 4 +- linux/netlink_diag.h | 24 +- linux/nios2/arch_regs.c | 2 +- linux/nios2/raw_syscall.h | 2 +- linux/or1k/raw_syscall.h | 2 +- linux/packet_diag.h | 24 +- linux/powerpc/arch_rt_sigframe.c | 2 +- linux/powerpc/raw_syscall.h | 2 +- linux/powerpc64/arch_rt_sigframe.c | 4 +- linux/riscv/raw_syscall.h | 2 +- linux/rt_sigframe.h | 4 +- linux/s390/raw_syscall.h | 2 +- linux/s390/rt_sigframe.h | 4 +- linux/sh/raw_syscall.h | 2 +- linux/sh64/rt_sigframe.h | 4 +- linux/smc_diag.h | 6 +- linux/sock_diag.h | 8 +- linux/sparc/raw_syscall.h | 2 +- linux/sparc/rt_sigframe.h | 8 +- linux/sparc64/arch_rt_sigframe.c | 2 +- linux/sparc64/raw_syscall.h | 2 +- linux/syscall.h | 12 +- linux/tile/raw_syscall.h | 2 +- linux/tile/rt_sigframe.h | 4 +- linux/unix_diag.h | 14 +- linux/x86_64/arch_get_personality.c | 6 +- linux/x86_64/asm_stat.h | 2 +- linux/x86_64/get_scno.c | 4 +- linux/x86_64/raw_syscall.h | 2 +- linux/xtensa/raw_syscall.h | 2 +- loop.c | 2 +- lseek.c | 4 +- macros.h | 44 +- mmap_cache.h | 2 +- mmap_notify.h | 4 +- mpers_type.h | 38 +- msghdr.h | 2 +- nbd_ioctl.c | 2 +- negated_errno.h | 6 +- net.c | 4 +- netlink.h | 72 ++-- netlink_kobject_uevent.h | 2 +- netlink_route.h | 4 +- netlink_smc_diag.c | 2 +- netlink_sock_diag.h | 6 +- nlattr.h | 6 +- nsfs.h | 30 +- nsig.h | 18 +- number_set.h | 4 +- or1k_atomic.c | 22 +- perf.c | 2 +- perf_event_struct.h | 4 +- perf_ioctl.c | 2 +- print_fields.h | 78 ++-- print_sg_req_info.c | 2 +- printsiginfo.c | 2 +- printsiginfo.h | 2 +- process.c | 12 +- ptrace.h | 278 ++++++------- ptrace_syscall_info.h | 2 +- random_ioctl.c | 2 +- regs.h | 6 +- retval.h | 2 +- rt_sigframe.c | 4 +- rtnl_link.c | 4 +- rtnl_neightbl.c | 4 +- s390.c | 28 +- sched_attr.h | 2 +- sg_io_v3.c | 4 +- sg_io_v4.c | 2 +- sigevent.h | 2 +- signal.c | 4 +- sock.c | 2 +- socketutils.c | 2 +- sram_alloc.c | 4 +- stat.h | 2 +- statfs.h | 2 +- static_assert.h | 18 +- statx.h | 4 +- strace.c | 4 +- string_to_uint.h | 6 +- syscall.c | 26 +- sysent.h | 42 +- sysmips.c | 24 +- test/skodic.c | 2 +- test/threaded_execve.c | 6 +- tests/accept_compat.h | 16 +- tests/bpf-obj_get_info_by_fd.c | 4 +- tests/btrfs.c | 194 ++++----- tests/chmod.c | 8 +- tests/execveat.c | 64 +-- tests/fadvise.h | 2 +- tests/fanotify_mark.c | 86 ++-- tests/fcntl.c | 2 +- tests/file_handle.c | 4 +- tests/getgroups.c | 2 +- tests/group_req.c | 4 +- tests/init_delete_module.h | 2 +- tests/ioctl.c | 4 +- tests/ioctl_dm.c | 10 +- tests/ioctl_evdev.c | 10 +- tests/ioctl_kvm_run_common.c | 34 +- tests/ioctl_loop.c | 2 +- tests/ioctl_nbd.c | 4 +- tests/ioctl_perf.c | 2 +- tests/ioctl_ptp.c | 22 +- tests/ioctl_random.c | 2 +- tests/ioctl_uffdio.c | 4 +- tests/ioctl_v4l2.c | 14 +- tests/ip_mreq.c | 6 +- tests/ipc_shm.c | 6 +- tests/kexec_file_load.c | 2 +- tests/keyctl.c | 70 ++-- tests/libsocketcall.c | 4 +- tests/mmsg_name.c | 4 +- tests/modify_ldt.c | 6 +- tests/mq_sendrecv.c | 4 +- tests/net-sockaddr.c | 24 +- tests/netlink_protocol.c | 20 +- tests/nlattr_crypto_user_alg.c | 20 +- tests/nlattr_fib_rule_hdr.c | 22 +- tests/nlattr_ifinfomsg.c | 8 +- tests/nlattr_ifla.h | 10 +- tests/nlattr_ifla_af_spec.c | 4 +- tests/nlattr_ifla_linkinfo.c | 4 +- tests/nlattr_ndtmsg.c | 8 +- tests/nlattr_tc_stats.c | 12 +- tests/oldselect-efault.c | 8 +- tests/openat.c | 10 +- tests/perf_event_open.c | 120 +++--- tests/perf_event_open_nonverbose.c | 10 +- tests/poll.c | 34 +- tests/prctl-seccomp-filter-v.c | 10 +- tests/preadv2-pwritev2.c | 12 +- tests/quotactl.c | 56 +-- tests/quotactl.h | 6 +- tests/remap_file_pages.c | 36 +- tests/restart_syscall.c | 10 +- tests/rt_sigpending.c | 4 +- tests/seccomp-filter-v.c | 10 +- tests/sethostname.c | 12 +- tests/sigaction.c | 50 +-- tests/sigsuspend.c | 6 +- tests/stack-fcall.h | 8 +- tests/tests.h | 126 +++--- tests/timer_create.c | 6 +- tests/utimensat.c | 2 +- tests/xstatx.c | 22 +- trace_event.h | 2 +- unwind.h | 4 +- userfaultfd.c | 2 +- util.c | 14 +- v4l2.c | 4 +- wait.h | 40 +- xlat.h | 12 +- xlat/mmap_flags.in | 8 +- xlat/open_mode_flags.in | 4 +- xmalloc.h | 10 +- xstring.h | 16 +- 204 files changed, 1994 insertions(+), 1994 deletions(-) mode change 100755 => 100644 static_assert.h diff --git a/arch_defs.h b/arch_defs.h index 19ca4a85..40e675f3 100644 --- a/arch_defs.h +++ b/arch_defs.h @@ -7,9 +7,9 @@ /* Architecture-specific definitions. */ #ifndef STRACE_ARCH_DEFS_H -#define STRACE_ARCH_DEFS_H +# define STRACE_ARCH_DEFS_H -#include "arch_defs_.h" -#include "linux/arch_defs_.h" +# include "arch_defs_.h" +# include "linux/arch_defs_.h" #endif /* !STRACE_ARCH_DEFS_H */ diff --git a/block.c b/block.c index af0945fc..893269d0 100644 --- a/block.c +++ b/block.c @@ -47,7 +47,7 @@ typedef struct blk_user_trace_setup { /* Provide fall-back definitions for BLK* ioctls */ #define XLAT_MACROS_ONLY -# include "xlat/block_ioctl_cmds.h" +#include "xlat/block_ioctl_cmds.h" #undef XLAT_MACROS_ONLY #include MPERS_DEFS diff --git a/bpf_attr.h b/bpf_attr.h index 925221df..dc7694cc 100644 --- a/bpf_attr.h +++ b/bpf_attr.h @@ -6,7 +6,7 @@ */ #ifndef STRACE_BPF_ATTR_H -#define STRACE_BPF_ATTR_H +# define STRACE_BPF_ATTR_H /* * The policy is that all fields of type uint64_t in this header file @@ -19,21 +19,21 @@ * v4.16-rc1~123^2~109^2~5^2~4. */ -#ifndef BPF_OBJ_NAME_LEN -# define BPF_OBJ_NAME_LEN 16U -#else -# if BPF_OBJ_NAME_LEN != 16U -# error "Unexpected value of BPF_OBJ_NAME_LEN" +# ifndef BPF_OBJ_NAME_LEN +# define BPF_OBJ_NAME_LEN 16U +# else +# if BPF_OBJ_NAME_LEN != 16U +# error "Unexpected value of BPF_OBJ_NAME_LEN" +# endif # endif -#endif -#ifndef BPF_TAG_SIZE -# define BPF_TAG_SIZE 8 -#else -# if BPF_TAG_SIZE != 8 -# error "Unexpected value of BPF_TAG_SIZE" +# ifndef BPF_TAG_SIZE +# define BPF_TAG_SIZE 8 +# else +# if BPF_TAG_SIZE != 8 +# error "Unexpected value of BPF_TAG_SIZE" +# endif # endif -#endif struct BPF_MAP_CREATE_struct { uint32_t map_type; @@ -47,9 +47,9 @@ struct BPF_MAP_CREATE_struct { uint32_t map_ifindex; }; -#define BPF_MAP_CREATE_struct_size \ +# define BPF_MAP_CREATE_struct_size \ sizeof(struct BPF_MAP_CREATE_struct) -#define expected_BPF_MAP_CREATE_struct_size 48 +# define expected_BPF_MAP_CREATE_struct_size 48 struct BPF_MAP_LOOKUP_ELEM_struct { uint32_t map_fd; @@ -57,9 +57,9 @@ struct BPF_MAP_LOOKUP_ELEM_struct { uint64_t ATTRIBUTE_ALIGNED(8) value; }; -#define BPF_MAP_LOOKUP_ELEM_struct_size \ +# define BPF_MAP_LOOKUP_ELEM_struct_size \ sizeof(struct BPF_MAP_LOOKUP_ELEM_struct) -#define expected_BPF_MAP_LOOKUP_ELEM_struct_size 24 +# define expected_BPF_MAP_LOOKUP_ELEM_struct_size 24 struct BPF_MAP_UPDATE_ELEM_struct { uint32_t map_fd; @@ -68,18 +68,18 @@ struct BPF_MAP_UPDATE_ELEM_struct { uint64_t ATTRIBUTE_ALIGNED(8) flags; }; -#define BPF_MAP_UPDATE_ELEM_struct_size \ +# define BPF_MAP_UPDATE_ELEM_struct_size \ sizeof(struct BPF_MAP_UPDATE_ELEM_struct) -#define expected_BPF_MAP_UPDATE_ELEM_struct_size 32 +# define expected_BPF_MAP_UPDATE_ELEM_struct_size 32 struct BPF_MAP_DELETE_ELEM_struct { uint32_t map_fd; uint64_t ATTRIBUTE_ALIGNED(8) key; }; -#define BPF_MAP_DELETE_ELEM_struct_size \ +# define BPF_MAP_DELETE_ELEM_struct_size \ sizeof(struct BPF_MAP_DELETE_ELEM_struct) -#define expected_BPF_MAP_DELETE_ELEM_struct_size 16 +# define expected_BPF_MAP_DELETE_ELEM_struct_size 16 struct BPF_MAP_GET_NEXT_KEY_struct { uint32_t map_fd; @@ -87,9 +87,9 @@ struct BPF_MAP_GET_NEXT_KEY_struct { uint64_t ATTRIBUTE_ALIGNED(8) next_key; }; -#define BPF_MAP_GET_NEXT_KEY_struct_size \ +# define BPF_MAP_GET_NEXT_KEY_struct_size \ sizeof(struct BPF_MAP_GET_NEXT_KEY_struct) -#define expected_BPF_MAP_GET_NEXT_KEY_struct_size 24 +# define expected_BPF_MAP_GET_NEXT_KEY_struct_size 24 struct BPF_PROG_LOAD_struct { uint32_t prog_type; @@ -106,9 +106,9 @@ struct BPF_PROG_LOAD_struct { uint32_t expected_attach_type; }; -#define BPF_PROG_LOAD_struct_size \ +# define BPF_PROG_LOAD_struct_size \ offsetofend(struct BPF_PROG_LOAD_struct, expected_attach_type) -#define expected_BPF_PROG_LOAD_struct_size 72 +# define expected_BPF_PROG_LOAD_struct_size 72 struct BPF_OBJ_PIN_struct { uint64_t ATTRIBUTE_ALIGNED(8) pathname; @@ -116,12 +116,12 @@ struct BPF_OBJ_PIN_struct { uint32_t file_flags; }; -#define BPF_OBJ_PIN_struct_size \ +# define BPF_OBJ_PIN_struct_size \ sizeof(struct BPF_OBJ_PIN_struct) -#define expected_BPF_OBJ_PIN_struct_size 16 +# define expected_BPF_OBJ_PIN_struct_size 16 -#define BPF_OBJ_GET_struct BPF_OBJ_PIN_struct -#define BPF_OBJ_GET_struct_size BPF_OBJ_PIN_struct_size +# define BPF_OBJ_GET_struct BPF_OBJ_PIN_struct +# define BPF_OBJ_GET_struct_size BPF_OBJ_PIN_struct_size struct BPF_PROG_ATTACH_struct { uint32_t target_fd; @@ -130,9 +130,9 @@ struct BPF_PROG_ATTACH_struct { uint32_t attach_flags; }; -#define BPF_PROG_ATTACH_struct_size \ +# define BPF_PROG_ATTACH_struct_size \ sizeof(struct BPF_PROG_ATTACH_struct) -#define expected_BPF_PROG_ATTACH_struct_size 16 +# define expected_BPF_PROG_ATTACH_struct_size 16 struct BPF_PROG_DETACH_struct { uint32_t target_fd; @@ -140,9 +140,9 @@ struct BPF_PROG_DETACH_struct { uint32_t attach_type; }; -#define BPF_PROG_DETACH_struct_size \ +# define BPF_PROG_DETACH_struct_size \ sizeof(struct BPF_PROG_DETACH_struct) -#define expected_BPF_PROG_DETACH_struct_size 12 +# define expected_BPF_PROG_DETACH_struct_size 12 struct BPF_PROG_TEST_RUN_struct /* test */ { uint32_t prog_fd; @@ -155,9 +155,9 @@ struct BPF_PROG_TEST_RUN_struct /* test */ { uint32_t duration; }; -#define BPF_PROG_TEST_RUN_struct_size \ +# define BPF_PROG_TEST_RUN_struct_size \ sizeof(struct BPF_PROG_TEST_RUN_struct) -#define expected_BPF_PROG_TEST_RUN_struct_size 40 +# define expected_BPF_PROG_TEST_RUN_struct_size 40 struct BPF_PROG_GET_NEXT_ID_struct { uint32_t start_id; @@ -165,12 +165,12 @@ struct BPF_PROG_GET_NEXT_ID_struct { uint32_t open_flags; }; -#define BPF_PROG_GET_NEXT_ID_struct_size \ +# define BPF_PROG_GET_NEXT_ID_struct_size \ sizeof(struct BPF_PROG_GET_NEXT_ID_struct) -#define expected_BPF_PROG_GET_NEXT_ID_struct_size 12 +# define expected_BPF_PROG_GET_NEXT_ID_struct_size 12 -#define BPF_MAP_GET_NEXT_ID_struct BPF_PROG_GET_NEXT_ID_struct -#define BPF_MAP_GET_NEXT_ID_struct_size BPF_PROG_GET_NEXT_ID_struct_size +# define BPF_MAP_GET_NEXT_ID_struct BPF_PROG_GET_NEXT_ID_struct +# define BPF_MAP_GET_NEXT_ID_struct_size BPF_PROG_GET_NEXT_ID_struct_size struct BPF_PROG_GET_FD_BY_ID_struct { uint32_t prog_id; @@ -178,9 +178,9 @@ struct BPF_PROG_GET_FD_BY_ID_struct { uint32_t open_flags; }; -#define BPF_PROG_GET_FD_BY_ID_struct_size \ +# define BPF_PROG_GET_FD_BY_ID_struct_size \ sizeof(struct BPF_PROG_GET_FD_BY_ID_struct) -#define expected_BPF_PROG_GET_FD_BY_ID_struct_size 12 +# define expected_BPF_PROG_GET_FD_BY_ID_struct_size 12 struct BPF_MAP_GET_FD_BY_ID_struct { uint32_t map_id; @@ -188,9 +188,9 @@ struct BPF_MAP_GET_FD_BY_ID_struct { uint32_t open_flags; }; -#define BPF_MAP_GET_FD_BY_ID_struct_size \ +# define BPF_MAP_GET_FD_BY_ID_struct_size \ sizeof(struct BPF_MAP_GET_FD_BY_ID_struct) -#define expected_BPF_MAP_GET_FD_BY_ID_struct_size 12 +# define expected_BPF_MAP_GET_FD_BY_ID_struct_size 12 struct BPF_OBJ_GET_INFO_BY_FD_struct /* info */ { uint32_t bpf_fd; @@ -198,9 +198,9 @@ struct BPF_OBJ_GET_INFO_BY_FD_struct /* info */ { uint64_t ATTRIBUTE_ALIGNED(8) info; }; -#define BPF_OBJ_GET_INFO_BY_FD_struct_size \ +# define BPF_OBJ_GET_INFO_BY_FD_struct_size \ sizeof(struct BPF_OBJ_GET_INFO_BY_FD_struct) -#define expected_BPF_OBJ_GET_INFO_BY_FD_struct_size 16 +# define expected_BPF_OBJ_GET_INFO_BY_FD_struct_size 16 struct BPF_PROG_QUERY_struct /* query */ { uint32_t target_fd; @@ -211,18 +211,18 @@ struct BPF_PROG_QUERY_struct /* query */ { uint32_t prog_cnt; }; -#define BPF_PROG_QUERY_struct_size \ +# define BPF_PROG_QUERY_struct_size \ offsetofend(struct BPF_PROG_QUERY_struct, prog_cnt) -#define expected_BPF_PROG_QUERY_struct_size 28 +# define expected_BPF_PROG_QUERY_struct_size 28 struct BPF_RAW_TRACEPOINT_OPEN_struct /* raw_tracepoint */ { uint64_t ATTRIBUTE_ALIGNED(8) name; uint32_t prog_fd; }; -#define BPF_RAW_TRACEPOINT_OPEN_struct_size \ +# define BPF_RAW_TRACEPOINT_OPEN_struct_size \ offsetofend(struct BPF_RAW_TRACEPOINT_OPEN_struct, prog_fd) -#define expected_BPF_RAW_TRACEPOINT_OPEN_struct_size 12 +# define expected_BPF_RAW_TRACEPOINT_OPEN_struct_size 12 struct bpf_map_info_struct { uint32_t type; @@ -241,9 +241,9 @@ struct bpf_map_info_struct { uint64_t ATTRIBUTE_ALIGNED(8) netns_ino; /* skip check */ }; -#define bpf_map_info_struct_size \ +# define bpf_map_info_struct_size \ sizeof(struct bpf_map_info_struct) -#define expected_bpf_map_info_struct_size 64 +# define expected_bpf_map_info_struct_size 64 struct bpf_prog_info_struct { uint32_t type; @@ -267,8 +267,8 @@ struct bpf_prog_info_struct { uint64_t ATTRIBUTE_ALIGNED(8) netns_ino; /* skip check */ }; -#define bpf_prog_info_struct_size \ +# define bpf_prog_info_struct_size \ sizeof(struct bpf_prog_info_struct) -#define expected_bpf_prog_info_struct_size 104 +# define expected_bpf_prog_info_struct_size 104 #endif /* !STRACE_BPF_ATTR_H */ diff --git a/bpf_filter.h b/bpf_filter.h index 23ae5b64..b19384f8 100644 --- a/bpf_filter.h +++ b/bpf_filter.h @@ -8,7 +8,7 @@ */ #ifndef STRACE_BPF_FILTER_H -#define STRACE_BPF_FILTER_H +# define STRACE_BPF_FILTER_H struct bpf_filter_block { uint16_t code; diff --git a/bpf_fprog.h b/bpf_fprog.h index ebf2d1ba..3321531e 100644 --- a/bpf_fprog.h +++ b/bpf_fprog.h @@ -6,7 +6,7 @@ */ #ifndef STRACE_BPF_FPROG_H -#define STRACE_BPF_FPROG_H +# define STRACE_BPF_FPROG_H struct bpf_fprog { unsigned short len; diff --git a/btrfs.c b/btrfs.c index 4d809018..f3f9b920 100644 --- a/btrfs.c +++ b/btrfs.c @@ -10,10 +10,10 @@ #ifdef HAVE_LINUX_BTRFS_H -#include DEF_MPERS_TYPE(struct_btrfs_ioctl_dev_replace_args) -#include DEF_MPERS_TYPE(struct_btrfs_ioctl_send_args) -#include DEF_MPERS_TYPE(struct_btrfs_ioctl_received_subvol_args) -#include DEF_MPERS_TYPE(struct_btrfs_ioctl_vol_args_v2) +# include DEF_MPERS_TYPE(struct_btrfs_ioctl_dev_replace_args) +# include DEF_MPERS_TYPE(struct_btrfs_ioctl_send_args) +# include DEF_MPERS_TYPE(struct_btrfs_ioctl_received_subvol_args) +# include DEF_MPERS_TYPE(struct_btrfs_ioctl_vol_args_v2) # include @@ -32,8 +32,8 @@ typedef struct btrfs_ioctl_vol_args_v2 #ifdef HAVE_LINUX_BTRFS_H -#include "print_fields.h" -#include +# include "print_fields.h" +# include /* * Prior to Linux 3.12, the BTRFS_IOC_DEFAULT_SUBVOL used u64 in @@ -41,15 +41,15 @@ typedef struct btrfs_ioctl_vol_args_v2 */ typedef __u64 u64; -#ifndef HAVE_STRUCT_BTRFS_IOCTL_FEATURE_FLAGS_COMPAT_FLAGS +# ifndef HAVE_STRUCT_BTRFS_IOCTL_FEATURE_FLAGS_COMPAT_FLAGS struct btrfs_ioctl_feature_flags { uint64_t compat_flags; uint64_t compat_ro_flags; uint64_t incompat_flags; }; -#endif +# endif -#ifndef HAVE_STRUCT_BTRFS_IOCTL_DEFRAG_RANGE_ARGS_START +# ifndef HAVE_STRUCT_BTRFS_IOCTL_DEFRAG_RANGE_ARGS_START struct btrfs_ioctl_defrag_range_args { uint64_t start; uint64_t len; @@ -58,37 +58,37 @@ struct btrfs_ioctl_defrag_range_args { uint32_t compress_type; uint32_t unused[4]; }; -#endif +# endif -#ifndef BTRFS_LABEL_SIZE -# define BTRFS_LABEL_SIZE 256 -#endif +# ifndef BTRFS_LABEL_SIZE +# define BTRFS_LABEL_SIZE 256 +# endif -#ifndef BTRFS_IOC_QUOTA_RESCAN +# ifndef BTRFS_IOC_QUOTA_RESCAN struct btrfs_ioctl_quota_rescan_args { uint64_t flags, progress, reserved[6]; }; -# define BTRFS_IOC_QUOTA_RESCAN _IOW(BTRFS_IOCTL_MAGIC, 44, \ +# define BTRFS_IOC_QUOTA_RESCAN _IOW(BTRFS_IOCTL_MAGIC, 44, \ struct btrfs_ioctl_quota_rescan_args) -# define BTRFS_IOC_QUOTA_RESCAN_STATUS _IOR(BTRFS_IOCTL_MAGIC, 45, \ +# define BTRFS_IOC_QUOTA_RESCAN_STATUS _IOR(BTRFS_IOCTL_MAGIC, 45, \ struct btrfs_ioctl_quota_rescan_args) -#endif +# endif -#ifndef BTRFS_IOC_QUOTA_RESCAN_WAIT -# define BTRFS_IOC_QUOTA_RESCAN_WAIT _IO(BTRFS_IOCTL_MAGIC, 46) -#endif +# ifndef BTRFS_IOC_QUOTA_RESCAN_WAIT +# define BTRFS_IOC_QUOTA_RESCAN_WAIT _IO(BTRFS_IOCTL_MAGIC, 46) +# endif -#ifndef BTRFS_IOC_GET_FEATURES -# define BTRFS_IOC_GET_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \ +# ifndef BTRFS_IOC_GET_FEATURES +# define BTRFS_IOC_GET_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \ struct btrfs_ioctl_feature_flags) -# define BTRFS_IOC_SET_FEATURES _IOW(BTRFS_IOCTL_MAGIC, 57, \ +# define BTRFS_IOC_SET_FEATURES _IOW(BTRFS_IOCTL_MAGIC, 57, \ struct btrfs_ioctl_feature_flags[2]) -# define BTRFS_IOC_GET_SUPPORTED_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \ +# define BTRFS_IOC_GET_SUPPORTED_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \ struct btrfs_ioctl_feature_flags[3]) -#endif +# endif -#ifndef BTRFS_IOC_TREE_SEARCH_V2 -# define BTRFS_IOC_TREE_SEARCH_V2 _IOWR(BTRFS_IOCTL_MAGIC, 17, \ +# ifndef BTRFS_IOC_TREE_SEARCH_V2 +# define BTRFS_IOC_TREE_SEARCH_V2 _IOWR(BTRFS_IOCTL_MAGIC, 17, \ struct btrfs_ioctl_search_args_v2) struct btrfs_ioctl_search_args_v2 { struct btrfs_ioctl_search_key key; /* in/out - search parameters */ @@ -97,34 +97,34 @@ struct btrfs_ioctl_search_args_v2 { * to store item */ uint64_t buf[0]; /* out - found items */ }; -#endif - -#include "xlat/btrfs_balance_args.h" -#include "xlat/btrfs_balance_ctl_cmds.h" -#include "xlat/btrfs_balance_flags.h" -#include "xlat/btrfs_balance_state.h" -#include "xlat/btrfs_compress_types.h" -#include "xlat/btrfs_cont_reading_from_srcdev_mode.h" -#include "xlat/btrfs_defrag_flags.h" -#include "xlat/btrfs_dev_replace_cmds.h" -#include "xlat/btrfs_dev_replace_results.h" -#include "xlat/btrfs_dev_replace_state.h" -#include "xlat/btrfs_dev_stats_flags.h" -#include "xlat/btrfs_dev_stats_values.h" -#include "xlat/btrfs_features_compat.h" -#include "xlat/btrfs_features_compat_ro.h" -#include "xlat/btrfs_features_incompat.h" -#include "xlat/btrfs_key_types.h" -#include "xlat/btrfs_logical_ino_args_flags.h" -#include "xlat/btrfs_qgroup_ctl_cmds.h" -#include "xlat/btrfs_qgroup_inherit_flags.h" -#include "xlat/btrfs_qgroup_limit_flags.h" -#include "xlat/btrfs_qgroup_status_flags.h" -#include "xlat/btrfs_scrub_flags.h" -#include "xlat/btrfs_send_flags.h" -#include "xlat/btrfs_snap_flags_v2.h" -#include "xlat/btrfs_space_info_flags.h" -#include "xlat/btrfs_tree_objectids.h" +# endif + +# include "xlat/btrfs_balance_args.h" +# include "xlat/btrfs_balance_ctl_cmds.h" +# include "xlat/btrfs_balance_flags.h" +# include "xlat/btrfs_balance_state.h" +# include "xlat/btrfs_compress_types.h" +# include "xlat/btrfs_cont_reading_from_srcdev_mode.h" +# include "xlat/btrfs_defrag_flags.h" +# include "xlat/btrfs_dev_replace_cmds.h" +# include "xlat/btrfs_dev_replace_results.h" +# include "xlat/btrfs_dev_replace_state.h" +# include "xlat/btrfs_dev_stats_flags.h" +# include "xlat/btrfs_dev_stats_values.h" +# include "xlat/btrfs_features_compat.h" +# include "xlat/btrfs_features_compat_ro.h" +# include "xlat/btrfs_features_incompat.h" +# include "xlat/btrfs_key_types.h" +# include "xlat/btrfs_logical_ino_args_flags.h" +# include "xlat/btrfs_qgroup_ctl_cmds.h" +# include "xlat/btrfs_qgroup_inherit_flags.h" +# include "xlat/btrfs_qgroup_limit_flags.h" +# include "xlat/btrfs_qgroup_status_flags.h" +# include "xlat/btrfs_scrub_flags.h" +# include "xlat/btrfs_send_flags.h" +# include "xlat/btrfs_snap_flags_v2.h" +# include "xlat/btrfs_space_info_flags.h" +# include "xlat/btrfs_tree_objectids.h" static inline char prnibble(char v) @@ -135,7 +135,7 @@ prnibble(char v) } /* 8-4-4-4-12 = 36 characters */ -#define UUID_STRING_SIZE 36 +# define UUID_STRING_SIZE 36 /* Formats uuid, returns 0 if it's all zeroes */ static int @@ -222,9 +222,9 @@ btrfs_print_qgroup_limit(const struct btrfs_qgroup_limit *lim) tprints("}"); } -#define btrfs_print_key_type(prefix_, where_, field_) \ +# define btrfs_print_key_type(prefix_, where_, field_) \ PRINT_FIELD_XVAL_U((prefix_), (where_), field_, btrfs_key_types, NULL) -#define btrfs_print_objectid(prefix_, where_, field_) \ +# define btrfs_print_objectid(prefix_, where_, field_) \ PRINT_FIELD_XVAL_U((prefix_), (where_), field_, btrfs_tree_objectids, \ NULL) @@ -718,9 +718,9 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl, struct btrfs_ioctl_fs_info_args args; char uuid[UUID_STRING_SIZE+1]; uint32_t nodesize, sectorsize, clone_alignment; -#ifndef HAVE_STRUCT_BTRFS_IOCTL_FS_INFO_ARGS_NODESIZE +# ifndef HAVE_STRUCT_BTRFS_IOCTL_FS_INFO_ARGS_NODESIZE uint32_t *reserved32; -#endif +# endif if (entering(tcp)) return 0; @@ -729,16 +729,16 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl, if (umove_or_printaddr(tcp, arg, &args)) break; -#ifdef HAVE_STRUCT_BTRFS_IOCTL_FS_INFO_ARGS_NODESIZE +# ifdef HAVE_STRUCT_BTRFS_IOCTL_FS_INFO_ARGS_NODESIZE nodesize = args.nodesize, sectorsize = args.sectorsize, clone_alignment = args.clone_alignment; -#else +# else reserved32 = (void *) args.reserved; nodesize = reserved32[0]; sectorsize = reserved32[1]; clone_alignment = reserved32[2]; -#endif +# endif btrfs_unparse_uuid(args.fsid, uuid); PRINT_FIELD_U("{", args, max_id); @@ -892,11 +892,11 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl, tprintf(", flags="); printflags64(btrfs_logical_ino_args_flags, -#ifdef HAVE_STRUCT_BTRFS_IOCTL_LOGICAL_INO_ARGS_FLAGS +# ifdef HAVE_STRUCT_BTRFS_IOCTL_LOGICAL_INO_ARGS_FLAGS args.flags -#else +# else args.reserved[3] -#endif +# endif , "BTRFS_LOGICAL_INO_ARGS_???"); PRINT_FIELD_ADDR64(", ", args, inodes); tprints("}"); @@ -1262,9 +1262,9 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl, case BTRFS_IOC_CLONE: /* FICLONE */ case BTRFS_IOC_CLONE_RANGE: /* FICLONERANGE */ -#ifdef BTRFS_IOC_FILE_EXTENT_SAME +# ifdef BTRFS_IOC_FILE_EXTENT_SAME case BTRFS_IOC_FILE_EXTENT_SAME: /* FIDEDUPERANGE */ -#endif +# endif /* * FICLONE, FICLONERANGE, and FIDEDUPERANGE started out as * btrfs ioctls and the code was kept for the generic diff --git a/cacheflush.c b/cacheflush.c index 721af4ce..f38a3f91 100644 --- a/cacheflush.c +++ b/cacheflush.c @@ -20,15 +20,15 @@ # include "xlat/cacheflush_scope.h" static const struct xlat cacheflush_flags[] = { -#ifdef FLUSH_CACHE_BOTH +# ifdef FLUSH_CACHE_BOTH XLAT(FLUSH_CACHE_BOTH), -#endif -#ifdef FLUSH_CACHE_DATA +# endif +# ifdef FLUSH_CACHE_DATA XLAT(FLUSH_CACHE_DATA), -#endif -#ifdef FLUSH_CACHE_INSN +# endif +# ifdef FLUSH_CACHE_INSN XLAT(FLUSH_CACHE_INSN), -#endif +# endif XLAT_END }; @@ -72,18 +72,18 @@ SYS_FUNC(cacheflush) #ifdef SH static const struct xlat cacheflush_flags[] = { -#ifdef CACHEFLUSH_D_INVAL +# ifdef CACHEFLUSH_D_INVAL XLAT(CACHEFLUSH_D_INVAL), -#endif -#ifdef CACHEFLUSH_D_WB +# endif +# ifdef CACHEFLUSH_D_WB XLAT(CACHEFLUSH_D_WB), -#endif -#ifdef CACHEFLUSH_D_PURGE +# endif +# ifdef CACHEFLUSH_D_PURGE XLAT(CACHEFLUSH_D_PURGE), -#endif -#ifdef CACHEFLUSH_I +# endif +# ifdef CACHEFLUSH_I XLAT(CACHEFLUSH_I), -#endif +# endif XLAT_END }; diff --git a/defs.h b/defs.h index c9bca4ed..f8db6124 100644 --- a/defs.h +++ b/defs.h @@ -9,67 +9,67 @@ */ #ifndef STRACE_DEFS_H -#define STRACE_DEFS_H - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include +# define STRACE_DEFS_H + +# ifdef HAVE_CONFIG_H +# include "config.h" +# endif + +# include +# include +# include +# include +# include +# include +# include +# include +# include /* Open-coding isprint(ch) et al proved more efficient than calling * generalized libc interface. We don't *want* to do non-ASCII anyway. */ /* #include */ -#include -#include -#include -#include - -#include "arch_defs.h" -#include "error_prints.h" -#include "gcc_compat.h" -#include "kernel_types.h" -#include "macros.h" -#include "mpers_type.h" -#include "string_to_uint.h" -#include "sysent.h" -#include "xmalloc.h" - -#ifndef HAVE_STRERROR +# include +# include +# include +# include + +# include "arch_defs.h" +# include "error_prints.h" +# include "gcc_compat.h" +# include "kernel_types.h" +# include "macros.h" +# include "mpers_type.h" +# include "string_to_uint.h" +# include "sysent.h" +# include "xmalloc.h" + +# ifndef HAVE_STRERROR const char *strerror(int); -#endif -#ifndef HAVE_STPCPY +# endif +# ifndef HAVE_STPCPY /* Some libc have stpcpy, some don't. Sigh... * Roll our private implementation... */ -#undef stpcpy -#define stpcpy strace_stpcpy +# undef stpcpy +# define stpcpy strace_stpcpy extern char *stpcpy(char *dst, const char *src); -#endif +# endif /* Glibc has an efficient macro for sigemptyset * (it just does one or two assignments of 0 to internal vector of longs). */ -#if defined(__GLIBC__) && defined(__sigemptyset) && !defined(sigemptyset) -# define sigemptyset __sigemptyset -#endif +# if defined(__GLIBC__) && defined(__sigemptyset) && !defined(sigemptyset) +# define sigemptyset __sigemptyset +# endif /* Configuration section */ -#ifndef DEFAULT_STRLEN +# ifndef DEFAULT_STRLEN /* default maximum # of bytes printed in `printstr', change with -s switch */ -# define DEFAULT_STRLEN 32 -#endif -#ifndef DEFAULT_ACOLUMN -# define DEFAULT_ACOLUMN 40 /* default alignment column for results */ -#endif +# define DEFAULT_STRLEN 32 +# endif +# ifndef DEFAULT_ACOLUMN +# define DEFAULT_ACOLUMN 40 /* default alignment column for results */ +# endif /* * Maximum number of args to a syscall. * @@ -77,94 +77,94 @@ extern char *stpcpy(char *dst, const char *src); * linux//syscallent*.h: * all have nargs <= 6 except mips o32 which has nargs <= 7. */ -#ifndef MAX_ARGS -# ifdef LINUX_MIPSO32 -# define MAX_ARGS 7 -# else -# define MAX_ARGS 6 +# ifndef MAX_ARGS +# ifdef LINUX_MIPSO32 +# define MAX_ARGS 7 +# else +# define MAX_ARGS 6 +# endif # endif -#endif /* default sorting method for call profiling */ -#ifndef DEFAULT_SORTBY -# define DEFAULT_SORTBY "time" -#endif +# ifndef DEFAULT_SORTBY +# define DEFAULT_SORTBY "time" +# endif /* To force NOMMU build, set to 1 */ -#define NOMMU_SYSTEM 0 - -#ifndef ERESTARTSYS -# define ERESTARTSYS 512 -#endif -#ifndef ERESTARTNOINTR -# define ERESTARTNOINTR 513 -#endif -#ifndef ERESTARTNOHAND -# define ERESTARTNOHAND 514 -#endif -#ifndef ERESTART_RESTARTBLOCK -# define ERESTART_RESTARTBLOCK 516 -#endif - -#define PERSONALITY0_WORDSIZE SIZEOF_LONG -#define PERSONALITY0_KLONGSIZE SIZEOF_KERNEL_LONG_T -#define PERSONALITY0_INCLUDE_PRINTERS_DECLS "native_printer_decls.h" -#define PERSONALITY0_INCLUDE_PRINTERS_DEFS "native_printer_defs.h" - -#if SUPPORTED_PERSONALITIES > 1 -# define PERSONALITY1_WORDSIZE 4 -# define PERSONALITY1_KLONGSIZE PERSONALITY1_WORDSIZE -#endif - -#if SUPPORTED_PERSONALITIES > 2 -# define PERSONALITY2_WORDSIZE 4 -# define PERSONALITY2_KLONGSIZE PERSONALITY0_KLONGSIZE -#endif - -#if SUPPORTED_PERSONALITIES > 1 && defined HAVE_M32_MPERS -# define PERSONALITY1_INCLUDE_PRINTERS_DECLS "m32_printer_decls.h" -# define PERSONALITY1_INCLUDE_PRINTERS_DEFS "m32_printer_defs.h" -# define PERSONALITY1_INCLUDE_FUNCS "m32_funcs.h" -# define MPERS_m32_IOCTL_MACROS "ioctl_redefs1.h" -# define HAVE_PERSONALITY_1_MPERS 1 -#else -# define PERSONALITY1_INCLUDE_PRINTERS_DECLS "native_printer_decls.h" -# define PERSONALITY1_INCLUDE_PRINTERS_DEFS "native_printer_defs.h" -# define PERSONALITY1_INCLUDE_FUNCS "empty.h" -# define HAVE_PERSONALITY_1_MPERS 0 -#endif - -#if SUPPORTED_PERSONALITIES > 2 && defined HAVE_MX32_MPERS -# define PERSONALITY2_INCLUDE_FUNCS "mx32_funcs.h" -# define PERSONALITY2_INCLUDE_PRINTERS_DECLS "mx32_printer_decls.h" -# define PERSONALITY2_INCLUDE_PRINTERS_DEFS "mx32_printer_defs.h" -# define MPERS_mx32_IOCTL_MACROS "ioctl_redefs2.h" -# define HAVE_PERSONALITY_2_MPERS 1 -#else -# define PERSONALITY2_INCLUDE_PRINTERS_DECLS "native_printer_decls.h" -# define PERSONALITY2_INCLUDE_PRINTERS_DEFS "native_printer_defs.h" -# define PERSONALITY2_INCLUDE_FUNCS "empty.h" -# define HAVE_PERSONALITY_2_MPERS 0 -#endif - -#ifdef WORDS_BIGENDIAN -# define is_bigendian true -#else -# define is_bigendian false -#endif +# define NOMMU_SYSTEM 0 + +# ifndef ERESTARTSYS +# define ERESTARTSYS 512 +# endif +# ifndef ERESTARTNOINTR +# define ERESTARTNOINTR 513 +# endif +# ifndef ERESTARTNOHAND +# define ERESTARTNOHAND 514 +# endif +# ifndef ERESTART_RESTARTBLOCK +# define ERESTART_RESTARTBLOCK 516 +# endif + +# define PERSONALITY0_WORDSIZE SIZEOF_LONG +# define PERSONALITY0_KLONGSIZE SIZEOF_KERNEL_LONG_T +# define PERSONALITY0_INCLUDE_PRINTERS_DECLS "native_printer_decls.h" +# define PERSONALITY0_INCLUDE_PRINTERS_DEFS "native_printer_defs.h" + +# if SUPPORTED_PERSONALITIES > 1 +# define PERSONALITY1_WORDSIZE 4 +# define PERSONALITY1_KLONGSIZE PERSONALITY1_WORDSIZE +# endif + +# if SUPPORTED_PERSONALITIES > 2 +# define PERSONALITY2_WORDSIZE 4 +# define PERSONALITY2_KLONGSIZE PERSONALITY0_KLONGSIZE +# endif + +# if SUPPORTED_PERSONALITIES > 1 && defined HAVE_M32_MPERS +# define PERSONALITY1_INCLUDE_PRINTERS_DECLS "m32_printer_decls.h" +# define PERSONALITY1_INCLUDE_PRINTERS_DEFS "m32_printer_defs.h" +# define PERSONALITY1_INCLUDE_FUNCS "m32_funcs.h" +# define MPERS_m32_IOCTL_MACROS "ioctl_redefs1.h" +# define HAVE_PERSONALITY_1_MPERS 1 +# else +# define PERSONALITY1_INCLUDE_PRINTERS_DECLS "native_printer_decls.h" +# define PERSONALITY1_INCLUDE_PRINTERS_DEFS "native_printer_defs.h" +# define PERSONALITY1_INCLUDE_FUNCS "empty.h" +# define HAVE_PERSONALITY_1_MPERS 0 +# endif + +# if SUPPORTED_PERSONALITIES > 2 && defined HAVE_MX32_MPERS +# define PERSONALITY2_INCLUDE_FUNCS "mx32_funcs.h" +# define PERSONALITY2_INCLUDE_PRINTERS_DECLS "mx32_printer_decls.h" +# define PERSONALITY2_INCLUDE_PRINTERS_DEFS "mx32_printer_defs.h" +# define MPERS_mx32_IOCTL_MACROS "ioctl_redefs2.h" +# define HAVE_PERSONALITY_2_MPERS 1 +# else +# define PERSONALITY2_INCLUDE_PRINTERS_DECLS "native_printer_decls.h" +# define PERSONALITY2_INCLUDE_PRINTERS_DEFS "native_printer_defs.h" +# define PERSONALITY2_INCLUDE_FUNCS "empty.h" +# define HAVE_PERSONALITY_2_MPERS 0 +# endif + +# ifdef WORDS_BIGENDIAN +# define is_bigendian true +# else +# define is_bigendian false +# endif typedef struct ioctlent { const char *symbol; unsigned int code; } struct_ioctlent; -#define INJECT_F_SIGNAL 0x01 -#define INJECT_F_ERROR 0x02 -#define INJECT_F_RETVAL 0x04 -#define INJECT_F_DELAY_ENTER 0x08 -#define INJECT_F_DELAY_EXIT 0x10 -#define INJECT_F_SYSCALL 0x20 +# define INJECT_F_SIGNAL 0x01 +# define INJECT_F_ERROR 0x02 +# define INJECT_F_RETVAL 0x04 +# define INJECT_F_DELAY_ENTER 0x08 +# define INJECT_F_DELAY_EXIT 0x10 +# define INJECT_F_SYSCALL 0x20 -#define INJECT_ACTION_FLAGS \ +# define INJECT_ACTION_FLAGS \ (INJECT_F_SIGNAL \ |INJECT_F_ERROR \ |INJECT_F_RETVAL \ @@ -186,7 +186,7 @@ struct inject_opts { struct inject_data data; }; -#define MAX_ERRNO_VALUE 4095 +# define MAX_ERRNO_VALUE 4095 /* Trace Control Block */ struct tcb { @@ -197,9 +197,9 @@ struct tcb { kernel_ulong_t scno; /* System call number */ kernel_ulong_t u_arg[MAX_ARGS]; /* System call arguments */ kernel_long_t u_rval; /* Return value */ -#if SUPPORTED_PERSONALITIES > 1 +# if SUPPORTED_PERSONALITIES > 1 unsigned int currpers; /* Personality at the time of scno update */ -#endif +# endif int sys_func_rval; /* Syscall entry parser's return value */ int curcol; /* Output column for this process */ FILE *outf; /* Output file for this process */ @@ -216,20 +216,20 @@ struct tcb { struct mmap_cache_t *mmap_cache; -#ifdef HAVE_LINUX_KVM_H +# ifdef HAVE_LINUX_KVM_H struct vcpu_info *vcpu_info_list; -#endif +# endif -#ifdef ENABLE_STACKTRACE +# ifdef ENABLE_STACKTRACE void *unwind_ctx; struct unwind_queue_t *unwind_queue; -#endif +# endif }; /* TCB flags */ /* We have attached to this process, but did not see it stopping yet */ -#define TCB_STARTUP 0x01 -#define TCB_IGNORE_ONE_SIGSTOP 0x02 /* Next SIGSTOP is to be ignored */ +# define TCB_STARTUP 0x01 +# define TCB_IGNORE_ONE_SIGSTOP 0x02 /* Next SIGSTOP is to be ignored */ /* * Are we in system call entry or in syscall exit? * @@ -241,51 +241,51 @@ struct tcb { * Use entering(tcp) / exiting(tcp) to check this bit to make code more * readable. */ -#define TCB_INSYSCALL 0x04 -#define TCB_ATTACHED 0x08 /* We attached to it already */ -#define TCB_REPRINT 0x10 /* We should reprint this syscall on exit */ -#define TCB_FILTERED 0x20 /* This system call has been filtered out */ -#define TCB_TAMPERED 0x40 /* A syscall has been tampered with */ -#define TCB_HIDE_LOG 0x80 /* We should hide everything (until execve) */ -#define TCB_CHECK_EXEC_SYSCALL 0x100 /* Check whether this execve syscall succeeded */ -#define TCB_SKIP_DETACH_ON_FIRST_EXEC 0x200 /* -b execve should skip detach on first execve */ -#define TCB_GRABBED 0x400 /* We grab the process and can catch it +# define TCB_INSYSCALL 0x04 +# define TCB_ATTACHED 0x08 /* We attached to it already */ +# define TCB_REPRINT 0x10 /* We should reprint this syscall on exit */ +# define TCB_FILTERED 0x20 /* This system call has been filtered out */ +# define TCB_TAMPERED 0x40 /* A syscall has been tampered with */ +# define TCB_HIDE_LOG 0x80 /* We should hide everything (until execve) */ +# define TCB_CHECK_EXEC_SYSCALL 0x100 /* Check whether this execve syscall succeeded */ +# define TCB_SKIP_DETACH_ON_FIRST_EXEC 0x200 /* -b execve should skip detach on first execve */ +# define TCB_GRABBED 0x400 /* We grab the process and can catch it * in the middle of a syscall */ -#define TCB_RECOVERING 0x800 /* We try to recover after detecting incorrect +# define TCB_RECOVERING 0x800 /* We try to recover after detecting incorrect * syscall entering/exiting state */ -#define TCB_INJECT_DELAY_EXIT 0x1000 /* Current syscall needs to be delayed +# define TCB_INJECT_DELAY_EXIT 0x1000 /* Current syscall needs to be delayed on exit */ -#define TCB_DELAYED 0x2000 /* Current syscall has been delayed */ -#define TCB_TAMPERED_NO_FAIL 0x4000 /* We tamper tcb with syscall +# define TCB_DELAYED 0x2000 /* Current syscall has been delayed */ +# define TCB_TAMPERED_NO_FAIL 0x4000 /* We tamper tcb with syscall that should not fail. */ /* qualifier flags */ -#define QUAL_TRACE 0x001 /* this system call should be traced */ -#define QUAL_ABBREV 0x002 /* abbreviate the structures of this syscall */ -#define QUAL_VERBOSE 0x004 /* decode the structures of this syscall */ -#define QUAL_RAW 0x008 /* print all args in hex for this syscall */ -#define QUAL_INJECT 0x010 /* tamper with this system call on purpose */ - -#define DEFAULT_QUAL_FLAGS (QUAL_TRACE | QUAL_ABBREV | QUAL_VERBOSE) - -#define entering(tcp) (!((tcp)->flags & TCB_INSYSCALL)) -#define exiting(tcp) ((tcp)->flags & TCB_INSYSCALL) -#define syserror(tcp) ((tcp)->u_error != 0) -#define traced(tcp) ((tcp)->qual_flg & QUAL_TRACE) -#define verbose(tcp) ((tcp)->qual_flg & QUAL_VERBOSE) -#define abbrev(tcp) ((tcp)->qual_flg & QUAL_ABBREV) -#define raw(tcp) ((tcp)->qual_flg & QUAL_RAW) -#define inject(tcp) ((tcp)->qual_flg & QUAL_INJECT) -#define filtered(tcp) ((tcp)->flags & TCB_FILTERED) -#define hide_log(tcp) ((tcp)->flags & TCB_HIDE_LOG) -#define check_exec_syscall(tcp) ((tcp)->flags & TCB_CHECK_EXEC_SYSCALL) -#define syscall_tampered(tcp) ((tcp)->flags & TCB_TAMPERED) -#define recovering(tcp) ((tcp)->flags & TCB_RECOVERING) -#define inject_delay_exit(tcp) ((tcp)->flags & TCB_INJECT_DELAY_EXIT) -#define syscall_delayed(tcp) ((tcp)->flags & TCB_DELAYED) -#define syscall_tampered_nofail(tcp) ((tcp)->flags & TCB_TAMPERED_NO_FAIL) - -#include "xlat.h" +# define QUAL_TRACE 0x001 /* this system call should be traced */ +# define QUAL_ABBREV 0x002 /* abbreviate the structures of this syscall */ +# define QUAL_VERBOSE 0x004 /* decode the structures of this syscall */ +# define QUAL_RAW 0x008 /* print all args in hex for this syscall */ +# define QUAL_INJECT 0x010 /* tamper with this system call on purpose */ + +# define DEFAULT_QUAL_FLAGS (QUAL_TRACE | QUAL_ABBREV | QUAL_VERBOSE) + +# define entering(tcp) (!((tcp)->flags & TCB_INSYSCALL)) +# define exiting(tcp) ((tcp)->flags & TCB_INSYSCALL) +# define syserror(tcp) ((tcp)->u_error != 0) +# define traced(tcp) ((tcp)->qual_flg & QUAL_TRACE) +# define verbose(tcp) ((tcp)->qual_flg & QUAL_VERBOSE) +# define abbrev(tcp) ((tcp)->qual_flg & QUAL_ABBREV) +# define raw(tcp) ((tcp)->qual_flg & QUAL_RAW) +# define inject(tcp) ((tcp)->qual_flg & QUAL_INJECT) +# define filtered(tcp) ((tcp)->flags & TCB_FILTERED) +# define hide_log(tcp) ((tcp)->flags & TCB_HIDE_LOG) +# define check_exec_syscall(tcp) ((tcp)->flags & TCB_CHECK_EXEC_SYSCALL) +# define syscall_tampered(tcp) ((tcp)->flags & TCB_TAMPERED) +# define recovering(tcp) ((tcp)->flags & TCB_RECOVERING) +# define inject_delay_exit(tcp) ((tcp)->flags & TCB_INJECT_DELAY_EXIT) +# define syscall_delayed(tcp) ((tcp)->flags & TCB_DELAYED) +# define syscall_tampered_nofail(tcp) ((tcp)->flags & TCB_TAMPERED_NO_FAIL) + +# include "xlat.h" extern const struct xlat addrfams[]; @@ -338,24 +338,24 @@ extern const struct xlat tcp_states[]; extern const struct xlat whence_codes[]; /* Format of syscall return values */ -#define RVAL_UDECIMAL 000 /* unsigned decimal format */ -#define RVAL_HEX 001 /* hex format */ -#define RVAL_OCTAL 002 /* octal format */ -#define RVAL_FD 010 /* file descriptor */ -#define RVAL_MASK 013 /* mask for these values */ +# define RVAL_UDECIMAL 000 /* unsigned decimal format */ +# define RVAL_HEX 001 /* hex format */ +# define RVAL_OCTAL 002 /* octal format */ +# define RVAL_FD 010 /* file descriptor */ +# define RVAL_MASK 013 /* mask for these values */ -#define RVAL_STR 020 /* Print `auxstr' field after return val */ -#define RVAL_NONE 040 /* Print nothing */ +# define RVAL_STR 020 /* Print `auxstr' field after return val */ +# define RVAL_NONE 040 /* Print nothing */ -#define RVAL_DECODED 0100 /* syscall decoding finished */ -#define RVAL_IOCTL_DECODED 0200 /* ioctl sub-parser successfully decoded +# define RVAL_DECODED 0100 /* syscall decoding finished */ +# define RVAL_IOCTL_DECODED 0200 /* ioctl sub-parser successfully decoded the argument */ -#define IOCTL_NUMBER_UNKNOWN 0 -#define IOCTL_NUMBER_HANDLED 1 -#define IOCTL_NUMBER_STOP_LOOKUP 010 +# define IOCTL_NUMBER_UNKNOWN 0 +# define IOCTL_NUMBER_HANDLED 1 +# define IOCTL_NUMBER_STOP_LOOKUP 010 -#define indirect_ipccall(tcp) (tcp->s_ent->sys_flags & TRACE_INDIRECT_SUBCALL) +# define indirect_ipccall(tcp) (tcp->s_ent->sys_flags & TRACE_INDIRECT_SUBCALL) enum sock_proto { SOCK_PROTO_UNKNOWN, @@ -405,18 +405,18 @@ extern struct path_set { size_t num_selected; size_t size; } global_path_set; -#define tracing_paths (global_path_set.num_selected != 0) +# define tracing_paths (global_path_set.num_selected != 0) extern unsigned xflag; extern unsigned followfork; -#ifdef ENABLE_STACKTRACE +# ifdef ENABLE_STACKTRACE /* if this is true do the stack trace for every system call */ extern bool stack_trace_enabled; -#endif +# endif extern unsigned ptrace_setoptions; extern unsigned max_strlen; extern unsigned os_release; -#undef KERNEL_VERSION -#define KERNEL_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c)) +# undef KERNEL_VERSION +# define KERNEL_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c)) extern int read_int_from_file(struct tcb *, const char *, int *); @@ -495,7 +495,7 @@ static inline int set_tcb_priv_ulong(struct tcb *tcp, unsigned long val) */ extern int umoven(struct tcb *, kernel_ulong_t addr, unsigned int len, void *laddr); -#define umove(pid, addr, objp) \ +# define umove(pid, addr, objp) \ umoven((pid), (addr), sizeof(*(objp)), (void *) (objp)) /** @@ -510,7 +510,7 @@ tfetch_mem(struct tcb *tcp, const kernel_ulong_t addr, { return tfetch_mem64(tcp, addr, len, laddr); } -#define tfetch_obj(pid, addr, objp) \ +# define tfetch_obj(pid, addr, objp) \ tfetch_mem((pid), (addr), sizeof(*(objp)), (void *) (objp)) /** @@ -533,7 +533,7 @@ tfetch_mem_ignore_syserror(struct tcb *tcp, const kernel_ulong_t addr, extern int umoven_or_printaddr64(struct tcb *, uint64_t addr, unsigned int len, void *laddr); -#define umove_or_printaddr64(pid, addr, objp) \ +# define umove_or_printaddr64(pid, addr, objp) \ umoven_or_printaddr64((pid), (addr), sizeof(*(objp)), (void *) (objp)) static inline int @@ -542,7 +542,7 @@ umoven_or_printaddr(struct tcb *tcp, const kernel_ulong_t addr, { return umoven_or_printaddr64(tcp, addr, len, laddr); } -#define umove_or_printaddr(pid, addr, objp) \ +# define umove_or_printaddr(pid, addr, objp) \ umoven_or_printaddr((pid), (addr), sizeof(*(objp)), (void *) (objp)) /** @@ -551,7 +551,7 @@ umoven_or_printaddr(struct tcb *tcp, const kernel_ulong_t addr, extern int umoven_or_printaddr64_ignore_syserror(struct tcb *, uint64_t addr, unsigned int len, void *laddr); -#define umove_or_printaddr64_ignore_syserror(pid, addr, objp) \ +# define umove_or_printaddr64_ignore_syserror(pid, addr, objp) \ umoven_or_printaddr64_ignore_syserror((pid), (addr), sizeof(*(objp)), \ (void *) (objp)) @@ -561,7 +561,7 @@ umoven_or_printaddr_ignore_syserror(struct tcb *tcp, const kernel_ulong_t addr, { return umoven_or_printaddr64_ignore_syserror(tcp, addr, len, laddr); } -#define umove_or_printaddr_ignore_syserror(pid, addr, objp) \ +# define umove_or_printaddr_ignore_syserror(pid, addr, objp) \ umoven_or_printaddr_ignore_syserror((pid), (addr), sizeof(*(objp)), \ (void *) (objp)) @@ -574,9 +574,9 @@ umovestr(struct tcb *, kernel_ulong_t addr, unsigned int len, char *laddr); extern int upeek(struct tcb *tcp, unsigned long, kernel_ulong_t *); extern int upoke(struct tcb *tcp, unsigned long, kernel_ulong_t); -#if HAVE_ARCH_GETRVAL2 +# if HAVE_ARCH_GETRVAL2 extern long getrval2(struct tcb *); -#endif +# endif extern const char *signame(const int); extern const char *sprintsigname(const int); @@ -625,14 +625,14 @@ str_strip_prefix_len(const char *str, const char *prefix, size_t prefix_len) return strncmp(str, prefix, prefix_len) ? str : str + prefix_len; } -#define STR_STRIP_PREFIX(str, prefix) \ +# define STR_STRIP_PREFIX(str, prefix) \ str_strip_prefix_len((str), (prefix), sizeof(prefix) - 1) -#define QUOTE_0_TERMINATED 0x01 -#define QUOTE_OMIT_LEADING_TRAILING_QUOTES 0x02 -#define QUOTE_OMIT_TRAILING_0 0x08 -#define QUOTE_FORCE_HEX 0x10 -#define QUOTE_EMIT_COMMENT 0x20 +# define QUOTE_0_TERMINATED 0x01 +# define QUOTE_OMIT_LEADING_TRAILING_QUOTES 0x02 +# define QUOTE_OMIT_TRAILING_0 0x08 +# define QUOTE_FORCE_HEX 0x10 +# define QUOTE_EMIT_COMMENT 0x20 extern int string_quote(const char *, char *, unsigned int, unsigned int, const char *escape_chars); @@ -644,13 +644,13 @@ extern int print_quoted_cstring(const char *, unsigned int); /* a refers to the lower numbered u_arg, * b refers to the higher numbered u_arg */ -#ifdef WORDS_BIGENDIAN -# define ULONG_LONG(a, b) \ +# ifdef WORDS_BIGENDIAN +# define ULONG_LONG(a, b) \ ((unsigned long long)(unsigned)(b) | ((unsigned long long)(a)<<32)) -#else -# define ULONG_LONG(a, b) \ +# else +# define ULONG_LONG(a, b) \ ((unsigned long long)(unsigned)(a) | ((unsigned long long)(b)<<32)) -#endif +# endif extern int getllval(struct tcb *, unsigned long long *, int); extern int printllval(struct tcb *, const char *, int) ATTRIBUTE_FORMAT((printf, 2, 0)); @@ -663,15 +663,15 @@ printaddr(const kernel_ulong_t addr) printaddr64(addr); } -#define xlat_verbose(style_) ((style_) & XLAT_STYLE_VERBOSITY_MASK) -#define xlat_format(style_) ((style_) & XLAT_STYLE_FORMAT_MASK) +# define xlat_verbose(style_) ((style_) & XLAT_STYLE_VERBOSITY_MASK) +# define xlat_format(style_) ((style_) & XLAT_STYLE_FORMAT_MASK) extern enum xlat_style xlat_verbosity; extern int printxvals_ex(uint64_t val, const char *dflt, enum xlat_style, const struct xlat *, ...) ATTRIBUTE_SENTINEL; -#define printxvals(val_, dflt_, ...) \ +# define printxvals(val_, dflt_, ...) \ printxvals_ex((val_), (dflt_), XLAT_STYLE_DEFAULT, __VA_ARGS__) extern int printxval_searchn_ex(const struct xlat *, size_t xlat_size, @@ -691,9 +691,9 @@ printxval_searchn(const struct xlat *xlat, size_t xlat_size, uint64_t val, * as the array size, as all arrays are XLAT_END-terminated and * printxval_searchn expects a size without the terminating record. */ -#define printxval_search(xlat__, val__, dflt__) \ +# define printxval_search(xlat__, val__, dflt__) \ printxval_searchn(xlat__, ARRAY_SIZE(xlat__) - 1, val__, dflt__) -#define printxval_search_ex(xlat__, val__, dflt__, style__) \ +# define printxval_search_ex(xlat__, val__, dflt__, style__) \ printxval_searchn_ex((xlat__), ARRAY_SIZE(xlat__) - 1, (val__), \ (dflt__), (style__)) @@ -708,9 +708,9 @@ printxval_indexn(const struct xlat *xlat, size_t xlat_size, uint64_t val, XLAT_STYLE_DEFAULT); } -#define printxval_index(xlat__, val__, dflt__) \ +# define printxval_index(xlat__, val__, dflt__) \ printxval_indexn(xlat__, ARRAY_SIZE(xlat__) - 1, val__, dflt__) -#define printxval_index_ex(xlat__, val__, dflt__) \ +# define printxval_index_ex(xlat__, val__, dflt__) \ printxval_indexn_ex((xlat__), ARRAY_SIZE(xlat__) - 1, (val__), \ (dflt__), XLAT_STYLE_DEFAULT) @@ -745,7 +745,7 @@ enum xlat_style_private_flag_bits { PXF_DEFAULT_STR_BIT, }; -#define FLAG_(name_) name_ = 1 << name_##_BIT +# define FLAG_(name_) name_ = 1 << name_##_BIT enum xlat_style_private_flags { /* print_array */ @@ -757,17 +757,17 @@ enum xlat_style_private_flags { FLAG_(PXF_DEFAULT_STR), }; -#undef FLAG_ +# undef FLAG_ /** Print a value in accordance with xlat formatting settings. */ extern void print_xlat_ex(uint64_t val, const char *str, enum xlat_style style); -#define print_xlat(val_) \ +# define print_xlat(val_) \ print_xlat_ex((val_), #val_, XLAT_STYLE_DEFAULT) -#define print_xlat32(val_) \ +# define print_xlat32(val_) \ print_xlat_ex((uint32_t) (val_), #val_, XLAT_STYLE_DEFAULT) -#define print_xlat_u(val_) \ +# define print_xlat_u(val_) \ print_xlat_ex((val_), #val_, XLAT_STYLE_FMT_U) -#define print_xlat_d(val_) \ +# define print_xlat_d(val_) \ print_xlat_ex((val_), #val_, XLAT_STYLE_FMT_D) extern int printargs(struct tcb *); @@ -870,7 +870,7 @@ printpathn(struct tcb *, kernel_ulong_t addr, unsigned int n); extern int printpath(struct tcb *, kernel_ulong_t addr); -#define TIMESPEC_TEXT_BUFSIZE \ +# define TIMESPEC_TEXT_BUFSIZE \ (sizeof(long long) * 3 * 2 + sizeof("{tv_sec=-, tv_nsec=}")) extern void printfd(struct tcb *, int); extern void print_sockaddr(const void *sa, int len); @@ -896,7 +896,7 @@ extern void print_sigset_addr(struct tcb *, kernel_ulong_t addr); extern const char *sprintsigmask_n(const char *, const void *, unsigned int); -#define tprintsigmask_addr(prefix, mask) \ +# define tprintsigmask_addr(prefix, mask) \ tprints(sprintsigmask_n((prefix), (mask), sizeof(mask))) extern void printsignal(int); @@ -947,7 +947,7 @@ extern void print_bpf_filter_code(const uint16_t code, bool extended); extern void qualify(const char *); extern unsigned int qual_flags(const unsigned int); -#define DECL_IOCTL(name) \ +# define DECL_IOCTL(name) \ extern int \ name ## _ioctl(struct tcb *, unsigned int request, kernel_ulong_t arg) \ /* End of DECL_IOCTL definition. */ @@ -966,7 +966,7 @@ DECL_IOCTL(scsi); DECL_IOCTL(term); DECL_IOCTL(ubi); DECL_IOCTL(uffdio); -#undef DECL_IOCTL +# undef DECL_IOCTL extern int decode_sg_io_v4(struct tcb *, const kernel_ulong_t arg); extern void print_evdev_ff_type(const kernel_ulong_t val); @@ -976,7 +976,7 @@ struct nlmsghdr; typedef bool (*netlink_decoder_t)(struct tcb *, const struct nlmsghdr *, kernel_ulong_t addr, unsigned int len); -#define DECL_NETLINK(name) \ +# define DECL_NETLINK(name) \ extern bool \ decode_netlink_ ## name(struct tcb *, const struct nlmsghdr *, \ kernel_ulong_t addr, unsigned int len) \ @@ -1000,18 +1000,18 @@ extern void ts_sub(struct timespec *, const struct timespec *, const struct time extern void ts_mul(struct timespec *, const struct timespec *, int); extern void ts_div(struct timespec *, const struct timespec *, int); -#ifdef ENABLE_STACKTRACE +# ifdef ENABLE_STACKTRACE extern void unwind_init(void); extern void unwind_tcb_init(struct tcb *); extern void unwind_tcb_fin(struct tcb *); extern void unwind_tcb_print(struct tcb *); extern void unwind_tcb_capture(struct tcb *); -#endif +# endif -#ifdef HAVE_LINUX_KVM_H +# ifdef HAVE_LINUX_KVM_H extern void kvm_run_structure_decoder_init(void); extern void kvm_vcpu_info_free(struct tcb *); -#endif +# endif static inline int printstrn(struct tcb *tcp, kernel_ulong_t addr, kernel_ulong_t len) @@ -1080,7 +1080,7 @@ tprint_iov(struct tcb *tcp, kernel_ulong_t len, kernel_ulong_t addr, tprint_iov_upto(tcp, len, addr, decode_iov, -1); } -#ifdef ALPHA +# ifdef ALPHA typedef struct { int tv_sec, tv_usec; } timeval32_t; @@ -1091,9 +1091,9 @@ extern const char *sprint_timeval32(struct tcb *, kernel_ulong_t addr); extern void print_timeval32(struct tcb *, kernel_ulong_t addr); extern void print_timeval32_utimes(struct tcb *, kernel_ulong_t addr); extern void print_itimerval32(struct tcb *, kernel_ulong_t addr); -#endif +# endif -#ifdef HAVE_STRUCT_USER_DESC +# ifdef HAVE_STRUCT_USER_DESC /** * Filter what to print from the point of view of the get_thread_area syscall. * Kernel copies only entry_number field at first and then tries to write the @@ -1109,7 +1109,7 @@ enum user_desc_print_filter { extern void print_user_desc(struct tcb *, kernel_ulong_t addr, enum user_desc_print_filter filter); -#endif +# endif /* Strace log generation machinery. * @@ -1150,32 +1150,32 @@ print_mac_addr(const char *prefix, const uint8_t addr[], size_t size) tprints(sprint_mac_addr(addr, size)); } -#if SUPPORTED_PERSONALITIES > 1 +# if SUPPORTED_PERSONALITIES > 1 extern void set_personality(unsigned int personality); extern unsigned current_personality; -#else -# define set_personality(personality) ((void)0) -# define current_personality 0 -#endif - -#if SUPPORTED_PERSONALITIES == 1 -# define current_wordsize PERSONALITY0_WORDSIZE -# define current_klongsize PERSONALITY0_KLONGSIZE -#else -# if SUPPORTED_PERSONALITIES == 2 && PERSONALITY0_WORDSIZE == PERSONALITY1_WORDSIZE -# define current_wordsize PERSONALITY0_WORDSIZE # else -extern unsigned current_wordsize; +# define set_personality(personality) ((void)0) +# define current_personality 0 # endif -# if SUPPORTED_PERSONALITIES == 2 && PERSONALITY0_KLONGSIZE == PERSONALITY1_KLONGSIZE + +# if SUPPORTED_PERSONALITIES == 1 +# define current_wordsize PERSONALITY0_WORDSIZE # define current_klongsize PERSONALITY0_KLONGSIZE # else +# if SUPPORTED_PERSONALITIES == 2 && PERSONALITY0_WORDSIZE == PERSONALITY1_WORDSIZE +# define current_wordsize PERSONALITY0_WORDSIZE +# else +extern unsigned current_wordsize; +# endif +# if SUPPORTED_PERSONALITIES == 2 && PERSONALITY0_KLONGSIZE == PERSONALITY1_KLONGSIZE +# define current_klongsize PERSONALITY0_KLONGSIZE +# else extern unsigned current_klongsize; +# endif # endif -#endif -#define max_addr() (~0ULL >> ((8 - current_wordsize) * 8)) -#define max_kaddr() (~0ULL >> ((8 - current_klongsize) * 8)) +# define max_addr() (~0ULL >> ((8 - current_wordsize) * 8)) +# define max_kaddr() (~0ULL >> ((8 - current_klongsize) * 8)) /* * When u64 is interpreted by the kernel as an address, there is a difference @@ -1184,7 +1184,7 @@ extern unsigned current_klongsize; * to a valid address). Since 32-bit strace cannot figure out what kind of * kernel the tracee is running on, it has to account for both possibilities. */ -#if CAN_ARCH_BE_COMPAT_ON_64BIT_KERNEL +# if CAN_ARCH_BE_COMPAT_ON_64BIT_KERNEL /** * Print raw 64-bit value as an address if it's too big to fit in strace's @@ -1198,18 +1198,18 @@ print_big_u64_addr(const uint64_t addr) tprints(" or "); } } -#else /* !CAN_ARCH_BE_COMPAT_ON_64BIT_KERNEL */ -# define print_big_u64_addr(addr_) ((void) 0) -#endif /* CAN_ARCH_BE_COMPAT_ON_64BIT_KERNEL */ +# else /* !CAN_ARCH_BE_COMPAT_ON_64BIT_KERNEL */ +# define print_big_u64_addr(addr_) ((void) 0) +# endif /* CAN_ARCH_BE_COMPAT_ON_64BIT_KERNEL */ -#if SIZEOF_KERNEL_LONG_T > 4 \ +# if SIZEOF_KERNEL_LONG_T > 4 \ && (SIZEOF_LONG < SIZEOF_KERNEL_LONG_T || !defined(current_wordsize)) -# define ANY_WORDSIZE_LESS_THAN_KERNEL_LONG 1 -#else -# define ANY_WORDSIZE_LESS_THAN_KERNEL_LONG 0 -#endif +# define ANY_WORDSIZE_LESS_THAN_KERNEL_LONG 1 +# else +# define ANY_WORDSIZE_LESS_THAN_KERNEL_LONG 0 +# endif -#define DECL_PRINTNUM(name) \ +# define DECL_PRINTNUM(name) \ extern bool \ printnum_ ## name(struct tcb *, kernel_ulong_t addr, const char *fmt) \ ATTRIBUTE_FORMAT((printf, 3, 0)) \ @@ -1218,18 +1218,18 @@ printnum_ ## name(struct tcb *, kernel_ulong_t addr, const char *fmt) \ DECL_PRINTNUM(short); DECL_PRINTNUM(int); DECL_PRINTNUM(int64); -#undef DECL_PRINTNUM +# undef DECL_PRINTNUM -#define DECL_PRINTNUM_ADDR(name) \ +# define DECL_PRINTNUM_ADDR(name) \ extern bool \ printnum_addr_ ## name(struct tcb *, kernel_ulong_t addr) \ /* End of DECL_PRINTNUM_ADDR definition. */ DECL_PRINTNUM_ADDR(int); DECL_PRINTNUM_ADDR(int64); -#undef DECL_PRINTNUM_ADDR +# undef DECL_PRINTNUM_ADDR -#ifndef current_wordsize +# ifndef current_wordsize extern bool printnum_long_int(struct tcb *, kernel_ulong_t addr, const char *fmt_long, const char *fmt_int) @@ -1256,7 +1256,7 @@ printnum_ptr(struct tcb *tcp, kernel_ulong_t addr) return printnum_addr_long_int(tcp, addr); } -#elif current_wordsize > 4 +# elif current_wordsize > 4 static inline bool printnum_slong(struct tcb *tcp, kernel_ulong_t addr) @@ -1276,7 +1276,7 @@ printnum_ptr(struct tcb *tcp, kernel_ulong_t addr) return printnum_addr_int64(tcp, addr); } -#else /* current_wordsize == 4 */ +# else /* current_wordsize == 4 */ static inline bool printnum_slong(struct tcb *tcp, kernel_ulong_t addr) @@ -1296,9 +1296,9 @@ printnum_ptr(struct tcb *tcp, kernel_ulong_t addr) return printnum_addr_int(tcp, addr); } -#endif +# endif -#ifndef current_klongsize +# ifndef current_klongsize extern bool printnum_addr_klong_int(struct tcb *, kernel_ulong_t addr); static inline bool @@ -1307,7 +1307,7 @@ printnum_kptr(struct tcb *tcp, kernel_ulong_t addr) return printnum_addr_klong_int(tcp, addr); } -#elif current_klongsize > 4 +# elif current_klongsize > 4 static inline bool printnum_kptr(struct tcb *tcp, kernel_ulong_t addr) @@ -1315,7 +1315,7 @@ printnum_kptr(struct tcb *tcp, kernel_ulong_t addr) return printnum_addr_int64(tcp, addr); } -#else /* current_klongsize == 4 */ +# else /* current_klongsize == 4 */ static inline bool printnum_kptr(struct tcb *tcp, kernel_ulong_t addr) @@ -1323,9 +1323,9 @@ printnum_kptr(struct tcb *tcp, kernel_ulong_t addr) return printnum_addr_int(tcp, addr); } -#endif +# endif -#define DECL_PRINTPAIR(name) \ +# define DECL_PRINTPAIR(name) \ extern bool \ printpair_ ## name(struct tcb *, kernel_ulong_t addr, const char *fmt) \ ATTRIBUTE_FORMAT((printf, 3, 0)) \ @@ -1333,16 +1333,16 @@ printpair_ ## name(struct tcb *, kernel_ulong_t addr, const char *fmt) \ DECL_PRINTPAIR(int); DECL_PRINTPAIR(int64); -#undef DECL_PRINTPAIR +# undef DECL_PRINTPAIR static inline kernel_long_t truncate_klong_to_current_wordsize(const kernel_long_t v) { -#if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG +# if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG if (current_wordsize < sizeof(v)) { return (int) v; } else -#endif +# endif { return v; } @@ -1351,11 +1351,11 @@ truncate_klong_to_current_wordsize(const kernel_long_t v) static inline kernel_ulong_t truncate_kulong_to_current_wordsize(const kernel_ulong_t v) { -#if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG +# if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG if (current_wordsize < sizeof(v)) { return (unsigned int) v; } else -#endif +# endif { return v; } @@ -1364,12 +1364,12 @@ truncate_kulong_to_current_wordsize(const kernel_ulong_t v) /* * Cast a pointer or a pointer-sized integer to kernel_ulong_t. */ -#define ptr_to_kulong(v) ((kernel_ulong_t) (unsigned long) (v)) +# define ptr_to_kulong(v) ((kernel_ulong_t) (unsigned long) (v)) /* * Zero-extend a signed integer type to unsigned long long. */ -#define zero_extend_signed_to_ull(v) \ +# define zero_extend_signed_to_ull(v) \ (sizeof(v) == sizeof(char) ? (unsigned long long) (unsigned char) (v) : \ sizeof(v) == sizeof(short) ? (unsigned long long) (unsigned short) (v) : \ sizeof(v) == sizeof(int) ? (unsigned long long) (unsigned int) (v) : \ @@ -1379,7 +1379,7 @@ truncate_kulong_to_current_wordsize(const kernel_ulong_t v) /* * Sign-extend an unsigned integer type to long long. */ -#define sign_extend_unsigned_to_ll(v) \ +# define sign_extend_unsigned_to_ll(v) \ (sizeof(v) == sizeof(char) ? (long long) (char) (v) : \ sizeof(v) == sizeof(short) ? (long long) (short) (v) : \ sizeof(v) == sizeof(int) ? (long long) (int) (v) : \ @@ -1398,13 +1398,13 @@ extern const char *const personality_names[]; /* Personality designators to be used for specifying personality */ extern const char *const personality_designators[]; -#if SUPPORTED_PERSONALITIES > 1 +# if SUPPORTED_PERSONALITIES > 1 extern const struct_sysent *sysent; extern const struct_ioctlent *ioctlent; -#else -# define sysent sysent0 -# define ioctlent ioctlent0 -#endif +# else +# define sysent sysent0 +# define ioctlent ioctlent0 +# endif extern unsigned nsyscalls; extern unsigned nioctlents; @@ -1413,17 +1413,17 @@ extern const unsigned int nsyscall_vec[SUPPORTED_PERSONALITIES]; extern const struct_sysent *const sysent_vec[SUPPORTED_PERSONALITIES]; extern struct inject_opts *inject_vec[SUPPORTED_PERSONALITIES]; -#ifdef IN_MPERS_BOOTSTRAP +# ifdef IN_MPERS_BOOTSTRAP /* Transform multi-line MPERS_PRINTER_DECL statements to one-liners. */ -# define MPERS_PRINTER_DECL(type, name, ...) MPERS_PRINTER_DECL(type, name, __VA_ARGS__) -#else /* !IN_MPERS_BOOTSTRAP */ -# if SUPPORTED_PERSONALITIES > 1 -# include "printers.h" -# else -# include "native_printer_decls.h" -# endif -# define MPERS_PRINTER_DECL(type, name, ...) type MPERS_FUNC_NAME(name)(__VA_ARGS__) -#endif /* !IN_MPERS_BOOTSTRAP */ +# define MPERS_PRINTER_DECL(type, name, ...) MPERS_PRINTER_DECL(type, name, __VA_ARGS__) +# else /* !IN_MPERS_BOOTSTRAP */ +# if SUPPORTED_PERSONALITIES > 1 +# include "printers.h" +# else +# include "native_printer_decls.h" +# endif +# define MPERS_PRINTER_DECL(type, name, ...) type MPERS_FUNC_NAME(name)(__VA_ARGS__) +# endif /* !IN_MPERS_BOOTSTRAP */ /* Checks that sysent[scno] is not out of range. */ static inline bool @@ -1445,12 +1445,12 @@ scno_is_valid(kernel_ulong_t scno) && !(sysent[scno].sys_flags & TRACE_INDIRECT_SUBCALL); } -#define MPERS_FUNC_NAME__(prefix, name) prefix ## name -#define MPERS_FUNC_NAME_(prefix, name) MPERS_FUNC_NAME__(prefix, name) -#define MPERS_FUNC_NAME(name) MPERS_FUNC_NAME_(MPERS_PREFIX, name) +# define MPERS_FUNC_NAME__(prefix, name) prefix ## name +# define MPERS_FUNC_NAME_(prefix, name) MPERS_FUNC_NAME__(prefix, name) +# define MPERS_FUNC_NAME(name) MPERS_FUNC_NAME_(MPERS_PREFIX, name) -#define SYS_FUNC_NAME(syscall_name) MPERS_FUNC_NAME(syscall_name) +# define SYS_FUNC_NAME(syscall_name) MPERS_FUNC_NAME(syscall_name) -#define SYS_FUNC(syscall_name) int SYS_FUNC_NAME(sys_ ## syscall_name)(struct tcb *tcp) +# define SYS_FUNC(syscall_name) int SYS_FUNC_NAME(sys_ ## syscall_name)(struct tcb *tcp) #endif /* !STRACE_DEFS_H */ diff --git a/delay.h b/delay.h index 278645a2..fa111c76 100644 --- a/delay.h +++ b/delay.h @@ -6,7 +6,7 @@ */ #ifndef STRACE_DELAY_H -#define STRACE_DELAY_H +# define STRACE_DELAY_H uint16_t alloc_delay_data(void); void fill_delay_data(uint16_t delay_idx, int intval, bool isenter); diff --git a/dm.c b/dm.c index 6124e2ae..dbeca335 100644 --- a/dm.c +++ b/dm.c @@ -98,7 +98,7 @@ dm_decode_values(struct tcb *tcp, const unsigned int code, } } -#include "xlat/dm_flags.h" +# include "xlat/dm_flags.h" static void dm_decode_flags(const struct dm_ioctl *ioc) diff --git a/error_prints.h b/error_prints.h index 2c43ce7e..678c1d15 100644 --- a/error_prints.h +++ b/error_prints.h @@ -11,11 +11,11 @@ */ #ifndef STRACE_ERROR_PRINTS_H -#define STRACE_ERROR_PRINTS_H +# define STRACE_ERROR_PRINTS_H -#include +# include -#include "gcc_compat.h" +# include "gcc_compat.h" extern bool debug_flag; @@ -31,29 +31,29 @@ void error_msg_and_die(const char *fmt, ...) ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN; /* Wrappers for if (debug_flag) error_msg(...) */ -#define debug_msg(...) \ +# define debug_msg(...) \ do { \ if (debug_flag) \ error_msg(__VA_ARGS__); \ } while (0) -#define debug_perror_msg(...) \ +# define debug_perror_msg(...) \ do { \ if (debug_flag) \ perror_msg(__VA_ARGS__); \ } while (0) /* Simple wrappers for providing function name in error messages */ -#define error_func_msg(fmt_, ...) \ +# define error_func_msg(fmt_, ...) \ error_msg("%s: " fmt_, __func__, ##__VA_ARGS__) -#define perror_func_msg(fmt_, ...) \ +# define perror_func_msg(fmt_, ...) \ perror_msg("%s: " fmt_, __func__, ##__VA_ARGS__) -#define debug_func_msg(fmt_, ...) \ +# define debug_func_msg(fmt_, ...) \ debug_msg("%s: " fmt_, __func__, ##__VA_ARGS__) -#define debug_func_perror_msg(fmt_, ...) \ +# define debug_func_perror_msg(fmt_, ...) \ debug_perror_msg("%s: " fmt_, __func__, ##__VA_ARGS__) -#define error_func_msg_and_die(fmt_, ...) \ +# define error_func_msg_and_die(fmt_, ...) \ error_msg_and_die("%s: " fmt_, __func__, ##__VA_ARGS__) -#define perror_func_msg_and_die(fmt_, ...) \ +# define perror_func_msg_and_die(fmt_, ...) \ perror_msg_and_die("%s: " fmt_, __func__, ##__VA_ARGS__) #endif /* !STRACE_ERROR_PRINTS_H */ diff --git a/evdev.c b/evdev.c index 8d22d08e..e402d26e 100644 --- a/evdev.c +++ b/evdev.c @@ -186,7 +186,7 @@ decode_bitset_(struct tcb *const tcp, const kernel_ulong_t arg, return RVAL_IOCTL_DECODED; } -#define decode_bitset(tcp_, arg_, decode_nr_, max_nr_, dflt_, xt_) \ +# define decode_bitset(tcp_, arg_, decode_nr_, max_nr_, dflt_, xt_) \ decode_bitset_((tcp_), (arg_), (decode_nr_), (max_nr_), \ (dflt_), ARRAY_SIZE(decode_nr_) - 1, (xt_)) diff --git a/evdev_mpers.c b/evdev_mpers.c index 3e294ae0..ff99544b 100644 --- a/evdev_mpers.c +++ b/evdev_mpers.c @@ -11,7 +11,7 @@ #ifdef HAVE_LINUX_INPUT_H -#include DEF_MPERS_TYPE(struct_ff_effect) +# include DEF_MPERS_TYPE(struct_ff_effect) # include # include diff --git a/f_owner_ex.h b/f_owner_ex.h index 08cbb2aa..1499bc07 100644 --- a/f_owner_ex.h +++ b/f_owner_ex.h @@ -6,16 +6,16 @@ */ #ifndef STRACE_F_OWNER_EX_H -#define STRACE_F_OWNER_EX_H +# define STRACE_F_OWNER_EX_H -#include +# include -#if defined HAVE_STRUCT_F_OWNER_EX +# if defined HAVE_STRUCT_F_OWNER_EX typedef struct f_owner_ex struct_kernel_f_owner_ex; -#elif defined HAVE_STRUCT___KERNEL_F_OWNER_EX +# elif defined HAVE_STRUCT___KERNEL_F_OWNER_EX typedef struct __kernel_f_owner_ex struct_kernel_f_owner_ex; -#else -# error struct f_owner_ex definition not found in -#endif +# else +# error struct f_owner_ex definition not found in +# endif #endif /* !STRACE_F_OWNER_EX_H */ diff --git a/filter.h b/filter.h index 0c81f7f6..54b0a72b 100644 --- a/filter.h +++ b/filter.h @@ -7,7 +7,7 @@ */ #ifndef STRACE_FILTER_H -#define STRACE_FILTER_H +# define STRACE_FILTER_H struct number_set; typedef int (*string_to_uint_func)(const char *); diff --git a/flock.h b/flock.h index f4a6d4e9..c7c13519 100644 --- a/flock.h +++ b/flock.h @@ -7,24 +7,24 @@ */ #ifndef STRACE_FLOCK_H -#define STRACE_FLOCK_H +# define STRACE_FLOCK_H -#include +# include -#if defined HAVE_STRUCT_FLOCK +# if defined HAVE_STRUCT_FLOCK typedef struct flock struct_kernel_flock; -#elif defined HAVE_STRUCT___KERNEL_FLOCK +# elif defined HAVE_STRUCT___KERNEL_FLOCK typedef struct __kernel_flock struct_kernel_flock; -#else -# error struct flock definition not found in -#endif +# else +# error struct flock definition not found in +# endif -#if defined HAVE_STRUCT_FLOCK64 +# if defined HAVE_STRUCT_FLOCK64 typedef struct flock64 struct_kernel_flock64; -#elif defined HAVE_STRUCT___KERNEL_FLOCK64 +# elif defined HAVE_STRUCT___KERNEL_FLOCK64 typedef struct __kernel_flock64 struct_kernel_flock64; -#else -# error struct flock64 definition not found in -#endif +# else +# error struct flock64 definition not found in +# endif #endif /* !STRACE_FLOCK_H */ diff --git a/gcc_compat.h b/gcc_compat.h index 9343febe..2d5d7f9e 100644 --- a/gcc_compat.h +++ b/gcc_compat.h @@ -7,114 +7,114 @@ */ #ifndef STRACE_GCC_COMPAT_H -#define STRACE_GCC_COMPAT_H +# define STRACE_GCC_COMPAT_H -#if defined __GNUC__ && defined __GNUC_MINOR__ -# define GNUC_PREREQ(maj, min) \ +# if defined __GNUC__ && defined __GNUC_MINOR__ +# define GNUC_PREREQ(maj, min) \ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) -#else -# define GNUC_PREREQ(maj, min) 0 -#endif +# else +# define GNUC_PREREQ(maj, min) 0 +# endif -#if defined __clang__ && defined __clang_major__ && defined __clang_minor__ -# define CLANG_PREREQ(maj, min) \ +# if defined __clang__ && defined __clang_major__ && defined __clang_minor__ +# define CLANG_PREREQ(maj, min) \ ((__clang_major__ << 16) + __clang_minor__ >= ((maj) << 16) + (min)) -#else -# define CLANG_PREREQ(maj, min) 0 -#endif - -#if !(GNUC_PREREQ(2, 0) || CLANG_PREREQ(1, 0)) -# define __attribute__(x) /* empty */ -#endif - -#if GNUC_PREREQ(2, 5) -# define ATTRIBUTE_NORETURN __attribute__((__noreturn__)) -#else -# define ATTRIBUTE_NORETURN /* empty */ -#endif - -#if GNUC_PREREQ(2, 7) -# define ATTRIBUTE_FORMAT(args) __attribute__((__format__ args)) -# define ATTRIBUTE_ALIGNED(arg) __attribute__((__aligned__(arg))) -# define ATTRIBUTE_PACKED __attribute__((__packed__)) -#else -# define ATTRIBUTE_FORMAT(args) /* empty */ -# define ATTRIBUTE_ALIGNED(arg) /* empty */ -# define ATTRIBUTE_PACKED /* empty */ -#endif - -#if GNUC_PREREQ(3, 0) -# define SAME_TYPE(x, y) __builtin_types_compatible_p(typeof(x), typeof(y)) -# define FAIL_BUILD_ON_ZERO(expr) (sizeof(int[-1 + 2 * !!(expr)]) * 0) +# else +# define CLANG_PREREQ(maj, min) 0 +# endif + +# if !(GNUC_PREREQ(2, 0) || CLANG_PREREQ(1, 0)) +# define __attribute__(x) /* empty */ +# endif + +# if GNUC_PREREQ(2, 5) +# define ATTRIBUTE_NORETURN __attribute__((__noreturn__)) +# else +# define ATTRIBUTE_NORETURN /* empty */ +# endif + +# if GNUC_PREREQ(2, 7) +# define ATTRIBUTE_FORMAT(args) __attribute__((__format__ args)) +# define ATTRIBUTE_ALIGNED(arg) __attribute__((__aligned__(arg))) +# define ATTRIBUTE_PACKED __attribute__((__packed__)) +# else +# define ATTRIBUTE_FORMAT(args) /* empty */ +# define ATTRIBUTE_ALIGNED(arg) /* empty */ +# define ATTRIBUTE_PACKED /* empty */ +# endif + +# if GNUC_PREREQ(3, 0) +# define SAME_TYPE(x, y) __builtin_types_compatible_p(typeof(x), typeof(y)) +# define FAIL_BUILD_ON_ZERO(expr) (sizeof(int[-1 + 2 * !!(expr)]) * 0) /* &(a)[0] is a pointer and not an array, shouldn't be treated as the same */ -# define MUST_BE_ARRAY(a) FAIL_BUILD_ON_ZERO(!SAME_TYPE((a), &(a)[0])) -#else -# define SAME_TYPE(x, y) 0 -# define MUST_BE_ARRAY(a) 0 -#endif - -#if GNUC_PREREQ(3, 0) -# define ATTRIBUTE_MALLOC __attribute__((__malloc__)) -#else -# define ATTRIBUTE_MALLOC /* empty */ -#endif - -#if GNUC_PREREQ(3, 1) -# define ATTRIBUTE_NOINLINE __attribute__((__noinline__)) -#else -# define ATTRIBUTE_NOINLINE /* empty */ -#endif - -#if GNUC_PREREQ(4, 0) -# define ATTRIBUTE_SENTINEL __attribute__((__sentinel__)) -#else -# define ATTRIBUTE_SENTINEL /* empty */ -#endif - -#if GNUC_PREREQ(4, 1) -# define ALIGNOF(t_) __alignof__(t_) -#else -# define ALIGNOF(t_) (sizeof(struct { char x_; t_ y_; }) - sizeof(t_)) -#endif - -#if GNUC_PREREQ(4, 3) -# define ATTRIBUTE_ALLOC_SIZE(args) __attribute__((__alloc_size__ args)) -#else -# define ATTRIBUTE_ALLOC_SIZE(args) /* empty */ -#endif - -#if GNUC_PREREQ(7, 0) -# define ATTRIBUTE_FALLTHROUGH __attribute__((__fallthrough__)) -#else -# define ATTRIBUTE_FALLTHROUGH ((void) 0) -#endif - -#if CLANG_PREREQ(2, 8) -# define DIAG_PUSH_IGNORE_OVERRIDE_INIT \ +# define MUST_BE_ARRAY(a) FAIL_BUILD_ON_ZERO(!SAME_TYPE((a), &(a)[0])) +# else +# define SAME_TYPE(x, y) 0 +# define MUST_BE_ARRAY(a) 0 +# endif + +# if GNUC_PREREQ(3, 0) +# define ATTRIBUTE_MALLOC __attribute__((__malloc__)) +# else +# define ATTRIBUTE_MALLOC /* empty */ +# endif + +# if GNUC_PREREQ(3, 1) +# define ATTRIBUTE_NOINLINE __attribute__((__noinline__)) +# else +# define ATTRIBUTE_NOINLINE /* empty */ +# endif + +# if GNUC_PREREQ(4, 0) +# define ATTRIBUTE_SENTINEL __attribute__((__sentinel__)) +# else +# define ATTRIBUTE_SENTINEL /* empty */ +# endif + +# if GNUC_PREREQ(4, 1) +# define ALIGNOF(t_) __alignof__(t_) +# else +# define ALIGNOF(t_) (sizeof(struct { char x_; t_ y_; }) - sizeof(t_)) +# endif + +# if GNUC_PREREQ(4, 3) +# define ATTRIBUTE_ALLOC_SIZE(args) __attribute__((__alloc_size__ args)) +# else +# define ATTRIBUTE_ALLOC_SIZE(args) /* empty */ +# endif + +# if GNUC_PREREQ(7, 0) +# define ATTRIBUTE_FALLTHROUGH __attribute__((__fallthrough__)) +# else +# define ATTRIBUTE_FALLTHROUGH ((void) 0) +# endif + +# if CLANG_PREREQ(2, 8) +# define DIAG_PUSH_IGNORE_OVERRIDE_INIT \ _Pragma("clang diagnostic push"); \ _Pragma("clang diagnostic ignored \"-Winitializer-overrides\""); -# define DIAG_POP_IGNORE_OVERRIDE_INIT \ +# define DIAG_POP_IGNORE_OVERRIDE_INIT \ _Pragma("clang diagnostic pop"); -#elif GNUC_PREREQ(4, 2) -# define DIAG_PUSH_IGNORE_OVERRIDE_INIT \ +# elif GNUC_PREREQ(4, 2) +# define DIAG_PUSH_IGNORE_OVERRIDE_INIT \ _Pragma("GCC diagnostic push"); \ _Pragma("GCC diagnostic ignored \"-Woverride-init\""); -# define DIAG_POP_IGNORE_OVERRIDE_INIT \ +# define DIAG_POP_IGNORE_OVERRIDE_INIT \ _Pragma("GCC diagnostic pop"); -#else -# define DIAG_PUSH_IGNORE_OVERRIDE_INIT /* empty */ -# define DIAG_POP_IGNORE_OVERRIDE_INIT /* empty */ -#endif +# else +# define DIAG_PUSH_IGNORE_OVERRIDE_INIT /* empty */ +# define DIAG_POP_IGNORE_OVERRIDE_INIT /* empty */ +# endif -#if GNUC_PREREQ(6, 0) -# define DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE \ +# if GNUC_PREREQ(6, 0) +# define DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE \ _Pragma("GCC diagnostic push"); \ _Pragma("GCC diagnostic ignored \"-Wtautological-compare\""); -# define DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE \ +# define DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE \ _Pragma("GCC diagnostic pop"); -#else -# define DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE /* empty */ -# define DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE /* empty */ -#endif +# else +# define DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE /* empty */ +# define DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE /* empty */ +# endif #endif /* !STRACE_GCC_COMPAT_H */ diff --git a/get_personality.h b/get_personality.h index 7571e43d..ab018154 100644 --- a/get_personality.h +++ b/get_personality.h @@ -6,9 +6,9 @@ */ #ifndef STRACE_GET_PERSONALITY_H -#define STRACE_GET_PERSONALITY_H +# define STRACE_GET_PERSONALITY_H -#include "ptrace.h" +# include "ptrace.h" extern int get_personality_from_syscall_info(const struct ptrace_syscall_info *); diff --git a/ipc_defs.h b/ipc_defs.h index 23ef351b..b5900e0b 100644 --- a/ipc_defs.h +++ b/ipc_defs.h @@ -7,21 +7,21 @@ */ #ifndef STRACE_IPC_DEFS_H -#define STRACE_IPC_DEFS_H +# define STRACE_IPC_DEFS_H -#ifdef HAVE_SYS_IPC_H -# include -#elif defined HAVE_LINUX_IPC_H -# include +# ifdef HAVE_SYS_IPC_H +# include +# elif defined HAVE_LINUX_IPC_H +# include /* While glibc uses __key, the kernel uses key. */ -# define __key key -#endif +# define __key key +# endif -#if !defined IPC_64 -# define IPC_64 0x100 -#endif +# if !defined IPC_64 +# define IPC_64 0x100 +# endif -#define PRINTCTL(flagset, arg, dflt) \ +# define PRINTCTL(flagset, arg, dflt) \ do { \ if ((arg) & IPC_64) { \ print_xlat(IPC_64); \ diff --git a/kernel_types.h b/kernel_types.h index 808c2a9c..f7c2aedb 100644 --- a/kernel_types.h +++ b/kernel_types.h @@ -7,11 +7,11 @@ */ #ifndef STRACE_KERNEL_TYPES_H -#define STRACE_KERNEL_TYPES_H +# define STRACE_KERNEL_TYPES_H # if defined HAVE___KERNEL_LONG_T && defined HAVE___KERNEL_ULONG_T -# include +# include typedef __kernel_long_t kernel_long_t; typedef __kernel_ulong_t kernel_ulong_t; @@ -35,15 +35,15 @@ typedef struct { char d_name[1]; } kernel_dirent; -#if SIZEOF_KERNEL_LONG_T > SIZEOF_LONG -# define PRI_kl "ll" -#else -# define PRI_kl "l" -#endif +# if SIZEOF_KERNEL_LONG_T > SIZEOF_LONG +# define PRI_kl "ll" +# else +# define PRI_kl "l" +# endif -#define PRI_kld PRI_kl"d" -#define PRI_klu PRI_kl"u" -#define PRI_klx PRI_kl"x" +# define PRI_kld PRI_kl"d" +# define PRI_klu PRI_kl"u" +# define PRI_klx PRI_kl"x" /* * The kernel used to define 64-bit types on 64-bit systems on a per-arch @@ -54,17 +54,17 @@ typedef struct { * every printing of __u64 or __s64 to stdint types. * The exception is Android, where for MIPS64 unsigned long long is used. */ -#if SIZEOF_LONG == 4 -# define PRI__64 "ll" -#elif defined ALPHA || defined IA64 || defined __powerpc64__ \ +# if SIZEOF_LONG == 4 +# define PRI__64 "ll" +# elif defined ALPHA || defined IA64 || defined __powerpc64__ \ || (defined MIPS && !defined __ANDROID__) -# define PRI__64 "l" -#else -# define PRI__64 "ll" -#endif +# define PRI__64 "l" +# else +# define PRI__64 "ll" +# endif -#define PRI__d64 PRI__64"d" -#define PRI__u64 PRI__64"u" -#define PRI__x64 PRI__64"x" +# define PRI__d64 PRI__64"d" +# define PRI__u64 PRI__64"u" +# define PRI__x64 PRI__64"x" #endif /* !STRACE_KERNEL_TYPES_H */ diff --git a/keyctl_kdf_params.h b/keyctl_kdf_params.h index 654ce94d..80fff1a6 100644 --- a/keyctl_kdf_params.h +++ b/keyctl_kdf_params.h @@ -6,16 +6,16 @@ */ #ifndef STRACE_KEYCTL_KDF_PARAMS_H -#define STRACE_KEYCTL_KDF_PARAMS_H +# define STRACE_KEYCTL_KDF_PARAMS_H -#include -#include "kernel_types.h" +# include +# include "kernel_types.h" /* from include/linux/crypto.h */ -#define CRYPTO_MAX_ALG_NAME 128 +# define CRYPTO_MAX_ALG_NAME 128 /* from security/keys/internal.h */ -#define KEYCTL_KDF_MAX_OI_LEN 64 /* max length of otherinfo */ +# define KEYCTL_KDF_MAX_OI_LEN 64 /* max length of otherinfo */ struct keyctl_kdf_params { char *hashname; diff --git a/kill_save_errno.h b/kill_save_errno.h index d2880f45..a777b9a4 100644 --- a/kill_save_errno.h +++ b/kill_save_errno.h @@ -6,11 +6,11 @@ */ #ifndef STRACE_KILL_SAVE_ERRNO_H -#define STRACE_KILL_SAVE_ERRNO_H +# define STRACE_KILL_SAVE_ERRNO_H -#include -#include -#include +# include +# include +# include static inline int kill_save_errno(pid_t pid, int sig) diff --git a/kvm.c b/kvm.c index 9a1e2fab..04411e3a 100644 --- a/kvm.c +++ b/kvm.c @@ -107,7 +107,7 @@ map_len(struct mmap_cache_entry_t *map_info) : 0; } -#define VCPU_DENTRY_PREFIX "anon_inode:kvm-vcpu:" +# define VCPU_DENTRY_PREFIX "anon_inode:kvm-vcpu:" static struct vcpu_info* vcpu_get_info(struct tcb *const tcp, int fd) diff --git a/largefile_wrappers.h b/largefile_wrappers.h index eebb746b..508882c4 100644 --- a/largefile_wrappers.h +++ b/largefile_wrappers.h @@ -9,30 +9,30 @@ */ #ifndef STRACE_LARGEFILE_WRAPPERS_H -#define STRACE_LARGEFILE_WRAPPERS_H +# define STRACE_LARGEFILE_WRAPPERS_H -#include "defs.h" +# include "defs.h" -#ifdef _LARGEFILE64_SOURCE -# ifdef HAVE_FOPEN64 -# define fopen_stream fopen64 +# ifdef _LARGEFILE64_SOURCE +# ifdef HAVE_FOPEN64 +# define fopen_stream fopen64 +# else +# define fopen_stream fopen +# endif +# define struct_stat struct stat64 +# define stat_file stat64 +# define struct_dirent struct dirent64 +# define read_dir readdir64 +# define struct_rlimit struct rlimit64 +# define set_rlimit setrlimit64 # else # define fopen_stream fopen +# define struct_stat struct stat +# define stat_file stat +# define struct_dirent struct dirent +# define read_dir readdir +# define struct_rlimit struct rlimit +# define set_rlimit setrlimit # endif -# define struct_stat struct stat64 -# define stat_file stat64 -# define struct_dirent struct dirent64 -# define read_dir readdir64 -# define struct_rlimit struct rlimit64 -# define set_rlimit setrlimit64 -#else -# define fopen_stream fopen -# define struct_stat struct stat -# define stat_file stat -# define struct_dirent struct dirent -# define read_dir readdir -# define struct_rlimit struct rlimit -# define set_rlimit setrlimit -#endif #endif /* STRACE_LARGEFILE_WRAPPERS_H */ diff --git a/linux/aarch64/raw_syscall.h b/linux/aarch64/raw_syscall.h index 69abe1f2..aa27e1d5 100644 --- a/linux/aarch64/raw_syscall.h +++ b/linux/aarch64/raw_syscall.h @@ -8,7 +8,7 @@ */ #ifndef STRACE_RAW_SYSCALL_H -#define STRACE_RAW_SYSCALL_H +# define STRACE_RAW_SYSCALL_H # include "kernel_types.h" diff --git a/linux/alpha/raw_syscall.h b/linux/alpha/raw_syscall.h index b25cb4fe..f44dd27f 100644 --- a/linux/alpha/raw_syscall.h +++ b/linux/alpha/raw_syscall.h @@ -8,7 +8,7 @@ */ #ifndef STRACE_RAW_SYSCALL_H -#define STRACE_RAW_SYSCALL_H +# define STRACE_RAW_SYSCALL_H # include "kernel_types.h" diff --git a/linux/arc/raw_syscall.h b/linux/arc/raw_syscall.h index 6387c404..f51c84ec 100644 --- a/linux/arc/raw_syscall.h +++ b/linux/arc/raw_syscall.h @@ -8,7 +8,7 @@ */ #ifndef STRACE_RAW_SYSCALL_H -#define STRACE_RAW_SYSCALL_H +# define STRACE_RAW_SYSCALL_H # include "kernel_types.h" diff --git a/linux/arm/raw_syscall.h b/linux/arm/raw_syscall.h index 38d223e6..c052a298 100644 --- a/linux/arm/raw_syscall.h +++ b/linux/arm/raw_syscall.h @@ -8,7 +8,7 @@ */ #ifndef STRACE_RAW_SYSCALL_H -#define STRACE_RAW_SYSCALL_H +# define STRACE_RAW_SYSCALL_H # include "kernel_types.h" @@ -17,7 +17,7 @@ raw_syscall_0(const kernel_ulong_t nr, kernel_ulong_t *err) { *err = 0; -#ifdef __thumb__ /* && FRAME_POINTERS_ENABLED */ +# ifdef __thumb__ /* && FRAME_POINTERS_ENABLED */ register kernel_ulong_t rt; register kernel_ulong_t r0 __asm__("r0"); @@ -26,7 +26,7 @@ raw_syscall_0(const kernel_ulong_t nr, kernel_ulong_t *err) : "r"(nr) : "memory"); -#else +# else register kernel_ulong_t r7 __asm__("r7") = nr; register kernel_ulong_t r0 __asm__("r0"); @@ -35,7 +35,7 @@ raw_syscall_0(const kernel_ulong_t nr, kernel_ulong_t *err) : "r"(r7) : "memory"); -#endif +# endif return r0; } diff --git a/linux/asm_stat.h b/linux/asm_stat.h index 1f4d6a23..b3510a5d 100644 --- a/linux/asm_stat.h +++ b/linux/asm_stat.h @@ -6,7 +6,7 @@ */ #ifndef STRACE_ASM_STAT_H -#define STRACE_ASM_STAT_H +# define STRACE_ASM_STAT_H # undef dev_t # undef gid_t diff --git a/linux/avr32/raw_syscall.h b/linux/avr32/raw_syscall.h index 01aab228..518adb11 100644 --- a/linux/avr32/raw_syscall.h +++ b/linux/avr32/raw_syscall.h @@ -8,7 +8,7 @@ */ #ifndef STRACE_RAW_SYSCALL_H -#define STRACE_RAW_SYSCALL_H +# define STRACE_RAW_SYSCALL_H # include "kernel_types.h" diff --git a/linux/bfin/raw_syscall.h b/linux/bfin/raw_syscall.h index df2916ac..8ac705cc 100644 --- a/linux/bfin/raw_syscall.h +++ b/linux/bfin/raw_syscall.h @@ -8,7 +8,7 @@ */ #ifndef STRACE_RAW_SYSCALL_H -#define STRACE_RAW_SYSCALL_H +# define STRACE_RAW_SYSCALL_H # include "kernel_types.h" diff --git a/linux/bfin/rt_sigframe.h b/linux/bfin/rt_sigframe.h index 7653c185..fa2ca4b3 100644 --- a/linux/bfin/rt_sigframe.h +++ b/linux/bfin/rt_sigframe.h @@ -6,9 +6,9 @@ */ #ifndef STRACE_RT_SIGFRAME_H -#define STRACE_RT_SIGFRAME_H +# define STRACE_RT_SIGFRAME_H -#include +# include typedef struct { int sig; diff --git a/linux/dummy.h b/linux/dummy.h index c28bf0cc..a21ffb68 100644 --- a/linux/dummy.h +++ b/linux/dummy.h @@ -8,140 +8,140 @@ */ #ifndef STRACE_LINUX_DUMMY_H -#define STRACE_LINUX_DUMMY_H +# define STRACE_LINUX_DUMMY_H -#ifndef HAVE_STRUCT___OLD_KERNEL_STAT -#define sys_oldfstat printargs -#define sys_oldstat printargs -#endif +# ifndef HAVE_STRUCT___OLD_KERNEL_STAT +# define sys_oldfstat printargs +# define sys_oldstat printargs +# endif /* still unfinished */ -#define sys_rseq printargs -#define sys_vm86 printargs -#define sys_vm86old printargs +# define sys_rseq printargs +# define sys_vm86 printargs +# define sys_vm86old printargs /* machine-specific */ -#ifndef HAVE_STRUCT_USER_DESC -# define sys_modify_ldt printargs -#endif +# ifndef HAVE_STRUCT_USER_DESC +# define sys_modify_ldt printargs +# endif -#if !(defined HAVE_STRUCT_USER_DESC || defined M68K || defined MIPS) -# define sys_set_thread_area printargs -#endif +# if !(defined HAVE_STRUCT_USER_DESC || defined M68K || defined MIPS) +# define sys_set_thread_area printargs +# endif -#if !(defined HAVE_STRUCT_USER_DESC || defined M68K) -# define sys_get_thread_area printargs -#endif +# if !(defined HAVE_STRUCT_USER_DESC || defined M68K) +# define sys_get_thread_area printargs +# endif -#ifdef ALPHA -# define sys_getdtablesize printargs -#endif +# ifdef ALPHA +# define sys_getdtablesize printargs +# endif /* like another call */ -#define sys_acct sys_chdir -#define sys_chroot sys_chdir -#define sys_clock_getres sys_clock_gettime -#define sys_connect sys_bind -#define sys_fchdir sys_close -#define sys_fdatasync sys_close -#define sys_fsync sys_close -#define sys_getegid sys_getuid -#define sys_getegid16 sys_geteuid16 -#define sys_geteuid sys_getuid -#define sys_geteuid16 sys_getuid16 -#define sys_getgid sys_getuid -#define sys_getgid16 sys_getuid16 -#define sys_getpeername sys_getsockname -#define sys_getresgid sys_getresuid -#define sys_getresgid16 sys_getresuid16 -#define sys_lstat sys_stat -#define sys_lstat64 sys_stat64 -#define sys_mkdir sys_chmod -#define sys_mkdirat sys_fchmodat -#define sys_mlock sys_munmap -#define sys_mq_unlink sys_chdir -#define sys_munlock sys_munmap -#define sys_oldlstat sys_oldstat -#define sys_pivotroot sys_link -#define sys_rename sys_link -#define sys_rmdir sys_chdir -#define sys_sched_get_priority_max sys_sched_get_priority_min -#define sys_set_robust_list sys_munmap -#define sys_setdomainname sys_sethostname -#define sys_setfsgid sys_setfsuid -#define sys_setfsgid16 sys_setfsuid16 -#define sys_setgid sys_setuid -#define sys_setgid16 sys_setuid16 -#define sys_setregid sys_setreuid -#define sys_setregid16 sys_setreuid16 -#define sys_setresgid sys_setresuid -#define sys_setresgid16 sys_setresuid16 -#define sys_stime sys_time -#define sys_swapoff sys_chdir -#define sys_symlink sys_link -#define sys_syncfs sys_close -#define sys_umount sys_chdir -#define sys_unlink sys_chdir -#define sys_uselib sys_chdir -#define sys_vfork sys_fork +# define sys_acct sys_chdir +# define sys_chroot sys_chdir +# define sys_clock_getres sys_clock_gettime +# define sys_connect sys_bind +# define sys_fchdir sys_close +# define sys_fdatasync sys_close +# define sys_fsync sys_close +# define sys_getegid sys_getuid +# define sys_getegid16 sys_geteuid16 +# define sys_geteuid sys_getuid +# define sys_geteuid16 sys_getuid16 +# define sys_getgid sys_getuid +# define sys_getgid16 sys_getuid16 +# define sys_getpeername sys_getsockname +# define sys_getresgid sys_getresuid +# define sys_getresgid16 sys_getresuid16 +# define sys_lstat sys_stat +# define sys_lstat64 sys_stat64 +# define sys_mkdir sys_chmod +# define sys_mkdirat sys_fchmodat +# define sys_mlock sys_munmap +# define sys_mq_unlink sys_chdir +# define sys_munlock sys_munmap +# define sys_oldlstat sys_oldstat +# define sys_pivotroot sys_link +# define sys_rename sys_link +# define sys_rmdir sys_chdir +# define sys_sched_get_priority_max sys_sched_get_priority_min +# define sys_set_robust_list sys_munmap +# define sys_setdomainname sys_sethostname +# define sys_setfsgid sys_setfsuid +# define sys_setfsgid16 sys_setfsuid16 +# define sys_setgid sys_setuid +# define sys_setgid16 sys_setuid16 +# define sys_setregid sys_setreuid +# define sys_setregid16 sys_setreuid16 +# define sys_setresgid sys_setresuid +# define sys_setresgid16 sys_setresuid16 +# define sys_stime sys_time +# define sys_swapoff sys_chdir +# define sys_symlink sys_link +# define sys_syncfs sys_close +# define sys_umount sys_chdir +# define sys_unlink sys_chdir +# define sys_uselib sys_chdir +# define sys_vfork sys_fork /* printargs does the right thing */ -#define sys_getpgrp printargs -#define sys_getpid printargs -#define sys_getppid printargs -#define sys_gettid printargs -#define sys_idle printargs -#define sys_inotify_init printargs -#define sys_munlockall printargs -#define sys_pause printargs -#define sys_printargs printargs -#define sys_sched_yield printargs -#define sys_setsid printargs -#define sys_set_tid_address printargs -#define sys_setup printargs -#define sys_sync printargs -#define sys_syscall printargs -#define sys_vhangup printargs +# define sys_getpgrp printargs +# define sys_getpid printargs +# define sys_getppid printargs +# define sys_gettid printargs +# define sys_idle printargs +# define sys_inotify_init printargs +# define sys_munlockall printargs +# define sys_pause printargs +# define sys_printargs printargs +# define sys_sched_yield printargs +# define sys_setsid printargs +# define sys_set_tid_address printargs +# define sys_setup printargs +# define sys_sync printargs +# define sys_syscall printargs +# define sys_vhangup printargs /* printargs_u does the right thing */ -#define sys_alarm printargs_u +# define sys_alarm printargs_u /* printargs_d does the right thing */ -#define sys_exit printargs_d -#define sys_getpgid printargs_d -#define sys_getsid printargs_d -#define sys_nice printargs_d -#define sys_setpgid printargs_d -#define sys_setpgrp printargs_d -#define sys_timer_delete printargs_d -#define sys_timer_getoverrun printargs_d +# define sys_exit printargs_d +# define sys_getpgid printargs_d +# define sys_getsid printargs_d +# define sys_nice printargs_d +# define sys_setpgid printargs_d +# define sys_setpgrp printargs_d +# define sys_timer_delete printargs_d +# define sys_timer_getoverrun printargs_d /* unimplemented */ -#define sys_afs_syscall printargs -#define sys_break printargs -#define sys_create_module printargs -#define sys_ftime printargs -#define sys_get_kernel_syms printargs -#define sys_getpmsg printargs -#define sys_gtty printargs -#define sys_lock printargs -#define sys_mpx printargs -#define sys_nfsservctl printargs -#define sys_prof printargs -#define sys_profil printargs -#define sys_putpmsg printargs -#define sys_query_module printargs -#define sys_security printargs -#define sys_stty printargs -#define sys_timerfd printargs -#define sys_tuxcall printargs -#define sys_ulimit printargs -#define sys_vserver printargs +# define sys_afs_syscall printargs +# define sys_break printargs +# define sys_create_module printargs +# define sys_ftime printargs +# define sys_get_kernel_syms printargs +# define sys_getpmsg printargs +# define sys_gtty printargs +# define sys_lock printargs +# define sys_mpx printargs +# define sys_nfsservctl printargs +# define sys_prof printargs +# define sys_profil printargs +# define sys_putpmsg printargs +# define sys_query_module printargs +# define sys_security printargs +# define sys_stty printargs +# define sys_timerfd printargs +# define sys_tuxcall printargs +# define sys_ulimit printargs +# define sys_vserver printargs /* deprecated */ -#define sys_bdflush printargs -#define sys_oldolduname printargs -#define sys_olduname printargs -#define sys_sysfs printargs +# define sys_bdflush printargs +# define sys_oldolduname printargs +# define sys_olduname printargs +# define sys_sysfs printargs #endif /* !STRACE_LINUX_DUMMY_H */ diff --git a/linux/hppa/raw_syscall.h b/linux/hppa/raw_syscall.h index 53b655d4..82a4de94 100644 --- a/linux/hppa/raw_syscall.h +++ b/linux/hppa/raw_syscall.h @@ -8,7 +8,7 @@ */ #ifndef STRACE_RAW_SYSCALL_H -#define STRACE_RAW_SYSCALL_H +# define STRACE_RAW_SYSCALL_H # include "kernel_types.h" diff --git a/linux/hppa/rt_sigframe.h b/linux/hppa/rt_sigframe.h index 61ae5c57..8338cab2 100644 --- a/linux/hppa/rt_sigframe.h +++ b/linux/hppa/rt_sigframe.h @@ -6,9 +6,9 @@ */ #ifndef STRACE_RT_SIGFRAME_H -#define STRACE_RT_SIGFRAME_H +# define STRACE_RT_SIGFRAME_H -#include +# include typedef struct { unsigned int tramp[9]; diff --git a/linux/i386/raw_syscall.h b/linux/i386/raw_syscall.h index 1e8d1441..71160397 100644 --- a/linux/i386/raw_syscall.h +++ b/linux/i386/raw_syscall.h @@ -8,7 +8,7 @@ */ #ifndef STRACE_RAW_SYSCALL_H -#define STRACE_RAW_SYSCALL_H +# define STRACE_RAW_SYSCALL_H # include "kernel_types.h" diff --git a/linux/i386/rt_sigframe.h b/linux/i386/rt_sigframe.h index 4d49930d..e0ed10d2 100644 --- a/linux/i386/rt_sigframe.h +++ b/linux/i386/rt_sigframe.h @@ -6,9 +6,9 @@ */ #ifndef STRACE_RT_SIGFRAME_H -#define STRACE_RT_SIGFRAME_H +# define STRACE_RT_SIGFRAME_H -#include +# include typedef struct { uint32_t pretcode; diff --git a/linux/ia64/raw_syscall.h b/linux/ia64/raw_syscall.h index 2c6a3fcd..1e1f540f 100644 --- a/linux/ia64/raw_syscall.h +++ b/linux/ia64/raw_syscall.h @@ -8,7 +8,7 @@ */ #ifndef STRACE_RAW_SYSCALL_H -#define STRACE_RAW_SYSCALL_H +# define STRACE_RAW_SYSCALL_H # include "kernel_types.h" diff --git a/linux/ia64/rt_sigframe.h b/linux/ia64/rt_sigframe.h index c5fb7ef3..3f58dadf 100644 --- a/linux/ia64/rt_sigframe.h +++ b/linux/ia64/rt_sigframe.h @@ -6,9 +6,9 @@ */ #ifndef STRACE_RT_SIGFRAME_H -#define STRACE_RT_SIGFRAME_H +# define STRACE_RT_SIGFRAME_H -#include +# include typedef struct { unsigned long arg0; @@ -19,7 +19,7 @@ typedef struct { struct sigcontext sc; } struct_rt_sigframe; -#define OFFSETOF_SIGMASK_IN_RT_SIGFRAME \ +# define OFFSETOF_SIGMASK_IN_RT_SIGFRAME \ offsetof(struct_rt_sigframe, sc.sc_mask) #endif /* !STRACE_RT_SIGFRAME_H */ diff --git a/linux/inet_diag.h b/linux/inet_diag.h index a4c259cc..cb9b7b3a 100644 --- a/linux/inet_diag.h +++ b/linux/inet_diag.h @@ -6,10 +6,10 @@ */ #ifndef STRACE_LINUX_INET_DIAG_H -#define STRACE_LINUX_INET_DIAG_H +# define STRACE_LINUX_INET_DIAG_H -#define TCPDIAG_GETSOCK 18 -#define DCCPDIAG_GETSOCK 19 +# define TCPDIAG_GETSOCK 18 +# define DCCPDIAG_GETSOCK 19 /* Socket identity */ struct inet_diag_sockid { diff --git a/linux/m68k/raw_syscall.h b/linux/m68k/raw_syscall.h index 274a2ee5..345bc767 100644 --- a/linux/m68k/raw_syscall.h +++ b/linux/m68k/raw_syscall.h @@ -8,7 +8,7 @@ */ #ifndef STRACE_RAW_SYSCALL_H -#define STRACE_RAW_SYSCALL_H +# define STRACE_RAW_SYSCALL_H # include "kernel_types.h" diff --git a/linux/m68k/rt_sigframe.h b/linux/m68k/rt_sigframe.h index a63e8171..e40bd745 100644 --- a/linux/m68k/rt_sigframe.h +++ b/linux/m68k/rt_sigframe.h @@ -6,9 +6,9 @@ */ #ifndef STRACE_RT_SIGFRAME_H -#define STRACE_RT_SIGFRAME_H +# define STRACE_RT_SIGFRAME_H -#include +# include typedef struct { char *pretcode; diff --git a/linux/metag/raw_syscall.h b/linux/metag/raw_syscall.h index b827e5eb..f8d12d5f 100644 --- a/linux/metag/raw_syscall.h +++ b/linux/metag/raw_syscall.h @@ -8,7 +8,7 @@ */ #ifndef STRACE_RAW_SYSCALL_H -#define STRACE_RAW_SYSCALL_H +# define STRACE_RAW_SYSCALL_H # include "kernel_types.h" diff --git a/linux/microblaze/raw_syscall.h b/linux/microblaze/raw_syscall.h index fefa57f8..fe47aa34 100644 --- a/linux/microblaze/raw_syscall.h +++ b/linux/microblaze/raw_syscall.h @@ -8,7 +8,7 @@ */ #ifndef STRACE_RAW_SYSCALL_H -#define STRACE_RAW_SYSCALL_H +# define STRACE_RAW_SYSCALL_H # include "kernel_types.h" diff --git a/linux/mips/raw_syscall.h b/linux/mips/raw_syscall.h index 32863197..d1d33bc6 100644 --- a/linux/mips/raw_syscall.h +++ b/linux/mips/raw_syscall.h @@ -8,7 +8,7 @@ */ #ifndef STRACE_RAW_SYSCALL_H -#define STRACE_RAW_SYSCALL_H +# define STRACE_RAW_SYSCALL_H # include "kernel_types.h" diff --git a/linux/mips/rt_sigframe.h b/linux/mips/rt_sigframe.h index aea7e56c..1c3019dd 100644 --- a/linux/mips/rt_sigframe.h +++ b/linux/mips/rt_sigframe.h @@ -6,9 +6,9 @@ */ #ifndef STRACE_RT_SIGFRAME_H -#define STRACE_RT_SIGFRAME_H +# define STRACE_RT_SIGFRAME_H -#include +# include typedef struct { uint32_t pad[6]; diff --git a/linux/netlink_diag.h b/linux/netlink_diag.h index 6eca8559..02ea3424 100644 --- a/linux/netlink_diag.h +++ b/linux/netlink_diag.h @@ -6,7 +6,7 @@ */ #ifndef STRACE_LINUX_NETLINK_DIAG_H -#define STRACE_LINUX_NETLINK_DIAG_H +# define STRACE_LINUX_NETLINK_DIAG_H struct netlink_diag_req { uint8_t sdiag_family; @@ -45,18 +45,18 @@ enum { NETLINK_DIAG_FLAGS, }; -#define NDIAG_SHOW_MEMINFO 0x00000001 -#define NDIAG_SHOW_GROUPS 0x00000002 -#define NDIAG_SHOW_RING_CFG 0x00000004 /* deprecated since 4.6 */ -#define NDIAG_SHOW_FLAGS 0x00000008 -#define NDIAG_PROTO_ALL ((uint8_t) ~0) +# define NDIAG_SHOW_MEMINFO 0x00000001 +# define NDIAG_SHOW_GROUPS 0x00000002 +# define NDIAG_SHOW_RING_CFG 0x00000004 /* deprecated since 4.6 */ +# define NDIAG_SHOW_FLAGS 0x00000008 +# define NDIAG_PROTO_ALL ((uint8_t) ~0) /* flags */ -#define NDIAG_FLAG_CB_RUNNING 0x00000001 -#define NDIAG_FLAG_PKTINFO 0x00000002 -#define NDIAG_FLAG_BROADCAST_ERROR 0x00000004 -#define NDIAG_FLAG_NO_ENOBUFS 0x00000008 -#define NDIAG_FLAG_LISTEN_ALL_NSID 0x00000010 -#define NDIAG_FLAG_CAP_ACK 0x00000020 +# define NDIAG_FLAG_CB_RUNNING 0x00000001 +# define NDIAG_FLAG_PKTINFO 0x00000002 +# define NDIAG_FLAG_BROADCAST_ERROR 0x00000004 +# define NDIAG_FLAG_NO_ENOBUFS 0x00000008 +# define NDIAG_FLAG_LISTEN_ALL_NSID 0x00000010 +# define NDIAG_FLAG_CAP_ACK 0x00000020 #endif /* !STRACE_LINUX_NETLINK_DIAG_H */ diff --git a/linux/nios2/arch_regs.c b/linux/nios2/arch_regs.c index f9885ee6..3c28e620 100644 --- a/linux/nios2/arch_regs.c +++ b/linux/nios2/arch_regs.c @@ -6,6 +6,6 @@ */ static struct user_pt_regs nios2_regs; -# define ARCH_REGS_FOR_GETREGSET nios2_regs +#define ARCH_REGS_FOR_GETREGSET nios2_regs #define ARCH_PC_REG nios2_regs.regs[PTR_EA] #define ARCH_SP_REG nios2_regs.regs[PTR_SP] diff --git a/linux/nios2/raw_syscall.h b/linux/nios2/raw_syscall.h index 85338d5d..02f6e7ee 100644 --- a/linux/nios2/raw_syscall.h +++ b/linux/nios2/raw_syscall.h @@ -8,7 +8,7 @@ */ #ifndef STRACE_RAW_SYSCALL_H -#define STRACE_RAW_SYSCALL_H +# define STRACE_RAW_SYSCALL_H # include "kernel_types.h" diff --git a/linux/or1k/raw_syscall.h b/linux/or1k/raw_syscall.h index 33ff0f8f..e31df27e 100644 --- a/linux/or1k/raw_syscall.h +++ b/linux/or1k/raw_syscall.h @@ -8,7 +8,7 @@ */ #ifndef STRACE_RAW_SYSCALL_H -#define STRACE_RAW_SYSCALL_H +# define STRACE_RAW_SYSCALL_H # include "kernel_types.h" diff --git a/linux/packet_diag.h b/linux/packet_diag.h index d3a4bcf5..0efb7675 100644 --- a/linux/packet_diag.h +++ b/linux/packet_diag.h @@ -6,7 +6,7 @@ */ #ifndef STRACE_LINUX_PACKET_DIAG_H -#define STRACE_LINUX_PACKET_DIAG_H +# define STRACE_LINUX_PACKET_DIAG_H struct packet_diag_req { uint8_t sdiag_family; @@ -17,12 +17,12 @@ struct packet_diag_req { uint32_t pdiag_cookie[2]; }; -#define PACKET_SHOW_INFO 0x00000001 -#define PACKET_SHOW_MCLIST 0x00000002 -#define PACKET_SHOW_RING_CFG 0x00000004 -#define PACKET_SHOW_FANOUT 0x00000008 -#define PACKET_SHOW_MEMINFO 0x00000010 -#define PACKET_SHOW_FILTER 0x00000020 +# define PACKET_SHOW_INFO 0x00000001 +# define PACKET_SHOW_MCLIST 0x00000002 +# define PACKET_SHOW_RING_CFG 0x00000004 +# define PACKET_SHOW_FANOUT 0x00000008 +# define PACKET_SHOW_MEMINFO 0x00000010 +# define PACKET_SHOW_FILTER 0x00000020 struct packet_diag_msg { uint8_t pdiag_family; @@ -52,11 +52,11 @@ struct packet_diag_info { uint32_t pdi_tstamp; uint32_t pdi_flags; -#define PDI_RUNNING 0x1 -#define PDI_AUXDATA 0x2 -#define PDI_ORIGDEV 0x4 -#define PDI_VNETHDR 0x8 -#define PDI_LOSS 0x10 +# define PDI_RUNNING 0x1 +# define PDI_AUXDATA 0x2 +# define PDI_ORIGDEV 0x4 +# define PDI_VNETHDR 0x8 +# define PDI_LOSS 0x10 }; struct packet_diag_mclist { diff --git a/linux/powerpc/arch_rt_sigframe.c b/linux/powerpc/arch_rt_sigframe.c index b49b85a2..1a614135 100644 --- a/linux/powerpc/arch_rt_sigframe.c +++ b/linux/powerpc/arch_rt_sigframe.c @@ -5,7 +5,7 @@ * SPDX-License-Identifier: LGPL-2.1-or-later */ -#define SIGNAL_FRAMESIZE32 64 +#define SIGNAL_FRAMESIZE32 64 FUNC_GET_RT_SIGFRAME_ADDR { diff --git a/linux/powerpc/raw_syscall.h b/linux/powerpc/raw_syscall.h index 5da1d9ae..e023fcd1 100644 --- a/linux/powerpc/raw_syscall.h +++ b/linux/powerpc/raw_syscall.h @@ -8,7 +8,7 @@ */ #ifndef STRACE_RAW_SYSCALL_H -#define STRACE_RAW_SYSCALL_H +# define STRACE_RAW_SYSCALL_H # include "kernel_types.h" diff --git a/linux/powerpc64/arch_rt_sigframe.c b/linux/powerpc64/arch_rt_sigframe.c index 28c1b3a4..17ef72b5 100644 --- a/linux/powerpc64/arch_rt_sigframe.c +++ b/linux/powerpc64/arch_rt_sigframe.c @@ -6,13 +6,13 @@ */ #undef FUNC_GET_RT_SIGFRAME_ADDR -#define FUNC_GET_RT_SIGFRAME_ADDR \ +#define FUNC_GET_RT_SIGFRAME_ADDR \ static kernel_ulong_t ppc_get_rt_sigframe_addr(struct tcb *tcp) #include "powerpc/arch_rt_sigframe.c" #undef FUNC_GET_RT_SIGFRAME_ADDR -#define FUNC_GET_RT_SIGFRAME_ADDR DEF_FUNC_GET_RT_SIGFRAME_ADDR +#define FUNC_GET_RT_SIGFRAME_ADDR DEF_FUNC_GET_RT_SIGFRAME_ADDR FUNC_GET_RT_SIGFRAME_ADDR { diff --git a/linux/riscv/raw_syscall.h b/linux/riscv/raw_syscall.h index ca0d8b7a..e069b11c 100644 --- a/linux/riscv/raw_syscall.h +++ b/linux/riscv/raw_syscall.h @@ -8,7 +8,7 @@ */ #ifndef STRACE_RAW_SYSCALL_H -#define STRACE_RAW_SYSCALL_H +# define STRACE_RAW_SYSCALL_H # include "kernel_types.h" diff --git a/linux/rt_sigframe.h b/linux/rt_sigframe.h index 10f92e00..959db22b 100644 --- a/linux/rt_sigframe.h +++ b/linux/rt_sigframe.h @@ -6,9 +6,9 @@ */ #ifndef STRACE_RT_SIGFRAME_H -#define STRACE_RT_SIGFRAME_H +# define STRACE_RT_SIGFRAME_H -#include +# include /* This is a generic definition for compatible architectures. */ diff --git a/linux/s390/raw_syscall.h b/linux/s390/raw_syscall.h index c9805867..96d6230e 100644 --- a/linux/s390/raw_syscall.h +++ b/linux/s390/raw_syscall.h @@ -8,7 +8,7 @@ */ #ifndef STRACE_RAW_SYSCALL_H -#define STRACE_RAW_SYSCALL_H +# define STRACE_RAW_SYSCALL_H # include "kernel_types.h" diff --git a/linux/s390/rt_sigframe.h b/linux/s390/rt_sigframe.h index cf691505..e11573a4 100644 --- a/linux/s390/rt_sigframe.h +++ b/linux/s390/rt_sigframe.h @@ -6,9 +6,9 @@ */ #ifndef STRACE_RT_SIGFRAME_H -#define STRACE_RT_SIGFRAME_H +# define STRACE_RT_SIGFRAME_H -#include +# include typedef struct { uint8_t callee_used_stack[__SIGNAL_FRAMESIZE]; diff --git a/linux/sh/raw_syscall.h b/linux/sh/raw_syscall.h index e03caed6..1c2f8136 100644 --- a/linux/sh/raw_syscall.h +++ b/linux/sh/raw_syscall.h @@ -8,7 +8,7 @@ */ #ifndef STRACE_RAW_SYSCALL_H -#define STRACE_RAW_SYSCALL_H +# define STRACE_RAW_SYSCALL_H # include "kernel_types.h" diff --git a/linux/sh64/rt_sigframe.h b/linux/sh64/rt_sigframe.h index 60f53bef..f8da6554 100644 --- a/linux/sh64/rt_sigframe.h +++ b/linux/sh64/rt_sigframe.h @@ -6,9 +6,9 @@ */ #ifndef STRACE_RT_SIGFRAME_H -#define STRACE_RT_SIGFRAME_H +# define STRACE_RT_SIGFRAME_H -#include +# include typedef struct { siginfo_t *pinfo; diff --git a/linux/smc_diag.h b/linux/smc_diag.h index 1cb3a806..c4f2088b 100644 --- a/linux/smc_diag.h +++ b/linux/smc_diag.h @@ -6,11 +6,11 @@ */ #ifndef STRACE_LINUX_SMC_DIAG_H -#define STRACE_LINUX_SMC_DIAG_H +# define STRACE_LINUX_SMC_DIAG_H -#include +# include -#include "gcc_compat.h" +# include "gcc_compat.h" /* Request structure */ struct smc_diag_req { diff --git a/linux/sock_diag.h b/linux/sock_diag.h index 718414b2..50ce15ea 100644 --- a/linux/sock_diag.h +++ b/linux/sock_diag.h @@ -6,12 +6,12 @@ */ #ifndef STRACE_LINUX_SOCK_DIAG_H -#define STRACE_LINUX_SOCK_DIAG_H +# define STRACE_LINUX_SOCK_DIAG_H -#define SOCK_DIAG_BY_FAMILY 20 -#define SOCK_DESTROY 21 +# define SOCK_DIAG_BY_FAMILY 20 +# define SOCK_DESTROY 21 -#define SK_MEMINFO_VARS 9 +# define SK_MEMINFO_VARS 9 struct sock_diag_req { uint8_t sdiag_family; diff --git a/linux/sparc/raw_syscall.h b/linux/sparc/raw_syscall.h index b9bf3a10..d4799fde 100644 --- a/linux/sparc/raw_syscall.h +++ b/linux/sparc/raw_syscall.h @@ -8,7 +8,7 @@ */ #ifndef STRACE_RAW_SYSCALL_H -#define STRACE_RAW_SYSCALL_H +# define STRACE_RAW_SYSCALL_H # include "kernel_types.h" diff --git a/linux/sparc/rt_sigframe.h b/linux/sparc/rt_sigframe.h index f9a1483b..eb2e0410 100644 --- a/linux/sparc/rt_sigframe.h +++ b/linux/sparc/rt_sigframe.h @@ -6,10 +6,10 @@ */ #ifndef STRACE_RT_SIGFRAME_H -#define STRACE_RT_SIGFRAME_H +# define STRACE_RT_SIGFRAME_H -#include "ptrace.h" -#include +# include "ptrace.h" +# include typedef struct { struct sparc_stackf ss; @@ -19,7 +19,7 @@ typedef struct { /* more data follows */ } struct_rt_sigframe; -#define OFFSETOF_SIGMASK_IN_RT_SIGFRAME \ +# define OFFSETOF_SIGMASK_IN_RT_SIGFRAME \ offsetof(struct_rt_sigframe, mask) #endif /* !STRACE_RT_SIGFRAME_H */ diff --git a/linux/sparc64/arch_rt_sigframe.c b/linux/sparc64/arch_rt_sigframe.c index 55a4452a..3af454d2 100644 --- a/linux/sparc64/arch_rt_sigframe.c +++ b/linux/sparc64/arch_rt_sigframe.c @@ -5,7 +5,7 @@ * SPDX-License-Identifier: LGPL-2.1-or-later */ -#define STACK_BIAS 2047 +#define STACK_BIAS 2047 FUNC_GET_RT_SIGFRAME_ADDR { diff --git a/linux/sparc64/raw_syscall.h b/linux/sparc64/raw_syscall.h index ecedf188..efb73277 100644 --- a/linux/sparc64/raw_syscall.h +++ b/linux/sparc64/raw_syscall.h @@ -8,7 +8,7 @@ */ #ifndef STRACE_RAW_SYSCALL_H -#define STRACE_RAW_SYSCALL_H +# define STRACE_RAW_SYSCALL_H # include "kernel_types.h" diff --git a/linux/syscall.h b/linux/syscall.h index 78490a52..d770eab4 100644 --- a/linux/syscall.h +++ b/linux/syscall.h @@ -8,13 +8,13 @@ */ #ifndef STRACE_LINUX_SYSCALL_H -#define STRACE_LINUX_SYSCALL_H +# define STRACE_LINUX_SYSCALL_H -#include "dummy.h" -#include "sys_func.h" -#include "sen.h" +# include "dummy.h" +# include "sys_func.h" +# include "sen.h" -#if HAVE_ARCH_UID16_SYSCALLS +# if HAVE_ARCH_UID16_SYSCALLS extern SYS_FUNC(chown16); extern SYS_FUNC(fchown16); extern SYS_FUNC(getgroups16); @@ -25,6 +25,6 @@ extern SYS_FUNC(setgroups16); extern SYS_FUNC(setresuid16); extern SYS_FUNC(setreuid16); extern SYS_FUNC(setuid16); -#endif /* HAVE_ARCH_UID16_SYSCALLS */ +# endif /* HAVE_ARCH_UID16_SYSCALLS */ #endif /* !STRACE_LINUX_SYSCALL_H */ diff --git a/linux/tile/raw_syscall.h b/linux/tile/raw_syscall.h index e2904170..c006ad1e 100644 --- a/linux/tile/raw_syscall.h +++ b/linux/tile/raw_syscall.h @@ -8,7 +8,7 @@ */ #ifndef STRACE_RAW_SYSCALL_H -#define STRACE_RAW_SYSCALL_H +# define STRACE_RAW_SYSCALL_H # include "kernel_types.h" diff --git a/linux/tile/rt_sigframe.h b/linux/tile/rt_sigframe.h index e4bb114b..06050650 100644 --- a/linux/tile/rt_sigframe.h +++ b/linux/tile/rt_sigframe.h @@ -6,9 +6,9 @@ */ #ifndef STRACE_RT_SIGFRAME_H -#define STRACE_RT_SIGFRAME_H +# define STRACE_RT_SIGFRAME_H -#include +# include typedef struct { unsigned char save_area[C_ABI_SAVE_AREA_SIZE]; diff --git a/linux/unix_diag.h b/linux/unix_diag.h index d6477aee..1d15a0ce 100644 --- a/linux/unix_diag.h +++ b/linux/unix_diag.h @@ -6,7 +6,7 @@ */ #ifndef STRACE_LINUX_UNIX_DIAG_H -#define STRACE_LINUX_UNIX_DIAG_H +# define STRACE_LINUX_UNIX_DIAG_H struct unix_diag_req { uint8_t sdiag_family; @@ -18,12 +18,12 @@ struct unix_diag_req { uint32_t udiag_cookie[2]; }; -#define UDIAG_SHOW_NAME 0x01 -#define UDIAG_SHOW_VFS 0x02 -#define UDIAG_SHOW_PEER 0x04 -#define UDIAG_SHOW_ICONS 0x08 -#define UDIAG_SHOW_RQLEN 0x10 -#define UDIAG_SHOW_MEMINFO 0x20 +# define UDIAG_SHOW_NAME 0x01 +# define UDIAG_SHOW_VFS 0x02 +# define UDIAG_SHOW_PEER 0x04 +# define UDIAG_SHOW_ICONS 0x08 +# define UDIAG_SHOW_RQLEN 0x10 +# define UDIAG_SHOW_MEMINFO 0x20 struct unix_diag_msg { uint8_t udiag_family; diff --git a/linux/x86_64/arch_get_personality.c b/linux/x86_64/arch_get_personality.c index fc313a81..1dcc6932 100644 --- a/linux/x86_64/arch_get_personality.c +++ b/linux/x86_64/arch_get_personality.c @@ -25,9 +25,9 @@ get_personality_from_syscall_info(const struct ptrace_syscall_info *sci) kernel_ulong_t scno = sci->entry.nr; -#ifndef __X32_SYSCALL_BIT -# define __X32_SYSCALL_BIT 0x40000000 -#endif +# ifndef __X32_SYSCALL_BIT +# define __X32_SYSCALL_BIT 0x40000000 +# endif if (pers == 0 && (scno & __X32_SYSCALL_BIT)) { /* diff --git a/linux/x86_64/asm_stat.h b/linux/x86_64/asm_stat.h index 56b473f0..91dd1aaf 100644 --- a/linux/x86_64/asm_stat.h +++ b/linux/x86_64/asm_stat.h @@ -6,7 +6,7 @@ */ #ifndef STRACE_X86_64_ASM_STAT_H -#define STRACE_X86_64_ASM_STAT_H +# define STRACE_X86_64_ASM_STAT_H # if defined __x86_64__ && defined __ILP32__ # define stat redirect_kernel_stat diff --git a/linux/x86_64/get_scno.c b/linux/x86_64/get_scno.c index 5cdcfd39..0a274888 100644 --- a/linux/x86_64/get_scno.c +++ b/linux/x86_64/get_scno.c @@ -50,9 +50,9 @@ arch_get_scno(struct tcb *tcp) if ((long long) x86_64_regs.orig_rax != -1) { currpers = 2; } else { -# ifdef X32 +#ifdef X32 currpers = 2; -# endif +#endif } } } diff --git a/linux/x86_64/raw_syscall.h b/linux/x86_64/raw_syscall.h index e2832483..66c3eaf9 100644 --- a/linux/x86_64/raw_syscall.h +++ b/linux/x86_64/raw_syscall.h @@ -8,7 +8,7 @@ */ #ifndef STRACE_RAW_SYSCALL_H -#define STRACE_RAW_SYSCALL_H +# define STRACE_RAW_SYSCALL_H # include "kernel_types.h" diff --git a/linux/xtensa/raw_syscall.h b/linux/xtensa/raw_syscall.h index 2f0e379f..883860ed 100644 --- a/linux/xtensa/raw_syscall.h +++ b/linux/xtensa/raw_syscall.h @@ -8,7 +8,7 @@ */ #ifndef STRACE_RAW_SYSCALL_H -#define STRACE_RAW_SYSCALL_H +# define STRACE_RAW_SYSCALL_H # include "kernel_types.h" diff --git a/loop.c b/loop.c index 466950e1..36a40c55 100644 --- a/loop.c +++ b/loop.c @@ -19,7 +19,7 @@ typedef struct loop_info struct_loop_info; #include "print_fields.h" #define XLAT_MACROS_ONLY -# include "xlat/loop_cmds.h" +#include "xlat/loop_cmds.h" #undef XLAT_MACROS_ONLY #include "xlat/loop_flags_options.h" diff --git a/lseek.c b/lseek.c index 263e9284..c3c9be79 100644 --- a/lseek.c +++ b/lseek.c @@ -30,11 +30,11 @@ SYS_FUNC(lseek) kernel_long_t offset; -# ifndef current_klongsize +#ifndef current_klongsize if (current_klongsize < sizeof(kernel_long_t)) { offset = (int) tcp->u_arg[1]; } else -# endif /* !current_klongsize */ +#endif /* !current_klongsize */ { offset = tcp->u_arg[1]; } diff --git a/macros.h b/macros.h index dc2a2373..7f019480 100644 --- a/macros.h +++ b/macros.h @@ -6,36 +6,36 @@ */ #ifndef STRACE_MACROS_H -#define STRACE_MACROS_H +# define STRACE_MACROS_H -#include -#include +# include +# include -#include "gcc_compat.h" +# include "gcc_compat.h" -#define ARRAY_SIZE(a_) (sizeof(a_) / sizeof((a_)[0]) + MUST_BE_ARRAY(a_)) +# define ARRAY_SIZE(a_) (sizeof(a_) / sizeof((a_)[0]) + MUST_BE_ARRAY(a_)) -#define ARRSZ_PAIR(a_) a_, ARRAY_SIZE(a_) +# define ARRSZ_PAIR(a_) a_, ARRAY_SIZE(a_) -#define STRINGIFY(...) #__VA_ARGS__ -#define STRINGIFY_VAL(...) STRINGIFY(__VA_ARGS__) +# define STRINGIFY(...) #__VA_ARGS__ +# define STRINGIFY_VAL(...) STRINGIFY(__VA_ARGS__) -#ifndef MAX -# define MAX(a, b) (((a) > (b)) ? (a) : (b)) -#endif -#ifndef MIN -# define MIN(a, b) (((a) < (b)) ? (a) : (b)) -#endif -#define CLAMP(val, min, max) MIN(MAX(min, val), max) +# ifndef MAX +# define MAX(a, b) (((a) > (b)) ? (a) : (b)) +# endif +# ifndef MIN +# define MIN(a, b) (((a) < (b)) ? (a) : (b)) +# endif +# define CLAMP(val, min, max) MIN(MAX(min, val), max) -#ifndef ROUNDUP -# define ROUNDUP(val_, div_) ((((val_) + (div_) - 1) / (div_)) * (div_)) -#endif +# ifndef ROUNDUP +# define ROUNDUP(val_, div_) ((((val_) + (div_) - 1) / (div_)) * (div_)) +# endif -#ifndef offsetofend -# define offsetofend(type_, member_) \ +# ifndef offsetofend +# define offsetofend(type_, member_) \ (offsetof(type_, member_) + sizeof(((type_ *)0)->member_)) -#endif +# endif static inline bool is_filled(const char *ptr, char fill, size_t size) @@ -47,7 +47,7 @@ is_filled(const char *ptr, char fill, size_t size) return true; } -#define IS_ARRAY_ZERO(arr_) \ +# define IS_ARRAY_ZERO(arr_) \ is_filled((const char *) (arr_), 0, sizeof(arr_) + MUST_BE_ARRAY(arr_)) #endif /* !STRACE_MACROS_H */ diff --git a/mmap_cache.h b/mmap_cache.h index 57eccdc3..aec62bf1 100644 --- a/mmap_cache.h +++ b/mmap_cache.h @@ -5,7 +5,7 @@ */ #ifndef STRACE_MMAP_CACHE_H -#define STRACE_MMAP_CACHE_H +# define STRACE_MMAP_CACHE_H /* * Keep a sorted array of cache entries, diff --git a/mmap_notify.h b/mmap_notify.h index 586c26e6..e0272ce7 100644 --- a/mmap_notify.h +++ b/mmap_notify.h @@ -5,9 +5,9 @@ */ #ifndef STRACE_MMAP_NOTIFY_H -#define STRACE_MMAP_NOTIFY_H +# define STRACE_MMAP_NOTIFY_H -#include "defs.h" +# include "defs.h" typedef void (*mmap_notify_fn)(struct tcb *, void *); diff --git a/mpers_type.h b/mpers_type.h index b3375752..111947c3 100644 --- a/mpers_type.h +++ b/mpers_type.h @@ -8,28 +8,28 @@ */ #ifndef STRACE_MPERS_TYPE_H -#define STRACE_MPERS_TYPE_H +# define STRACE_MPERS_TYPE_H -#include "macros.h" +# include "macros.h" -#ifdef IN_MPERS -# define DEF_MPERS_TYPE(args) STRINGIFY(args.h) -# ifdef MPERS_IS_m32 -# define MPERS_PREFIX m32_ -# define MPERS_DEFS "m32_type_defs.h" -# elif defined MPERS_IS_mx32 -# define MPERS_PREFIX mx32_ -# define MPERS_DEFS "mx32_type_defs.h" -# endif -#else -# define MPERS_PREFIX -# define DEF_MPERS_TYPE(args) "empty.h" -# if IN_MPERS_BOOTSTRAP -# define MPERS_DEFS "empty.h" +# ifdef IN_MPERS +# define DEF_MPERS_TYPE(args) STRINGIFY(args.h) +# ifdef MPERS_IS_m32 +# define MPERS_PREFIX m32_ +# define MPERS_DEFS "m32_type_defs.h" +# elif defined MPERS_IS_mx32 +# define MPERS_PREFIX mx32_ +# define MPERS_DEFS "mx32_type_defs.h" +# endif # else -# define MPERS_DEFS "native_defs.h" -# endif +# define MPERS_PREFIX +# define DEF_MPERS_TYPE(args) "empty.h" +# if IN_MPERS_BOOTSTRAP +# define MPERS_DEFS "empty.h" +# else +# define MPERS_DEFS "native_defs.h" +# endif typedef unsigned long mpers_ptr_t; -#endif +# endif #endif /* !STRACE_MPERS_TYPE_H */ diff --git a/msghdr.h b/msghdr.h index 40863807..e3dbe6a4 100644 --- a/msghdr.h +++ b/msghdr.h @@ -6,7 +6,7 @@ */ #ifndef STRACE_MSGHDR_H -#define STRACE_MSGHDR_H +# define STRACE_MSGHDR_H /* For definitions of struct msghdr and struct mmsghdr. */ # include diff --git a/nbd_ioctl.c b/nbd_ioctl.c index ced9a4cd..11cc05e6 100644 --- a/nbd_ioctl.c +++ b/nbd_ioctl.c @@ -12,7 +12,7 @@ #include #define XLAT_MACROS_ONLY -# include "xlat/nbd_ioctl_cmds.h" +#include "xlat/nbd_ioctl_cmds.h" #undef XLAT_MACROS_ONLY #include "xlat/nbd_ioctl_flags.h" diff --git a/negated_errno.h b/negated_errno.h index f93c00ae..0e9e9a2e 100644 --- a/negated_errno.h +++ b/negated_errno.h @@ -7,7 +7,7 @@ */ #ifndef STRACE_NEGATED_ERRNO_H -#define STRACE_NEGATED_ERRNO_H +# define STRACE_NEGATED_ERRNO_H /* * Check the syscall return value register value for whether it is @@ -18,12 +18,12 @@ is_negated_errno(kernel_ulong_t val) { kernel_ulong_t max = -(kernel_long_t) MAX_ERRNO_VALUE; -#ifndef current_klongsize +# ifndef current_klongsize if (current_klongsize < sizeof(val)) { val = (uint32_t) val; max = (uint32_t) max; } -#endif /* !current_klongsize */ +# endif /* !current_klongsize */ return val >= max; } diff --git a/net.c b/net.c index a87bdf74..65e78494 100644 --- a/net.c +++ b/net.c @@ -65,8 +65,8 @@ #include "xlat/inet_protocols.h" #define XLAT_MACROS_ONLY -# include "xlat/addrfams.h" -# include "xlat/ethernet_protocols.h" +#include "xlat/addrfams.h" +#include "xlat/ethernet_protocols.h" #undef XLAT_MACROS_ONLY #include "xlat/ax25_protocols.h" #include "xlat/irda_protocols.h" diff --git a/netlink.h b/netlink.h index 66db510b..a079362e 100644 --- a/netlink.h +++ b/netlink.h @@ -7,42 +7,42 @@ */ #ifndef STRACE_NETLINK_H -#define STRACE_NETLINK_H - -#include -#include -#include - -#ifndef NETLINK_SOCK_DIAG -# define NETLINK_SOCK_DIAG 4 -#endif - -#ifndef NLM_F_NONREC -# define NLM_F_NONREC 0x100 -#endif -#ifndef NLM_F_CAPPED -# define NLM_F_CAPPED 0x100 -#endif - -#undef NLMSG_HDRLEN -#define NLMSG_HDRLEN ((unsigned int) NLMSG_ALIGN(sizeof(struct nlmsghdr))) - -#ifndef NLMSG_MIN_TYPE -# define NLMSG_MIN_TYPE 0x10 -#endif - -#ifndef NLA_ALIGN -# define NLA_ALIGN(len) (((len) + 3) & ~3) -#endif - -#undef NLA_HDRLEN -#define NLA_HDRLEN ((unsigned int) NLA_ALIGN(sizeof(struct nlattr))) - -#ifndef NLA_TYPE_MASK -# define NLA_F_NESTED (1 << 15) -# define NLA_F_NET_BYTEORDER (1 << 14) -# define NLA_TYPE_MASK ~(NLA_F_NESTED | NLA_F_NET_BYTEORDER) -#endif +# define STRACE_NETLINK_H + +# include +# include +# include + +# ifndef NETLINK_SOCK_DIAG +# define NETLINK_SOCK_DIAG 4 +# endif + +# ifndef NLM_F_NONREC +# define NLM_F_NONREC 0x100 +# endif +# ifndef NLM_F_CAPPED +# define NLM_F_CAPPED 0x100 +# endif + +# undef NLMSG_HDRLEN +# define NLMSG_HDRLEN ((unsigned int) NLMSG_ALIGN(sizeof(struct nlmsghdr))) + +# ifndef NLMSG_MIN_TYPE +# define NLMSG_MIN_TYPE 0x10 +# endif + +# ifndef NLA_ALIGN +# define NLA_ALIGN(len) (((len) + 3) & ~3) +# endif + +# undef NLA_HDRLEN +# define NLA_HDRLEN ((unsigned int) NLA_ALIGN(sizeof(struct nlattr))) + +# ifndef NLA_TYPE_MASK +# define NLA_F_NESTED (1 << 15) +# define NLA_F_NET_BYTEORDER (1 << 14) +# define NLA_TYPE_MASK ~(NLA_F_NESTED | NLA_F_NET_BYTEORDER) +# endif static inline bool is_nlmsg_ok(const struct nlmsghdr *const nlh, const ssize_t len) diff --git a/netlink_kobject_uevent.h b/netlink_kobject_uevent.h index a73b8b5f..3aea2532 100644 --- a/netlink_kobject_uevent.h +++ b/netlink_kobject_uevent.h @@ -6,7 +6,7 @@ */ #ifndef STRACE_NETLINK_KOBJECT_UEVENT_H -#define STRACE_NETLINK_KOBJECT_UEVENT_H +# define STRACE_NETLINK_KOBJECT_UEVENT_H struct udev_monitor_netlink_header { /* "libudev" prefix to distinguish libudev and kernel messages */ diff --git a/netlink_route.h b/netlink_route.h index 1fd1ebde..62aecf7f 100644 --- a/netlink_route.h +++ b/netlink_route.h @@ -8,9 +8,9 @@ */ #ifndef STRACE_NETLINK_ROUTE_H -#define STRACE_NETLINK_ROUTE_H +# define STRACE_NETLINK_ROUTE_H -#define DECL_NETLINK_ROUTE_DECODER(route_decode_name) \ +# define DECL_NETLINK_ROUTE_DECODER(route_decode_name) \ void \ route_decode_name(struct tcb *tcp, \ const struct nlmsghdr *nlmsghdr, \ diff --git a/netlink_smc_diag.c b/netlink_smc_diag.c index 25809fc8..9255c0de 100644 --- a/netlink_smc_diag.c +++ b/netlink_smc_diag.c @@ -65,7 +65,7 @@ print_smc_diag_cursor(const struct smc_diag_cursor *const cursor) tprints("}"); } -# define PRINT_FIELD_SMC_DIAG_CURSOR(prefix_, where_, field_) \ +#define PRINT_FIELD_SMC_DIAG_CURSOR(prefix_, where_, field_) \ do { \ tprintf("%s%s=", (prefix_), #field_); \ print_smc_diag_cursor(&(where_).field_); \ diff --git a/netlink_sock_diag.h b/netlink_sock_diag.h index 72937e21..95fbc339 100644 --- a/netlink_sock_diag.h +++ b/netlink_sock_diag.h @@ -7,9 +7,9 @@ */ #ifndef STRACE_NETLINK_SOCK_DIAG_H -#define STRACE_NETLINK_SOCK_DIAG_H +# define STRACE_NETLINK_SOCK_DIAG_H -#define DECL_NETLINK_DIAG_DECODER(diag_decode_name) \ +# define DECL_NETLINK_DIAG_DECODER(diag_decode_name) \ void \ diag_decode_name(struct tcb *tcp, \ const struct nlmsghdr *nlmsghdr, \ @@ -34,7 +34,7 @@ struct inet_diag_sockid; extern void print_inet_diag_sockid(const struct inet_diag_sockid *, const uint8_t family); -#define PRINT_FIELD_INET_DIAG_SOCKID(prefix_, where_, field_, af_) \ +# define PRINT_FIELD_INET_DIAG_SOCKID(prefix_, where_, field_, af_) \ do { \ STRACE_PRINTF("%s%s=", (prefix_), #field_); \ print_inet_diag_sockid(&(where_).field_, (af_)); \ diff --git a/nlattr.h b/nlattr.h index fe7ee864..a11f2f1d 100644 --- a/nlattr.h +++ b/nlattr.h @@ -8,9 +8,9 @@ */ #ifndef STRACE_NLATTR_H -#define STRACE_NLATTR_H +# define STRACE_NLATTR_H -#include "xlat.h" +# include "xlat.h" struct decode_nla_xlat_opts { const struct xlat *xlat; @@ -52,7 +52,7 @@ decode_nlattr(struct tcb *, unsigned int size, const void *opaque_data); -#define DECL_NLA(name) \ +# define DECL_NLA(name) \ extern bool \ decode_nla_ ## name(struct tcb *, kernel_ulong_t addr, \ unsigned int len, const void *) \ diff --git a/nsfs.h b/nsfs.h index 06e7f202..0f8106a9 100644 --- a/nsfs.h +++ b/nsfs.h @@ -6,23 +6,23 @@ */ #ifndef STRACE_NSFS_H -#define STRACE_NSFS_H +# define STRACE_NSFS_H -#include +# include -#ifdef HAVE_LINUX_NSFS_H -# include -#else -# define NSIO 0xb7 -# define NS_GET_USERNS _IO(NSIO, 0x1) -# define NS_GET_PARENT _IO(NSIO, 0x2) -#endif +# ifdef HAVE_LINUX_NSFS_H +# include +# else +# define NSIO 0xb7 +# define NS_GET_USERNS _IO(NSIO, 0x1) +# define NS_GET_PARENT _IO(NSIO, 0x2) +# endif -#ifndef NS_GET_NSTYPE -# define NS_GET_NSTYPE _IO(NSIO, 0x3) -#endif -#ifndef NS_GET_OWNER_UID -# define NS_GET_OWNER_UID _IO(NSIO, 0x4) -#endif +# ifndef NS_GET_NSTYPE +# define NS_GET_NSTYPE _IO(NSIO, 0x3) +# endif +# ifndef NS_GET_OWNER_UID +# define NS_GET_OWNER_UID _IO(NSIO, 0x4) +# endif #endif /* !STRACE_NSFS_H */ diff --git a/nsig.h b/nsig.h index 33ef9eec..7724a570 100644 --- a/nsig.h +++ b/nsig.h @@ -6,17 +6,17 @@ */ #ifndef STRACE_NSIG_H -#define STRACE_NSIG_H +# define STRACE_NSIG_H -#include +# include -#ifndef NSIG -# warning NSIG is not defined, using 32 -# define NSIG 32 -#elif NSIG < 32 -# error NSIG < 32 -#endif +# ifndef NSIG +# warning NSIG is not defined, using 32 +# define NSIG 32 +# elif NSIG < 32 +# error NSIG < 32 +# endif -#define NSIG_BYTES (NSIG / 8) +# define NSIG_BYTES (NSIG / 8) #endif /* !STRACE_NSIG_H */ diff --git a/number_set.h b/number_set.h index 6a5ece16..77dc3a9c 100644 --- a/number_set.h +++ b/number_set.h @@ -6,9 +6,9 @@ */ #ifndef STRACE_NUMBER_SET_H -#define STRACE_NUMBER_SET_H +# define STRACE_NUMBER_SET_H -#include "gcc_compat.h" +# include "gcc_compat.h" struct number_set; diff --git a/or1k_atomic.c b/or1k_atomic.c index f4420219..99a0f6f9 100644 --- a/or1k_atomic.c +++ b/or1k_atomic.c @@ -11,17 +11,17 @@ #ifdef OR1K -#define OR1K_ATOMIC_SWAP 1 -#define OR1K_ATOMIC_CMPXCHG 2 -#define OR1K_ATOMIC_XCHG 3 -#define OR1K_ATOMIC_ADD 4 -#define OR1K_ATOMIC_DECPOS 5 -#define OR1K_ATOMIC_AND 6 -#define OR1K_ATOMIC_OR 7 -#define OR1K_ATOMIC_UMAX 8 -#define OR1K_ATOMIC_UMIN 9 - -#include "xlat/atomic_ops.h" +# define OR1K_ATOMIC_SWAP 1 +# define OR1K_ATOMIC_CMPXCHG 2 +# define OR1K_ATOMIC_XCHG 3 +# define OR1K_ATOMIC_ADD 4 +# define OR1K_ATOMIC_DECPOS 5 +# define OR1K_ATOMIC_AND 6 +# define OR1K_ATOMIC_OR 7 +# define OR1K_ATOMIC_UMAX 8 +# define OR1K_ATOMIC_UMIN 9 + +# include "xlat/atomic_ops.h" SYS_FUNC(or1k_atomic) { diff --git a/perf.c b/perf.c index 758364f8..d3a98166 100644 --- a/perf.c +++ b/perf.c @@ -114,7 +114,7 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr) * offsetofend against size) in order to print fields as kernel sees * them. This also should work great on big endian architectures. */ - #define _PERF_CHECK_FIELD(_field) \ +#define _PERF_CHECK_FIELD(_field) \ do { \ if (offsetof(struct perf_event_attr, _field) >= size) \ goto print_perf_event_attr_out; \ diff --git a/perf_event_struct.h b/perf_event_struct.h index 0e1f82a8..b9489a65 100644 --- a/perf_event_struct.h +++ b/perf_event_struct.h @@ -6,9 +6,9 @@ */ #ifndef STRACE_LINUX_PERF_EVENT_STRUCT_H -#define STRACE_LINUX_PERF_EVENT_STRUCT_H +# define STRACE_LINUX_PERF_EVENT_STRUCT_H -#include +# include struct perf_event_attr { uint32_t type; diff --git a/perf_ioctl.c b/perf_ioctl.c index c2213f20..427aa9eb 100644 --- a/perf_ioctl.c +++ b/perf_ioctl.c @@ -12,7 +12,7 @@ #include "perf_event_struct.h" #define XLAT_MACROS_ONLY -# include "xlat/perf_ioctl_cmds.h" +#include "xlat/perf_ioctl_cmds.h" #undef XLAT_MACROS_ONLY #include "xlat/perf_ioctl_flags.h" diff --git a/print_fields.h b/print_fields.h index 786ee4c3..bcab1b73 100644 --- a/print_fields.h +++ b/print_fields.h @@ -7,55 +7,55 @@ */ #ifndef STRACE_PRINT_FIELDS_H -#define STRACE_PRINT_FIELDS_H +# define STRACE_PRINT_FIELDS_H /* * The printf-like function to use in header files * shared between strace and its tests. */ -#ifndef STRACE_PRINTF -# define STRACE_PRINTF tprintf -#endif +# ifndef STRACE_PRINTF +# define STRACE_PRINTF tprintf +# endif -#define PRINT_FIELD_D(prefix_, where_, field_) \ +# define PRINT_FIELD_D(prefix_, where_, field_) \ STRACE_PRINTF("%s%s=%lld", (prefix_), #field_, \ sign_extend_unsigned_to_ll((where_).field_)) -#define PRINT_FIELD_U(prefix_, where_, field_) \ +# define PRINT_FIELD_U(prefix_, where_, field_) \ STRACE_PRINTF("%s%s=%llu", (prefix_), #field_, \ zero_extend_signed_to_ull((where_).field_)) -#define PRINT_FIELD_U_CAST(prefix_, where_, field_, type_) \ +# define PRINT_FIELD_U_CAST(prefix_, where_, field_, type_) \ STRACE_PRINTF("%s%s=%llu", (prefix_), #field_, \ zero_extend_signed_to_ull((type_) (where_).field_)) -#define PRINT_FIELD_X(prefix_, where_, field_) \ +# define PRINT_FIELD_X(prefix_, where_, field_) \ STRACE_PRINTF("%s%s=%#llx", (prefix_), #field_, \ zero_extend_signed_to_ull((where_).field_)) -#define PRINT_FIELD_ADDR(prefix_, where_, field_) \ +# define PRINT_FIELD_ADDR(prefix_, where_, field_) \ do { \ STRACE_PRINTF("%s%s=", (prefix_), #field_); \ printaddr((where_).field_); \ } while (0) -#define PRINT_FIELD_ADDR64(prefix_, where_, field_) \ +# define PRINT_FIELD_ADDR64(prefix_, where_, field_) \ do { \ STRACE_PRINTF("%s%s=", (prefix_), #field_); \ printaddr64((where_).field_); \ } while (0) -#define PRINT_FIELD_0X(prefix_, where_, field_) \ +# define PRINT_FIELD_0X(prefix_, where_, field_) \ STRACE_PRINTF("%s%s=%#0*llx", (prefix_), #field_, \ (int) sizeof((where_).field_) * 2, \ zero_extend_signed_to_ull((where_).field_)) -#define PRINT_FIELD_COOKIE(prefix_, where_, field_) \ +# define PRINT_FIELD_COOKIE(prefix_, where_, field_) \ STRACE_PRINTF("%s%s=[%llu, %llu]", (prefix_), #field_, \ zero_extend_signed_to_ull((where_).field_[0]), \ zero_extend_signed_to_ull((where_).field_[1])) -#define PRINT_FIELD_FLAGS(prefix_, where_, field_, xlat_, dflt_) \ +# define PRINT_FIELD_FLAGS(prefix_, where_, field_, xlat_, dflt_) \ do { \ STRACE_PRINTF("%s%s=", (prefix_), #field_); \ printflags64((xlat_), \ @@ -63,7 +63,7 @@ (dflt_)); \ } while (0) -#define PRINT_FIELD_XVAL(prefix_, where_, field_, xlat_, dflt_) \ +# define PRINT_FIELD_XVAL(prefix_, where_, field_, xlat_, dflt_) \ do { \ STRACE_PRINTF("%s%s=", (prefix_), #field_); \ printxval64((xlat_), \ @@ -71,7 +71,7 @@ (dflt_)); \ } while (0) -#define PRINT_FIELD_XVAL_U(prefix_, where_, field_, xlat_, dflt_) \ +# define PRINT_FIELD_XVAL_U(prefix_, where_, field_, xlat_, dflt_) \ do { \ STRACE_PRINTF("%s%s=", (prefix_), #field_); \ printxvals_ex(zero_extend_signed_to_ull((where_).field_), \ @@ -79,7 +79,7 @@ (xlat_), NULL); \ } while (0) -#define PRINT_FIELD_XVAL_SORTED_SIZED(prefix_, where_, field_, xlat_, \ +# define PRINT_FIELD_XVAL_SORTED_SIZED(prefix_, where_, field_, xlat_, \ xlat_size_, dflt_) \ do { \ STRACE_PRINTF("%s%s=", (prefix_), #field_); \ @@ -88,7 +88,7 @@ (dflt_)); \ } while (0) -#define PRINT_FIELD_XVAL_INDEX(prefix_, where_, field_, xlat_, dflt_) \ +# define PRINT_FIELD_XVAL_INDEX(prefix_, where_, field_, xlat_, dflt_) \ do { \ STRACE_PRINTF("%s%s=", (prefix_), #field_); \ printxval_index((xlat_), \ @@ -100,7 +100,7 @@ * Generic "ID" printing. ID is considered unsigned except for the special value * of -1. */ -#define PRINT_FIELD_ID(prefix_, where_, field_) \ +# define PRINT_FIELD_ID(prefix_, where_, field_) \ do { \ if (sign_extend_unsigned_to_ll((where_).field_) == -1LL) \ STRACE_PRINTF("%s%s=-1", (prefix_), #field_); \ @@ -109,9 +109,9 @@ zero_extend_signed_to_ull((where_).field_)); \ } while (0) -#define PRINT_FIELD_UID PRINT_FIELD_ID +# define PRINT_FIELD_UID PRINT_FIELD_ID -#define PRINT_FIELD_U64(prefix_, where_, field_) \ +# define PRINT_FIELD_U64(prefix_, where_, field_) \ do { \ STRACE_PRINTF("%s%s=", (prefix_), #field_); \ if (zero_extend_signed_to_ull((where_).field_) == UINT64_MAX) \ @@ -121,14 +121,14 @@ zero_extend_signed_to_ull((where_).field_)); \ } while (0) -#define PRINT_FIELD_STRING(prefix_, where_, field_, len_, style_) \ +# define PRINT_FIELD_STRING(prefix_, where_, field_, len_, style_) \ do { \ STRACE_PRINTF("%s%s=", (prefix_), #field_); \ print_quoted_string((const char *)(where_).field_, \ (len_), (style_)); \ } while (0) -#define PRINT_FIELD_CSTRING(prefix_, where_, field_) \ +# define PRINT_FIELD_CSTRING(prefix_, where_, field_) \ do { \ STRACE_PRINTF("%s%s=", (prefix_), #field_); \ print_quoted_cstring((const char *) (where_).field_, \ @@ -136,14 +136,14 @@ MUST_BE_ARRAY((where_).field_)); \ } while (0) -#define PRINT_FIELD_CSTRING_SZ(prefix_, where_, field_, size_) \ +# define PRINT_FIELD_CSTRING_SZ(prefix_, where_, field_, size_) \ do { \ STRACE_PRINTF("%s%s=", (prefix_), #field_); \ print_quoted_cstring((const char *) (where_).field_, \ (size_)); \ } while (0) -#define PRINT_FIELD_HEX_ARRAY(prefix_, where_, field_) \ +# define PRINT_FIELD_HEX_ARRAY(prefix_, where_, field_) \ do { \ STRACE_PRINTF("%s%s=", (prefix_), #field_); \ print_quoted_string((const char *)(where_).field_, \ @@ -152,88 +152,88 @@ QUOTE_FORCE_HEX); \ } while (0) -#define PRINT_FIELD_INET_ADDR(prefix_, where_, field_, af_) \ +# define PRINT_FIELD_INET_ADDR(prefix_, where_, field_, af_) \ do { \ STRACE_PRINTF(prefix_); \ print_inet_addr((af_), &(where_).field_, \ sizeof((where_).field_), #field_); \ } while (0) -#define PRINT_FIELD_INET4_ADDR(prefix_, where_, field_) \ +# define PRINT_FIELD_INET4_ADDR(prefix_, where_, field_) \ STRACE_PRINTF("%s%s=inet_addr(\"%s\")", (prefix_), #field_, \ inet_ntoa((where_).field_)) -#define PRINT_FIELD_AX25_ADDR(prefix_, where_, field_) \ +# define PRINT_FIELD_AX25_ADDR(prefix_, where_, field_) \ do { \ STRACE_PRINTF("%s%s=", (prefix_), #field_); \ print_ax25_addr(&(where_).field_); \ } while (0) -#define PRINT_FIELD_X25_ADDR(prefix_, where_, field_) \ +# define PRINT_FIELD_X25_ADDR(prefix_, where_, field_) \ do { \ STRACE_PRINTF("%s%s=", (prefix_), #field_); \ print_x25_addr(&(where_).field_); \ } while (0) -#define PRINT_FIELD_NET_PORT(prefix_, where_, field_) \ +# define PRINT_FIELD_NET_PORT(prefix_, where_, field_) \ STRACE_PRINTF("%s%s=htons(%u)", (prefix_), #field_, \ ntohs((where_).field_)) -#define PRINT_FIELD_IFINDEX(prefix_, where_, field_) \ +# define PRINT_FIELD_IFINDEX(prefix_, where_, field_) \ do { \ STRACE_PRINTF("%s%s=", (prefix_), #field_); \ print_ifindex((where_).field_); \ } while (0) -#define PRINT_FIELD_SOCKADDR(prefix_, where_, field_) \ +# define PRINT_FIELD_SOCKADDR(prefix_, where_, field_) \ do { \ STRACE_PRINTF("%s%s=", (prefix_), #field_); \ print_sockaddr(&(where_).field_, \ sizeof((where_).field_)); \ } while (0) -#define PRINT_FIELD_DEV(prefix_, where_, field_) \ +# define PRINT_FIELD_DEV(prefix_, where_, field_) \ do { \ STRACE_PRINTF("%s%s=", (prefix_), #field_); \ print_dev_t((where_).field_); \ } while (0) -#define PRINT_FIELD_PTR(prefix_, where_, field_) \ +# define PRINT_FIELD_PTR(prefix_, where_, field_) \ do { \ STRACE_PRINTF("%s%s=", (prefix_), #field_); \ printaddr((mpers_ptr_t) (where_).field_); \ } while (0) -#define PRINT_FIELD_FD(prefix_, where_, field_, tcp_) \ +# define PRINT_FIELD_FD(prefix_, where_, field_, tcp_) \ do { \ STRACE_PRINTF("%s%s=", (prefix_), #field_); \ printfd((tcp_), (where_).field_); \ } while (0) -#define PRINT_FIELD_STRN(prefix_, where_, field_, len_, tcp_) \ +# define PRINT_FIELD_STRN(prefix_, where_, field_, len_, tcp_) \ do { \ STRACE_PRINTF("%s%s=", (prefix_), #field_); \ printstrn((tcp_), (where_).field_, (len_)); \ } while (0) -#define PRINT_FIELD_STR(prefix_, where_, field_, tcp_) \ +# define PRINT_FIELD_STR(prefix_, where_, field_, tcp_) \ do { \ STRACE_PRINTF("%s%s=", (prefix_), #field_); \ printstr((tcp_), (where_).field_); \ } while (0) -#define PRINT_FIELD_PATH(prefix_, where_, field_, tcp_) \ +# define PRINT_FIELD_PATH(prefix_, where_, field_, tcp_) \ do { \ STRACE_PRINTF("%s%s=", (prefix_), #field_); \ printpath((tcp_), (where_).field_); \ } while (0) -#define PRINT_FIELD_MAC(prefix_, where_, field_) \ +# define PRINT_FIELD_MAC(prefix_, where_, field_) \ PRINT_FIELD_MAC_SZ((prefix_), (where_), field_, \ ARRAY_SIZE((where_).field_)) -#define PRINT_FIELD_MAC_SZ(prefix_, where_, field_, size_) \ +# define PRINT_FIELD_MAC_SZ(prefix_, where_, field_, size_) \ do { \ static_assert(sizeof(((where_).field_)[0]) == 1, \ "MAC address is not a byte array"); \ diff --git a/print_sg_req_info.c b/print_sg_req_info.c index 53e35924..dd567f2f 100644 --- a/print_sg_req_info.c +++ b/print_sg_req_info.c @@ -11,7 +11,7 @@ #ifdef HAVE_SCSI_SG_H -#include DEF_MPERS_TYPE(struct_sg_req_info) +# include DEF_MPERS_TYPE(struct_sg_req_info) # include diff --git a/printsiginfo.c b/printsiginfo.c index 5f30c762..9cfc4c63 100644 --- a/printsiginfo.c +++ b/printsiginfo.c @@ -25,7 +25,7 @@ #include "nr_prefix.c" #ifndef IN_MPERS -#include "printsiginfo.h" +# include "printsiginfo.h" #endif #include "xlat/audit_arch.h" diff --git a/printsiginfo.h b/printsiginfo.h index 7c726790..4088cb54 100644 --- a/printsiginfo.h +++ b/printsiginfo.h @@ -6,7 +6,7 @@ */ #ifndef STRACE_PRINTSIGINFO_H -#define STRACE_PRINTSIGINFO_H +# define STRACE_PRINTSIGINFO_H extern void printsiginfo(const siginfo_t *); diff --git a/process.c b/process.c index 3e57295d..d224c396 100644 --- a/process.c +++ b/process.c @@ -138,25 +138,25 @@ SYS_FUNC(ptrace) printaddr(addr); } -# if defined IA64 || defined SPARC || defined SPARC64 +#if defined IA64 || defined SPARC || defined SPARC64 switch (request) { -# ifdef IA64 +# ifdef IA64 case PTRACE_PEEKDATA: case PTRACE_PEEKTEXT: case PTRACE_PEEKUSER: /* data is ignored */ return RVAL_DECODED | RVAL_HEX; -# endif /* IA64 */ -# if defined SPARC || defined SPARC64 +# endif /* IA64 */ +# if defined SPARC || defined SPARC64 case PTRACE_GETREGS: case PTRACE_SETREGS: case PTRACE_GETFPREGS: case PTRACE_SETFPREGS: /* data is ignored */ return RVAL_DECODED; -# endif /* SPARC || SPARC64 */ +# endif /* SPARC || SPARC64 */ } -# endif /* IA64 || SPARC || SPARC64 */ +#endif /* IA64 || SPARC || SPARC64 */ tprints(", "); diff --git a/ptrace.h b/ptrace.h index 89d4b95d..e4a5851d 100644 --- a/ptrace.h +++ b/ptrace.h @@ -15,153 +15,153 @@ */ #ifndef STRACE_PTRACE_H -#define STRACE_PTRACE_H +# define STRACE_PTRACE_H -#include -#include +# include +# include -#ifdef HAVE_STRUCT_IA64_FPREG -# define ia64_fpreg XXX_ia64_fpreg -#endif -#ifdef HAVE_STRUCT_PT_ALL_USER_REGS -# define pt_all_user_regs XXX_pt_all_user_regs -#endif -#ifdef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS -# define ptrace_peeksiginfo_args XXX_ptrace_peeksiginfo_args -#endif +# ifdef HAVE_STRUCT_IA64_FPREG +# define ia64_fpreg XXX_ia64_fpreg +# endif +# ifdef HAVE_STRUCT_PT_ALL_USER_REGS +# define pt_all_user_regs XXX_pt_all_user_regs +# endif +# ifdef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS +# define ptrace_peeksiginfo_args XXX_ptrace_peeksiginfo_args +# endif -#include +# include -#ifdef HAVE_STRUCT_IA64_FPREG -# undef ia64_fpreg -#endif -#ifdef HAVE_STRUCT_PT_ALL_USER_REGS -# undef pt_all_user_regs -#endif -#ifdef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS -# undef ptrace_peeksiginfo_args -#endif +# ifdef HAVE_STRUCT_IA64_FPREG +# undef ia64_fpreg +# endif +# ifdef HAVE_STRUCT_PT_ALL_USER_REGS +# undef pt_all_user_regs +# endif +# ifdef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS +# undef ptrace_peeksiginfo_args +# endif -#if defined(SPARC) || defined(SPARC64) +# if defined(SPARC) || defined(SPARC64) /* * SPARC has a different PTRACE_DETACH value correctly defined in sys/ptrace.h, * but linux/ptrace.h clobbers it with the standard one. PTRACE_SUNDETACH is * also defined to the correct value by sys/ptrace.h, so use that instead. */ -# undef PTRACE_DETACH -# define PTRACE_DETACH PTRACE_SUNDETACH -#endif +# undef PTRACE_DETACH +# define PTRACE_DETACH PTRACE_SUNDETACH +# endif -#ifndef PTRACE_EVENT_FORK -# define PTRACE_EVENT_FORK 1 -#endif -#ifndef PTRACE_EVENT_VFORK -# define PTRACE_EVENT_VFORK 2 -#endif -#ifndef PTRACE_EVENT_CLONE -# define PTRACE_EVENT_CLONE 3 -#endif -#ifndef PTRACE_EVENT_EXEC -# define PTRACE_EVENT_EXEC 4 -#endif -#ifndef PTRACE_EVENT_VFORK_DONE -# define PTRACE_EVENT_VFORK_DONE 5 -#endif -#ifndef PTRACE_EVENT_EXIT -# define PTRACE_EVENT_EXIT 6 -#endif -#ifndef PTRACE_EVENT_SECCOMP -# define PTRACE_EVENT_SECCOMP 7 -#endif -#ifdef PTRACE_EVENT_STOP +# ifndef PTRACE_EVENT_FORK +# define PTRACE_EVENT_FORK 1 +# endif +# ifndef PTRACE_EVENT_VFORK +# define PTRACE_EVENT_VFORK 2 +# endif +# ifndef PTRACE_EVENT_CLONE +# define PTRACE_EVENT_CLONE 3 +# endif +# ifndef PTRACE_EVENT_EXEC +# define PTRACE_EVENT_EXEC 4 +# endif +# ifndef PTRACE_EVENT_VFORK_DONE +# define PTRACE_EVENT_VFORK_DONE 5 +# endif +# ifndef PTRACE_EVENT_EXIT +# define PTRACE_EVENT_EXIT 6 +# endif +# ifndef PTRACE_EVENT_SECCOMP +# define PTRACE_EVENT_SECCOMP 7 +# endif +# ifdef PTRACE_EVENT_STOP /* Linux 3.1 - 3.3 releases had a broken value. It was fixed in 3.4. */ -# if PTRACE_EVENT_STOP == 7 -# undef PTRACE_EVENT_STOP +# if PTRACE_EVENT_STOP == 7 +# undef PTRACE_EVENT_STOP +# endif +# endif +# ifndef PTRACE_EVENT_STOP +# define PTRACE_EVENT_STOP 128 # endif -#endif -#ifndef PTRACE_EVENT_STOP -# define PTRACE_EVENT_STOP 128 -#endif -#ifndef PTRACE_O_TRACESYSGOOD -# define PTRACE_O_TRACESYSGOOD 1 -#endif -#ifndef PTRACE_O_TRACEFORK -# define PTRACE_O_TRACEFORK (1 << PTRACE_EVENT_FORK) -#endif -#ifndef PTRACE_O_TRACEVFORK -# define PTRACE_O_TRACEVFORK (1 << PTRACE_EVENT_VFORK) -#endif -#ifndef PTRACE_O_TRACECLONE -# define PTRACE_O_TRACECLONE (1 << PTRACE_EVENT_CLONE) -#endif -#ifndef PTRACE_O_TRACEEXEC -# define PTRACE_O_TRACEEXEC (1 << PTRACE_EVENT_EXEC) -#endif -#ifndef PTRACE_O_TRACEVFORKDONE -# define PTRACE_O_TRACEVFORKDONE (1 << PTRACE_EVENT_VFORK_DONE) -#endif -#ifndef PTRACE_O_TRACEEXIT -# define PTRACE_O_TRACEEXIT (1 << PTRACE_EVENT_EXIT) -#endif -#ifndef PTRACE_O_TRACESECCOMP -# define PTRACE_O_TRACESECCOMP (1 << PTRACE_EVENT_SECCOMP) -#endif -#ifndef PTRACE_O_EXITKILL -# define PTRACE_O_EXITKILL (1 << 20) -#endif -#ifndef PTRACE_O_SUSPEND_SECCOMP -# define PTRACE_O_SUSPEND_SECCOMP (1 << 21) -#endif +# ifndef PTRACE_O_TRACESYSGOOD +# define PTRACE_O_TRACESYSGOOD 1 +# endif +# ifndef PTRACE_O_TRACEFORK +# define PTRACE_O_TRACEFORK (1 << PTRACE_EVENT_FORK) +# endif +# ifndef PTRACE_O_TRACEVFORK +# define PTRACE_O_TRACEVFORK (1 << PTRACE_EVENT_VFORK) +# endif +# ifndef PTRACE_O_TRACECLONE +# define PTRACE_O_TRACECLONE (1 << PTRACE_EVENT_CLONE) +# endif +# ifndef PTRACE_O_TRACEEXEC +# define PTRACE_O_TRACEEXEC (1 << PTRACE_EVENT_EXEC) +# endif +# ifndef PTRACE_O_TRACEVFORKDONE +# define PTRACE_O_TRACEVFORKDONE (1 << PTRACE_EVENT_VFORK_DONE) +# endif +# ifndef PTRACE_O_TRACEEXIT +# define PTRACE_O_TRACEEXIT (1 << PTRACE_EVENT_EXIT) +# endif +# ifndef PTRACE_O_TRACESECCOMP +# define PTRACE_O_TRACESECCOMP (1 << PTRACE_EVENT_SECCOMP) +# endif +# ifndef PTRACE_O_EXITKILL +# define PTRACE_O_EXITKILL (1 << 20) +# endif +# ifndef PTRACE_O_SUSPEND_SECCOMP +# define PTRACE_O_SUSPEND_SECCOMP (1 << 21) +# endif -#ifndef PTRACE_SETOPTIONS -# define PTRACE_SETOPTIONS 0x4200 -#endif -#ifndef PTRACE_GETEVENTMSG -# define PTRACE_GETEVENTMSG 0x4201 -#endif -#ifndef PTRACE_GETSIGINFO -# define PTRACE_GETSIGINFO 0x4202 -#endif -#ifndef PTRACE_SETSIGINFO -# define PTRACE_SETSIGINFO 0x4203 -#endif -#ifndef PTRACE_GETREGSET -# define PTRACE_GETREGSET 0x4204 -#endif -#ifndef PTRACE_SETREGSET -# define PTRACE_SETREGSET 0x4205 -#endif -#ifndef PTRACE_SEIZE -# define PTRACE_SEIZE 0x4206 -#endif -#ifndef PTRACE_INTERRUPT -# define PTRACE_INTERRUPT 0x4207 -#endif -#ifndef PTRACE_LISTEN -# define PTRACE_LISTEN 0x4208 -#endif -#ifndef PTRACE_PEEKSIGINFO -# define PTRACE_PEEKSIGINFO 0x4209 -#endif -#ifndef PTRACE_GETSIGMASK -# define PTRACE_GETSIGMASK 0x420a -#endif -#ifndef PTRACE_SETSIGMASK -# define PTRACE_SETSIGMASK 0x420b -#endif -#ifndef PTRACE_SECCOMP_GET_FILTER -# define PTRACE_SECCOMP_GET_FILTER 0x420c -#endif -#ifndef PTRACE_SECCOMP_GET_METADATA -# define PTRACE_SECCOMP_GET_METADATA 0x420d -#endif -#ifndef PTRACE_GET_SYSCALL_INFO -# define PTRACE_GET_SYSCALL_INFO 0x420e -# define PTRACE_SYSCALL_INFO_NONE 0 -# define PTRACE_SYSCALL_INFO_ENTRY 1 -# define PTRACE_SYSCALL_INFO_EXIT 2 -# define PTRACE_SYSCALL_INFO_SECCOMP 3 +# ifndef PTRACE_SETOPTIONS +# define PTRACE_SETOPTIONS 0x4200 +# endif +# ifndef PTRACE_GETEVENTMSG +# define PTRACE_GETEVENTMSG 0x4201 +# endif +# ifndef PTRACE_GETSIGINFO +# define PTRACE_GETSIGINFO 0x4202 +# endif +# ifndef PTRACE_SETSIGINFO +# define PTRACE_SETSIGINFO 0x4203 +# endif +# ifndef PTRACE_GETREGSET +# define PTRACE_GETREGSET 0x4204 +# endif +# ifndef PTRACE_SETREGSET +# define PTRACE_SETREGSET 0x4205 +# endif +# ifndef PTRACE_SEIZE +# define PTRACE_SEIZE 0x4206 +# endif +# ifndef PTRACE_INTERRUPT +# define PTRACE_INTERRUPT 0x4207 +# endif +# ifndef PTRACE_LISTEN +# define PTRACE_LISTEN 0x4208 +# endif +# ifndef PTRACE_PEEKSIGINFO +# define PTRACE_PEEKSIGINFO 0x4209 +# endif +# ifndef PTRACE_GETSIGMASK +# define PTRACE_GETSIGMASK 0x420a +# endif +# ifndef PTRACE_SETSIGMASK +# define PTRACE_SETSIGMASK 0x420b +# endif +# ifndef PTRACE_SECCOMP_GET_FILTER +# define PTRACE_SECCOMP_GET_FILTER 0x420c +# endif +# ifndef PTRACE_SECCOMP_GET_METADATA +# define PTRACE_SECCOMP_GET_METADATA 0x420d +# endif +# ifndef PTRACE_GET_SYSCALL_INFO +# define PTRACE_GET_SYSCALL_INFO 0x420e +# define PTRACE_SYSCALL_INFO_NONE 0 +# define PTRACE_SYSCALL_INFO_ENTRY 1 +# define PTRACE_SYSCALL_INFO_EXIT 2 +# define PTRACE_SYSCALL_INFO_SECCOMP 3 struct ptrace_syscall_info { uint8_t op; uint8_t pad[3]; @@ -184,13 +184,13 @@ struct ptrace_syscall_info { } seccomp; }; }; -#endif +# endif -#if !HAVE_DECL_PTRACE_PEEKUSER -# define PTRACE_PEEKUSER PTRACE_PEEKUSR -#endif -#if !HAVE_DECL_PTRACE_POKEUSER -# define PTRACE_POKEUSER PTRACE_POKEUSR -#endif +# if !HAVE_DECL_PTRACE_PEEKUSER +# define PTRACE_PEEKUSER PTRACE_PEEKUSR +# endif +# if !HAVE_DECL_PTRACE_POKEUSER +# define PTRACE_POKEUSER PTRACE_POKEUSR +# endif #endif /* !STRACE_PTRACE_H */ diff --git a/ptrace_syscall_info.h b/ptrace_syscall_info.h index 3bbafc28..b70e5c6d 100644 --- a/ptrace_syscall_info.h +++ b/ptrace_syscall_info.h @@ -6,7 +6,7 @@ */ #ifndef STRACE_PTRACE_SYSCALL_INFO_H -#define STRACE_PTRACE_SYSCALL_INFO_H +# define STRACE_PTRACE_SYSCALL_INFO_H extern bool ptrace_get_syscall_info_supported; extern bool test_ptrace_get_syscall_info(void); diff --git a/random_ioctl.c b/random_ioctl.c index 0bced68a..36612b2f 100644 --- a/random_ioctl.c +++ b/random_ioctl.c @@ -12,7 +12,7 @@ #include #define XLAT_MACROS_ONLY -# include "xlat/random_ioctl_cmds.h" +#include "xlat/random_ioctl_cmds.h" #undef XLAT_MACROS_ONLY /* diff --git a/regs.h b/regs.h index bdcb72fe..29d8a9ce 100644 --- a/regs.h +++ b/regs.h @@ -6,9 +6,9 @@ */ #ifndef STRACE_REGS_H -#define STRACE_REGS_H +# define STRACE_REGS_H -#include -#include "arch_regs.h" +# include +# include "arch_regs.h" #endif /* !STRACE_REGS_H */ diff --git a/retval.h b/retval.h index b9bdfa92..c7a187e3 100644 --- a/retval.h +++ b/retval.h @@ -7,7 +7,7 @@ /* retval to index and visa versa. */ #ifndef STRACE_RETVAL_H -#define STRACE_RETVAL_H +# define STRACE_RETVAL_H uint16_t retval_new(kernel_long_t rval); kernel_long_t retval_get(uint16_t rval_idx); diff --git a/rt_sigframe.c b/rt_sigframe.c index 6ee4a612..32f47951 100644 --- a/rt_sigframe.c +++ b/rt_sigframe.c @@ -10,8 +10,8 @@ #include "ptrace.h" #include "regs.h" -#define DEF_FUNC_GET_RT_SIGFRAME_ADDR \ +#define DEF_FUNC_GET_RT_SIGFRAME_ADDR \ kernel_ulong_t get_rt_sigframe_addr(struct tcb *tcp) -#define FUNC_GET_RT_SIGFRAME_ADDR DEF_FUNC_GET_RT_SIGFRAME_ADDR +#define FUNC_GET_RT_SIGFRAME_ADDR DEF_FUNC_GET_RT_SIGFRAME_ADDR #include "arch_rt_sigframe.c" diff --git a/rtnl_link.c b/rtnl_link.c index f0e83fe7..92bc1e03 100644 --- a/rtnl_link.c +++ b/rtnl_link.c @@ -463,10 +463,10 @@ decode_rtnl_link_stats64(struct tcb *const tcp, PRINT_FIELD_U(", ", st, rx_compressed); PRINT_FIELD_U(", ", st, tx_compressed); -#ifdef HAVE_STRUCT_RTNL_LINK_STATS64_RX_NOHANDLER +# ifdef HAVE_STRUCT_RTNL_LINK_STATS64_RX_NOHANDLER if (len >= def_size) PRINT_FIELD_U(", ", st, rx_nohandler); -#endif +# endif tprints("}"); } diff --git a/rtnl_neightbl.c b/rtnl_neightbl.c index a4c4cc80..f9f5756b 100644 --- a/rtnl_neightbl.c +++ b/rtnl_neightbl.c @@ -114,10 +114,10 @@ decode_ndt_stats(struct tcb *const tcp, PRINT_FIELD_U(", ", ndtst, ndts_rcv_probes_ucast); PRINT_FIELD_U(", ", ndtst, ndts_periodic_gc_runs); PRINT_FIELD_U(", ", ndtst, ndts_forced_gc_runs); -#ifdef HAVE_STRUCT_NDT_STATS_NDTS_TABLE_FULLS +# ifdef HAVE_STRUCT_NDT_STATS_NDTS_TABLE_FULLS if (len >= def_size) PRINT_FIELD_U(", ", ndtst, ndts_table_fulls); -#endif +# endif tprints("}"); } diff --git a/s390.c b/s390.c index 7c20bdc3..a650b23f 100644 --- a/s390.c +++ b/s390.c @@ -11,13 +11,13 @@ #if defined S390 || defined S390X -#include +# include -#include "print_fields.h" +# include "print_fields.h" -#include "xlat/s390_guarded_storage_commands.h" -#include "xlat/s390_runtime_instr_commands.h" -#include "xlat/s390_sthyi_function_codes.h" +# include "xlat/s390_guarded_storage_commands.h" +# include "xlat/s390_runtime_instr_commands.h" +# include "xlat/s390_sthyi_function_codes.h" /* * Since, for some reason, kernel doesn't expose all these nice constants and @@ -401,10 +401,10 @@ decode_ebcdic(const char *ebcdic, char *ascii, size_t size) *ascii++ = conv_table[(unsigned char) *ebcdic++]; } -#define DECODE_EBCDIC(ebcdic_, ascii_) \ +# define DECODE_EBCDIC(ebcdic_, ascii_) \ decode_ebcdic((ebcdic_), (ascii_), \ sizeof(ebcdic_) + MUST_BE_ARRAY(ebcdic_)) -#define PRINT_EBCDIC(ebcdic_) \ +# define PRINT_EBCDIC(ebcdic_) \ do { \ char ascii_str[sizeof(ebcdic_) + MUST_BE_ARRAY(ebcdic_)]; \ \ @@ -413,13 +413,13 @@ decode_ebcdic(const char *ebcdic, char *ascii, size_t size) QUOTE_EMIT_COMMENT); \ } while (0) -#define PRINT_FIELD_EBCDIC(prefix_, where_, field_) \ +# define PRINT_FIELD_EBCDIC(prefix_, where_, field_) \ do { \ PRINT_FIELD_HEX_ARRAY(prefix_, where_, field_); \ PRINT_EBCDIC((where_).field_); \ } while (0) -#define PRINT_FIELD_WEIGHT(prefix_, where_, field_) \ +# define PRINT_FIELD_WEIGHT(prefix_, where_, field_) \ do { \ PRINT_FIELD_X(prefix_, where_, field_); \ if ((where_).field_) \ @@ -431,10 +431,10 @@ decode_ebcdic(const char *ebcdic, char *ascii, size_t size) } while (0) -#define IS_BLANK(arr_) /* 0x40 is space in EBCDIC */ \ +# define IS_BLANK(arr_) /* 0x40 is space in EBCDIC */ \ is_filled(arr_, '\x40', sizeof(arr_) + MUST_BE_ARRAY(arr_)) -#define CHECK_SIZE(hdr_, size_, name_, ...) \ +# define CHECK_SIZE(hdr_, size_, name_, ...) \ do { \ if ((size_) < sizeof(*(hdr_))) { \ tprintf_comment("Invalid " name_ " with size " \ @@ -448,7 +448,7 @@ decode_ebcdic(const char *ebcdic, char *ascii, size_t size) } \ } while (0) -#define PRINT_UNKNOWN_TAIL(hdr_, size_) \ +# define PRINT_UNKNOWN_TAIL(hdr_, size_) \ do { \ if ((size_) > sizeof(*(hdr_)) && \ !is_filled((char *) ((hdr_) + 1), '\0', \ @@ -842,7 +842,7 @@ print_sthyi_guest(struct tcb *tcp, struct sthyi_guest *hdr, uint16_t size, tprints("}"); } -#define STHYI_PRINT_STRUCT(l_, name_) \ +# define STHYI_PRINT_STRUCT(l_, name_) \ do { \ if (hdr->inf ##l_## off && hdr->inf ##l_## off + \ hdr->inf ##l_## len <= sizeof(data)) { \ @@ -853,7 +853,7 @@ print_sthyi_guest(struct tcb *tcp, struct sthyi_guest *hdr, uint16_t size, } \ } while (0) -#define STHYI_PRINT_HV_STRUCT(l_, n_, name_) \ +# define STHYI_PRINT_HV_STRUCT(l_, n_, name_) \ do { \ if (hdr->inf ##l_## off ##n_ && hdr->inf ##l_## off ##n_ + \ hdr->inf ##l_## len ##n_ <= sizeof(data)) { \ diff --git a/sched_attr.h b/sched_attr.h index c22c9656..c305ccfb 100644 --- a/sched_attr.h +++ b/sched_attr.h @@ -6,7 +6,7 @@ */ #ifndef STRACE_SCHED_ATTR_H -#define STRACE_SCHED_ATTR_H +# define STRACE_SCHED_ATTR_H # include diff --git a/sg_io_v3.c b/sg_io_v3.c index bfe04afd..7656c6ff 100644 --- a/sg_io_v3.c +++ b/sg_io_v3.c @@ -11,7 +11,7 @@ #ifdef HAVE_SCSI_SG_H -#include DEF_MPERS_TYPE(struct_sg_io_hdr) +# include DEF_MPERS_TYPE(struct_sg_io_hdr) # include @@ -40,7 +40,7 @@ print_sg_io_buffer(struct tcb *const tcp, const kernel_ulong_t addr, } } -#define PRINT_FIELD_SG_IO_BUFFER(prefix_, where_, field_, size_, count_, tcp_) \ +# define PRINT_FIELD_SG_IO_BUFFER(prefix_, where_, field_, size_, count_, tcp_) \ do { \ STRACE_PRINTF("%s%s=", (prefix_), #field_); \ print_sg_io_buffer((tcp_), (mpers_ptr_t)((where_).field_), \ diff --git a/sg_io_v4.c b/sg_io_v4.c index 44635a45..df73ed60 100644 --- a/sg_io_v4.c +++ b/sg_io_v4.c @@ -28,7 +28,7 @@ print_sg_io_buffer(struct tcb *const tcp, const kernel_ulong_t addr, } } -#define PRINT_FIELD_SG_IO_BUFFER(prefix_, where_, field_, size_, count_, tcp_) \ +# define PRINT_FIELD_SG_IO_BUFFER(prefix_, where_, field_, size_, count_, tcp_) \ do { \ STRACE_PRINTF("%s%s=", (prefix_), #field_); \ print_sg_io_buffer((tcp_), (where_).field_, (size_), (count_)); \ diff --git a/sigevent.h b/sigevent.h index 475582f8..c2228a96 100644 --- a/sigevent.h +++ b/sigevent.h @@ -6,7 +6,7 @@ */ #ifndef STRACE_SIGEVENT_H -#define STRACE_SIGEVENT_H +# define STRACE_SIGEVENT_H typedef struct { union { diff --git a/signal.c b/signal.c index 660790be..418905f0 100644 --- a/signal.c +++ b/signal.c @@ -538,9 +538,9 @@ decode_new_sigaction(struct tcb *const tcp, const kernel_ulong_t addr) memset(&sa, 0, sizeof(sa)); sa.sa_handler__ = sa32.sa_handler__; sa.sa_flags = sa32.sa_flags; -#if HAVE_SA_RESTORER && defined SA_RESTORER +# if HAVE_SA_RESTORER && defined SA_RESTORER sa.sa_restorer = sa32.sa_restorer; -#endif +# endif /* Kernel treats sa_mask as an array of longs. * For 32-bit process, "long" is uint32_t, thus, for example, * 32th bit in sa_mask will end up as bit 0 in sa_mask[1]. diff --git a/sock.c b/sock.c index 6d5d5b3a..a0152bdd 100644 --- a/sock.c +++ b/sock.c @@ -28,7 +28,7 @@ typedef struct ifreq struct_ifreq; #include "xlat/iffflags.h" #define XLAT_MACROS_ONLY -# include "xlat/arp_hardware_types.h" +#include "xlat/arp_hardware_types.h" #undef XLAT_MACROS_ONLY static void diff --git a/socketutils.c b/socketutils.c index a981925b..d6191187 100644 --- a/socketutils.c +++ b/socketutils.c @@ -27,7 +27,7 @@ #include "xstring.h" #define XLAT_MACROS_ONLY -# include "xlat/inet_protocols.h" +#include "xlat/inet_protocols.h" #undef XLAT_MACROS_ONLY typedef struct { diff --git a/sram_alloc.c b/sram_alloc.c index 23ba8d12..c18e7660 100644 --- a/sram_alloc.c +++ b/sram_alloc.c @@ -9,9 +9,9 @@ #ifdef BFIN -#include +# include -#include "xlat/sram_alloc_flags.h" +# include "xlat/sram_alloc_flags.h" SYS_FUNC(sram_alloc) { diff --git a/stat.h b/stat.h index 07502871..bc1ba90e 100644 --- a/stat.h +++ b/stat.h @@ -7,7 +7,7 @@ */ #ifndef STRACE_STAT_H -#define STRACE_STAT_H +# define STRACE_STAT_H struct strace_stat { unsigned long long dev; diff --git a/statfs.h b/statfs.h index 3bd456ac..d2ac192c 100644 --- a/statfs.h +++ b/statfs.h @@ -6,7 +6,7 @@ */ #ifndef STRACE_STATFS_H -#define STRACE_STATFS_H +# define STRACE_STATFS_H struct strace_statfs { unsigned long long f_type; diff --git a/static_assert.h b/static_assert.h old mode 100755 new mode 100644 index ebad6d79..0bcfa80d --- a/static_assert.h +++ b/static_assert.h @@ -6,24 +6,24 @@ */ #ifndef STRACE_STATIC_ASSERT_H -#define STRACE_STATIC_ASSERT_H +# define STRACE_STATIC_ASSERT_H -#include "assert.h" +# include "assert.h" -#if defined HAVE_STATIC_ASSERT +# if defined HAVE_STATIC_ASSERT /* static_assert is already available */ -#elif defined HAVE__STATIC_ASSERT +# elif defined HAVE__STATIC_ASSERT -# undef static_assert -# define static_assert _Static_assert +# undef static_assert +# define static_assert _Static_assert -#else /* !HAVE_STATIC_ASSERT && !HAVE__STATIC_ASSERT */ +# else /* !HAVE_STATIC_ASSERT && !HAVE__STATIC_ASSERT */ -# define static_assert(expr, message) \ +# define static_assert(expr, message) \ extern int (*strace_static_assert(int))[sizeof(int[2 * !!(expr) - 1])] -#endif +# endif #endif /* !STRACE_STATIC_ASSERT_H */ diff --git a/statx.h b/statx.h index f9de5824..e4d8a26d 100644 --- a/statx.h +++ b/statx.h @@ -6,9 +6,9 @@ */ #ifndef STRACE_STATX_H -#define STRACE_STATX_H +# define STRACE_STATX_H -#include +# include typedef struct { int64_t sec; diff --git a/strace.c b/strace.c index d4aae01b..06e2796a 100644 --- a/strace.c +++ b/strace.c @@ -171,10 +171,10 @@ static void timer_sighandler(int); #ifndef HAVE_STRERROR -#if !HAVE_DECL_SYS_ERRLIST +# if !HAVE_DECL_SYS_ERRLIST extern int sys_nerr; extern char *sys_errlist[]; -#endif +# endif const char * strerror(int err_no) diff --git a/string_to_uint.h b/string_to_uint.h index 3f9608bf..3eb9c8e7 100644 --- a/string_to_uint.h +++ b/string_to_uint.h @@ -6,11 +6,11 @@ */ #ifndef STRACE_STRING_TO_UINT_H -#define STRACE_STRING_TO_UINT_H +# define STRACE_STRING_TO_UINT_H -#include +# include -#include "kernel_types.h" +# include "kernel_types.h" extern long long string_to_uint_ex(const char *str, char **endptr, diff --git a/syscall.c b/syscall.c index a4e3ea54..d78f51dd 100644 --- a/syscall.c +++ b/syscall.c @@ -162,27 +162,27 @@ const struct_sysent *const sysent_vec[SUPPORTED_PERSONALITIES] = { }; const char *const personality_names[] = -# if defined X86_64 +#if defined X86_64 {"64 bit", "32 bit", "x32"} -# elif defined X32 +#elif defined X32 {"x32", "32 bit"} -# elif SUPPORTED_PERSONALITIES == 2 +#elif SUPPORTED_PERSONALITIES == 2 {"64 bit", "32 bit"} -# else +#else {STRINGIFY_VAL(__WORDSIZE) " bit"} -# endif +#endif ; const char *const personality_designators[] = -# if defined X86_64 +#if defined X86_64 { "64", "32", "x32" } -# elif defined X32 +#elif defined X32 { "x32", "32" } -# elif SUPPORTED_PERSONALITIES == 2 +#elif SUPPORTED_PERSONALITIES == 2 { "64", "32" } -# else +#else { STRINGIFY_VAL(__WORDSIZE) } -# endif +#endif ; #if SUPPORTED_PERSONALITIES > 1 @@ -194,9 +194,9 @@ unsigned current_wordsize = PERSONALITY0_WORDSIZE; static const int personality_wordsize[SUPPORTED_PERSONALITIES] = { PERSONALITY0_WORDSIZE, PERSONALITY1_WORDSIZE, -# if SUPPORTED_PERSONALITIES > 2 +# if SUPPORTED_PERSONALITIES > 2 PERSONALITY2_WORDSIZE, -# endif +# endif }; # endif @@ -956,7 +956,7 @@ ptrace_syscall_info_is_valid(void) } #define XLAT_MACROS_ONLY -# include "xlat/nt_descriptor_types.h" +#include "xlat/nt_descriptor_types.h" #undef XLAT_MACROS_ONLY #define ARCH_MIGHT_USE_SET_REGS 1 diff --git a/sysent.h b/sysent.h index 71119a99..336a30bf 100644 --- a/sysent.h +++ b/sysent.h @@ -6,7 +6,7 @@ */ #ifndef STRACE_SYSENT_H -#define STRACE_SYSENT_H +# define STRACE_SYSENT_H typedef struct sysent { unsigned nargs; @@ -16,25 +16,25 @@ typedef struct sysent { const char *sys_name; } struct_sysent; -#define TRACE_FILE 00000001 /* Trace file-related syscalls. */ -#define TRACE_IPC 00000002 /* Trace IPC-related syscalls. */ -#define TRACE_NETWORK 00000004 /* Trace network-related syscalls. */ -#define TRACE_PROCESS 00000010 /* Trace process-related syscalls. */ -#define TRACE_SIGNAL 00000020 /* Trace signal-related syscalls. */ -#define TRACE_DESC 00000040 /* Trace file descriptor-related syscalls. */ -#define TRACE_MEMORY 00000100 /* Trace memory mapping-related syscalls. */ -#define SYSCALL_NEVER_FAILS 00000200 /* Syscall is always successful. */ -#define MEMORY_MAPPING_CHANGE 00000400 /* Trigger proc/maps cache updating */ -#define STACKTRACE_CAPTURE_ON_ENTER 00001000 /* Capture stacktrace on "entering" stage */ -#define TRACE_INDIRECT_SUBCALL 00002000 /* Syscall is an indirect socket/ipc subcall. */ -#define COMPAT_SYSCALL_TYPES 00004000 /* A compat syscall that uses compat types. */ -#define TRACE_STAT 00010000 /* Trace {,*_}{,old}{,x}stat{,64} syscalls. */ -#define TRACE_LSTAT 00020000 /* Trace *lstat* syscalls. */ -#define TRACE_STATFS 00040000 /* Trace statfs, statfs64, and statvfs syscalls. */ -#define TRACE_FSTATFS 00100000 /* Trace fstatfs, fstatfs64 and fstatvfs syscalls. */ -#define TRACE_STATFS_LIKE 00200000 /* Trace statfs-like, fstatfs-like and ustat syscalls. */ -#define TRACE_FSTAT 00400000 /* Trace *fstat{,at}{,64} syscalls. */ -#define TRACE_STAT_LIKE 01000000 /* Trace *{,l,f}stat{,x,at}{,64} syscalls. */ -#define TRACE_PURE 02000000 /* Trace getter syscalls with no arguments. */ +# define TRACE_FILE 00000001 /* Trace file-related syscalls. */ +# define TRACE_IPC 00000002 /* Trace IPC-related syscalls. */ +# define TRACE_NETWORK 00000004 /* Trace network-related syscalls. */ +# define TRACE_PROCESS 00000010 /* Trace process-related syscalls. */ +# define TRACE_SIGNAL 00000020 /* Trace signal-related syscalls. */ +# define TRACE_DESC 00000040 /* Trace file descriptor-related syscalls. */ +# define TRACE_MEMORY 00000100 /* Trace memory mapping-related syscalls. */ +# define SYSCALL_NEVER_FAILS 00000200 /* Syscall is always successful. */ +# define MEMORY_MAPPING_CHANGE 00000400 /* Trigger proc/maps cache updating */ +# define STACKTRACE_CAPTURE_ON_ENTER 00001000 /* Capture stacktrace on "entering" stage */ +# define TRACE_INDIRECT_SUBCALL 00002000 /* Syscall is an indirect socket/ipc subcall. */ +# define COMPAT_SYSCALL_TYPES 00004000 /* A compat syscall that uses compat types. */ +# define TRACE_STAT 00010000 /* Trace {,*_}{,old}{,x}stat{,64} syscalls. */ +# define TRACE_LSTAT 00020000 /* Trace *lstat* syscalls. */ +# define TRACE_STATFS 00040000 /* Trace statfs, statfs64, and statvfs syscalls. */ +# define TRACE_FSTATFS 00100000 /* Trace fstatfs, fstatfs64 and fstatvfs syscalls. */ +# define TRACE_STATFS_LIKE 00200000 /* Trace statfs-like, fstatfs-like and ustat syscalls. */ +# define TRACE_FSTAT 00400000 /* Trace *fstat{,at}{,64} syscalls. */ +# define TRACE_STAT_LIKE 01000000 /* Trace *{,l,f}stat{,x,at}{,64} syscalls. */ +# define TRACE_PURE 02000000 /* Trace getter syscalls with no arguments. */ #endif /* !STRACE_SYSENT_H */ diff --git a/sysmips.c b/sysmips.c index d2b4b837..b0b7eea2 100644 --- a/sysmips.c +++ b/sysmips.c @@ -11,18 +11,18 @@ #ifdef MIPS -#ifdef HAVE_LINUX_UTSNAME_H -# include -#endif -#ifdef HAVE_ASM_SYSMIPS_H -# include -#endif - -#ifndef __NEW_UTS_LEN -# define __NEW_UTS_LEN 64 -#endif - -#include "xlat/sysmips_operations.h" +# ifdef HAVE_LINUX_UTSNAME_H +# include +# endif +# ifdef HAVE_ASM_SYSMIPS_H +# include +# endif + +# ifndef __NEW_UTS_LEN +# define __NEW_UTS_LEN 64 +# endif + +# include "xlat/sysmips_operations.h" SYS_FUNC(sysmips) { diff --git a/test/skodic.c b/test/skodic.c index fa60ea7d..4152ad65 100644 --- a/test/skodic.c +++ b/test/skodic.c @@ -9,7 +9,7 @@ */ #ifndef _GNU_SOURCE -# define _GNU_SOURCE 1 +# define _GNU_SOURCE 1 #endif #include diff --git a/test/threaded_execve.c b/test/threaded_execve.c index f2b2bce4..80726fe0 100644 --- a/test/threaded_execve.c +++ b/test/threaded_execve.c @@ -53,12 +53,12 @@ #ifdef __ia64__ extern int __clone2(int (*fn) (void *), void *child_stack_base, size_t stack_size, int flags, void *arg, ...); -#define clone2 __clone2 +# define clone2 __clone2 #elif defined(__metag__) -#define clone2(func, stack_base, size, flags, arg...) \ +# define clone2(func, stack_base, size, flags, arg...) \ clone(func, stack_base, flags, arg) #else -#define clone2(func, stack_base, size, flags, arg...) \ +# define clone2(func, stack_base, size, flags, arg...) \ clone(func, (stack_base) + (size), flags, arg) #endif /* Direct calls to syscalls, avoiding libc wrappers */ diff --git a/tests/accept_compat.h b/tests/accept_compat.h index 7925d589..0fbdc690 100644 --- a/tests/accept_compat.h +++ b/tests/accept_compat.h @@ -6,13 +6,13 @@ */ #ifndef _STRACE_TESTS_ACCEPT_COMPAT_H_ -#define _STRACE_TESTS_ACCEPT_COMPAT_H_ +# define _STRACE_TESTS_ACCEPT_COMPAT_H_ -#include -#include -#include +# include +# include +# include -#if defined __NR_socketcall && defined __sparc__ +# if defined __NR_socketcall && defined __sparc__ /* * Work around the fact that * - glibc >= 2.26 uses accept4 syscall to implement accept() call on sparc; @@ -25,8 +25,8 @@ do_accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen) return syscall(__NR_socketcall, 5, args); } -#else -# define do_accept accept -#endif +# else +# define do_accept accept +# endif #endif /* !_STRACE_TESTS_ACCEPT_COMPAT_H_ */ diff --git a/tests/bpf-obj_get_info_by_fd.c b/tests/bpf-obj_get_info_by_fd.c index b6a8e462..e95afda2 100644 --- a/tests/bpf-obj_get_info_by_fd.c +++ b/tests/bpf-obj_get_info_by_fd.c @@ -273,7 +273,7 @@ main(void) * This has to be a macro, otherwise the compiler complains that * initializer element is not constant. */ - #define MAP_INFO_SZ (sizeof(*map_info) + 64) +#define MAP_INFO_SZ (sizeof(*map_info) + 64) struct bpf_map_info_struct *map_info = calloc(1, MAP_INFO_SZ); struct BPF_OBJ_GET_INFO_BY_FD_struct bpf_map_get_info_attr = { .bpf_fd = map_fd, @@ -329,7 +329,7 @@ main(void) * This has to be a macro, otherwise the compiler complains that * initializer element is not constant. */ - #define PROG_INFO_SZ (sizeof(*prog_info) + 64) +# define PROG_INFO_SZ (sizeof(*prog_info) + 64) struct bpf_prog_info_struct *prog_info = calloc(1, PROG_INFO_SZ); struct bpf_insn *xlated_prog = tail_alloc(sizeof(*xlated_prog) * 42); uint32_t *map_ids = tail_alloc(sizeof(*map_ids) * 2); diff --git a/tests/btrfs.c b/tests/btrfs.c index e69438e2..27ace56f 100644 --- a/tests/btrfs.c +++ b/tests/btrfs.c @@ -9,65 +9,65 @@ #ifdef HAVE_LINUX_BTRFS_H -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "xlat.h" - -#include "xlat/btrfs_balance_args.h" -#include "xlat/btrfs_balance_flags.h" -#include "xlat/btrfs_balance_state.h" -#include "xlat/btrfs_compress_types.h" -#include "xlat/btrfs_cont_reading_from_srcdev_mode.h" -#include "xlat/btrfs_defrag_flags.h" -#include "xlat/btrfs_dev_stats_values.h" -#include "xlat/btrfs_dev_stats_flags.h" -#include "xlat/btrfs_qgroup_inherit_flags.h" -#include "xlat/btrfs_qgroup_limit_flags.h" -#include "xlat/btrfs_scrub_flags.h" -#include "xlat/btrfs_send_flags.h" -#include "xlat/btrfs_space_info_flags.h" -#include "xlat/btrfs_snap_flags_v2.h" -#include "xlat/btrfs_tree_objectids.h" -#include "xlat/btrfs_features_compat.h" -#include "xlat/btrfs_features_compat_ro.h" -#include "xlat/btrfs_features_incompat.h" -#include "xlat/btrfs_key_types.h" - -#ifdef HAVE_LINUX_FIEMAP_H -# include -# include "xlat/fiemap_flags.h" -# include "xlat/fiemap_extent_flags.h" -#endif - -#ifndef BTRFS_LABEL_SIZE -# define BTRFS_LABEL_SIZE 256 -#endif - -#ifndef BTRFS_NAME_LEN -# define BTRFS_NAME_LEN 255 -#endif - -#ifndef FS_IOC_GETFSLABEL -# define FS_IOC_GETFSLABEL BTRFS_IOC_GET_FSLABEL -#endif - -#ifndef FS_IOC_SETFSLABEL -# define FS_IOC_SETFSLABEL BTRFS_IOC_SET_FSLABEL -#endif +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include "xlat.h" + +# include "xlat/btrfs_balance_args.h" +# include "xlat/btrfs_balance_flags.h" +# include "xlat/btrfs_balance_state.h" +# include "xlat/btrfs_compress_types.h" +# include "xlat/btrfs_cont_reading_from_srcdev_mode.h" +# include "xlat/btrfs_defrag_flags.h" +# include "xlat/btrfs_dev_stats_values.h" +# include "xlat/btrfs_dev_stats_flags.h" +# include "xlat/btrfs_qgroup_inherit_flags.h" +# include "xlat/btrfs_qgroup_limit_flags.h" +# include "xlat/btrfs_scrub_flags.h" +# include "xlat/btrfs_send_flags.h" +# include "xlat/btrfs_space_info_flags.h" +# include "xlat/btrfs_snap_flags_v2.h" +# include "xlat/btrfs_tree_objectids.h" +# include "xlat/btrfs_features_compat.h" +# include "xlat/btrfs_features_compat_ro.h" +# include "xlat/btrfs_features_incompat.h" +# include "xlat/btrfs_key_types.h" + +# ifdef HAVE_LINUX_FIEMAP_H +# include +# include "xlat/fiemap_flags.h" +# include "xlat/fiemap_extent_flags.h" +# endif + +# ifndef BTRFS_LABEL_SIZE +# define BTRFS_LABEL_SIZE 256 +# endif + +# ifndef BTRFS_NAME_LEN +# define BTRFS_NAME_LEN 255 +# endif + +# ifndef FS_IOC_GETFSLABEL +# define FS_IOC_GETFSLABEL BTRFS_IOC_GET_FSLABEL +# endif + +# ifndef FS_IOC_SETFSLABEL +# define FS_IOC_SETFSLABEL BTRFS_IOC_SET_FSLABEL +# endif /* * Prior to Linux 3.12, the BTRFS_IOC_DEFAULT_SUBVOL used u64 in @@ -92,38 +92,38 @@ const unsigned char uuid_reference[BTRFS_UUID_SIZE] = { const char uuid_reference_string[] = "01234567-89ab-cdef-fedc-ba9876543210"; -#ifndef BTRFS_IOC_QUOTA_RESCAN +# ifndef BTRFS_IOC_QUOTA_RESCAN struct btrfs_ioctl_quota_rescan_args { uint64_t flags, progress, reserved[6]; }; -# define BTRFS_IOC_QUOTA_RESCAN \ +# define BTRFS_IOC_QUOTA_RESCAN \ _IOW(BTRFS_IOCTL_MAGIC, 44, struct btrfs_ioctl_quota_rescan_args) -# define BTRFS_IOC_QUOTA_RESCAN_STATUS \ +# define BTRFS_IOC_QUOTA_RESCAN_STATUS \ _IOR(BTRFS_IOCTL_MAGIC, 45, struct btrfs_ioctl_quota_rescan_args) -#endif +# endif -#ifndef BTRFS_IOC_QUOTA_RESCAN_WAIT -# define BTRFS_IOC_QUOTA_RESCAN_WAIT _IO(BTRFS_IOCTL_MAGIC, 46) -#endif +# ifndef BTRFS_IOC_QUOTA_RESCAN_WAIT +# define BTRFS_IOC_QUOTA_RESCAN_WAIT _IO(BTRFS_IOCTL_MAGIC, 46) +# endif -#ifndef BTRFS_IOC_GET_FEATURES -# define BTRFS_IOC_GET_FEATURES \ +# ifndef BTRFS_IOC_GET_FEATURES +# define BTRFS_IOC_GET_FEATURES \ _IOR(BTRFS_IOCTL_MAGIC, 57, struct btrfs_ioctl_feature_flags) -# define BTRFS_IOC_SET_FEATURES \ +# define BTRFS_IOC_SET_FEATURES \ _IOW(BTRFS_IOCTL_MAGIC, 57, struct btrfs_ioctl_feature_flags[2]) -# define BTRFS_IOC_GET_SUPPORTED_FEATURES \ +# define BTRFS_IOC_GET_SUPPORTED_FEATURES \ _IOR(BTRFS_IOCTL_MAGIC, 57, struct btrfs_ioctl_feature_flags[3]) -#endif +# endif -#ifndef HAVE_STRUCT_BTRFS_IOCTL_FEATURE_FLAGS_COMPAT_FLAGS +# ifndef HAVE_STRUCT_BTRFS_IOCTL_FEATURE_FLAGS_COMPAT_FLAGS struct btrfs_ioctl_feature_flags { uint64_t compat_flags; uint64_t compat_ro_flags; uint64_t incompat_flags; }; -#endif +# endif -#ifndef HAVE_STRUCT_BTRFS_IOCTL_DEFRAG_RANGE_ARGS_START +# ifndef HAVE_STRUCT_BTRFS_IOCTL_DEFRAG_RANGE_ARGS_START struct btrfs_ioctl_defrag_range_args { uint64_t start; uint64_t len; @@ -132,10 +132,10 @@ struct btrfs_ioctl_defrag_range_args { uint32_t compress_type; uint32_t unused[4]; }; -#endif +# endif -#ifndef FIDEDUPERANGE -# define FIDEDUPERANGE _IOWR(0x94, 54, struct file_dedupe_range) +# ifndef FIDEDUPERANGE +# define FIDEDUPERANGE _IOWR(0x94, 54, struct file_dedupe_range) struct file_dedupe_range_info { int64_t dest_fd; /* in - destination file */ uint64_t dest_offset; /* in - start of extent in destination */ @@ -158,10 +158,10 @@ struct file_dedupe_range { uint32_t reserved2; /* must be zero */ struct file_dedupe_range_info info[0]; }; -#endif +# endif -#ifndef BTRFS_IOC_TREE_SEARCH_V2 -# define BTRFS_IOC_TREE_SEARCH_V2 \ +# ifndef BTRFS_IOC_TREE_SEARCH_V2 +# define BTRFS_IOC_TREE_SEARCH_V2 \ _IOWR(BTRFS_IOCTL_MAGIC, 17, struct btrfs_ioctl_search_args_v2) struct btrfs_ioctl_search_args_v2 { struct btrfs_ioctl_search_key key; /* in/out - search parameters */ @@ -170,7 +170,7 @@ struct btrfs_ioctl_search_args_v2 { * to store item */ uint64_t buf[0]; /* out - found items */ }; -#endif +# endif static const char * @@ -216,7 +216,7 @@ sprint_makedev(unsigned long long val) return devid; } -#define ioc(x_) sprint_xlat_(x_, #x_) +# define ioc(x_) sprint_xlat_(x_, #x_) void prfl_btrfs(const struct xlat *xlat, const unsigned long long val, @@ -804,8 +804,8 @@ btrfs_test_clone_ioctls(void) args.dest_offset); } -#define BTRFS_COMPRESS_TYPES 2 -#define BTRFS_INVALID_COMPRESS (BTRFS_COMPRESS_TYPES + 1) +# define BTRFS_COMPRESS_TYPES 2 +# define BTRFS_INVALID_COMPRESS (BTRFS_COMPRESS_TYPES + 1) static void btrfs_print_defrag_range_args(struct btrfs_ioctl_defrag_range_args *args, @@ -1302,11 +1302,11 @@ btrfs_test_ino_path_ioctls(void) .fspath = 0, }; -#ifdef HAVE_BTRFS_IOCTL_LOGICAL_INO_ARGS +# ifdef HAVE_BTRFS_IOCTL_LOGICAL_INO_ARGS args.flags = -#else +# else args.reserved[3] = -#endif +# endif 0xdeadc0defacefeeeULL; @@ -1341,11 +1341,11 @@ btrfs_test_ino_path_ioctls(void) args.fspath = (uintptr_t) buf; args.reserved[0] = 0; args.reserved[2] = 0; -#ifdef HAVE_BTRFS_IOCTL_LOGICAL_INO_ARGS +# ifdef HAVE_BTRFS_IOCTL_LOGICAL_INO_ARGS args.flags = -#else +# else args.reserved[3] = -#endif +# endif 1; ioctl(-1, BTRFS_IOC_LOGICAL_INO, &args); @@ -1358,11 +1358,11 @@ btrfs_test_ino_path_ioctls(void) args.fspath); args.reserved[1] = 0; -#ifdef HAVE_BTRFS_IOCTL_LOGICAL_INO_ARGS +# ifdef HAVE_BTRFS_IOCTL_LOGICAL_INO_ARGS args.flags = -#else +# else args.reserved[3] = -#endif +# endif 0; ioctl(-1, BTRFS_IOC_LOGICAL_INO, &args); @@ -1371,7 +1371,7 @@ btrfs_test_ino_path_ioctls(void) "}) = -1 EBADF (%m)\n", ioc(BTRFS_IOC_LOGICAL_INO), args.inum, args.size, args.fspath); -#ifdef HAVE_LINUX_FIEMAP_H +# ifdef HAVE_LINUX_FIEMAP_H if (btrfs_test_root) { int size; struct stat si; @@ -1480,7 +1480,7 @@ btrfs_test_ino_path_ioctls(void) close(fd); free(fiemap); } -#endif /* HAVE_LINUX_FIEMAP_H */ +# endif /* HAVE_LINUX_FIEMAP_H */ } /* @@ -1830,7 +1830,7 @@ btrfs_test_dev_replace_ioctl(void) static void btrfs_test_extent_same_ioctl(void) { -#ifdef BTRFS_IOC_FILE_EXTENT_SAME +# ifdef BTRFS_IOC_FILE_EXTENT_SAME struct file_dedupe_range args = { .src_offset = 1024, .src_length = 10240, @@ -1976,7 +1976,7 @@ btrfs_test_extent_same_ioctl(void) close(fd2); } free(argsp); -#endif /* BTRFS_IOC_FILE_EXTENT_SAME */ +# endif /* BTRFS_IOC_FILE_EXTENT_SAME */ } static void diff --git a/tests/chmod.c b/tests/chmod.c index 90dc3a8c..d7c9fbab 100644 --- a/tests/chmod.c +++ b/tests/chmod.c @@ -11,10 +11,10 @@ #if defined __NR_chmod -#include -#include -#include -#include +# include +# include +# include +# include int main(void) diff --git a/tests/execveat.c b/tests/execveat.c index 9d1de4e7..629a69ab 100644 --- a/tests/execveat.c +++ b/tests/execveat.c @@ -45,20 +45,20 @@ main(void) syscall(__NR_execveat, -100, FILENAME, tail_argv, tail_envp, 0x1100); printf("execveat(AT_FDCWD, \"%s\"" ", [\"%s\", \"%s\", \"%s\", %p, %p, %p, ... /* %p */]" -#if VERBOSE +# if VERBOSE ", [\"%s\", \"%s\", %p, %p, %p, ... /* %p */]" -#else +# else ", %p /* 5 vars, unterminated */" -#endif +# endif ", AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH) = -1 %s (%m)\n", Q_FILENAME, q_argv[0], q_argv[1], q_argv[2], argv[3], argv[4], argv[5], (char *) tail_argv + sizeof(argv), -#if VERBOSE +# if VERBOSE q_envp[0], q_envp[1], envp[2], envp[3], envp[4], (char *) tail_envp + sizeof(envp), -#else +# else tail_envp, -#endif +# endif errno2name()); tail_argv[ARRAY_SIZE(q_argv)] = NULL; @@ -67,34 +67,34 @@ main(void) syscall(__NR_execveat, -100, FILENAME, tail_argv, tail_envp, 0x1100); printf("execveat(AT_FDCWD, \"%s\", [\"%s\", \"%s\", \"%s\"]" -#if VERBOSE +# if VERBOSE ", [\"%s\", \"%s\"]" -#else +# else ", %p /* 2 vars */" -#endif +# endif ", AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH) = -1 %s (%m)\n", Q_FILENAME, q_argv[0], q_argv[1], q_argv[2], -#if VERBOSE +# if VERBOSE q_envp[0], q_envp[1], -#else +# else tail_envp, -#endif +# endif errno2name()); syscall(__NR_execveat, -100, FILENAME, tail_argv + 2, tail_envp + 1, 0x1100); printf("execveat(AT_FDCWD, \"%s\", [\"%s\"]" -#if VERBOSE +# if VERBOSE ", [\"%s\"]" -#else +# else ", %p /* 1 var */" -#endif +# endif ", AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH) = -1 %s (%m)\n", Q_FILENAME, q_argv[2], -#if VERBOSE +# if VERBOSE q_envp[1], -#else +# else tail_envp + 1, -#endif +# endif errno2name()); TAIL_ALLOC_OBJECT_CONST_PTR(char *, empty); @@ -103,16 +103,16 @@ main(void) syscall(__NR_execveat, -100, FILENAME, empty, empty, 0x1100); printf("execveat(AT_FDCWD, \"%s\", []" -#if VERBOSE +# if VERBOSE ", []" -#else +# else ", %p /* 0 vars */" -#endif +# endif ", AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH) = -1 %s (%m)\n", Q_FILENAME, -#if !VERBOSE +# if !VERBOSE empty, -#endif +# endif errno2name()); char *const str_a = tail_alloc(DEFAULT_STRLEN + 2); @@ -136,19 +136,19 @@ main(void) printf("execveat(AT_FDCWD, \"%s\", [\"%.*s\"...", Q_FILENAME, DEFAULT_STRLEN, a[0]); for (i = 1; i < DEFAULT_STRLEN; ++i) printf(", \"%s\"", a[i]); -#if VERBOSE +# if VERBOSE printf(", \"%s\"", a[i]); -#else +# else printf(", ..."); -#endif -#if VERBOSE +# endif +# if VERBOSE printf("], [\"%.*s\"...", DEFAULT_STRLEN, b[0]); for (i = 1; i <= DEFAULT_STRLEN; ++i) printf(", \"%s\"", b[i]); printf("]"); -#else +# else printf("], %p /* %u vars */", b, DEFAULT_STRLEN + 1); -#endif +# endif printf(", AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH) = -1 %s (%m)\n", errno2name()); @@ -156,14 +156,14 @@ main(void) printf("execveat(AT_FDCWD, \"%s\", [\"%s\"", Q_FILENAME, a[1]); for (i = 2; i <= DEFAULT_STRLEN; ++i) printf(", \"%s\"", a[i]); -#if VERBOSE +# if VERBOSE printf("], [\"%s\"", b[1]); for (i = 2; i <= DEFAULT_STRLEN; ++i) printf(", \"%s\"", b[i]); printf("]"); -#else +# else printf("], %p /* %d vars */", b + 1, DEFAULT_STRLEN); -#endif +# endif printf(", AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH) = -1 %s (%m)\n", errno2name()); diff --git a/tests/fadvise.h b/tests/fadvise.h index beddf662..f8ef089b 100644 --- a/tests/fadvise.h +++ b/tests/fadvise.h @@ -10,7 +10,7 @@ */ #ifndef STRACE_TESTS_FADVISE_H -#define STRACE_TESTS_FADVISE_H +# define STRACE_TESTS_FADVISE_H # include # include diff --git a/tests/fanotify_mark.c b/tests/fanotify_mark.c index b87d0df0..e7ab7c3e 100644 --- a/tests/fanotify_mark.c +++ b/tests/fanotify_mark.c @@ -21,19 +21,19 @@ # include # include -#if XLAT_RAW -# define str_fan_mark_add "0x1" -# define str_fan_modify_ondir "0x40000002" -# define str_at_fdcwd "-100" -#elif XLAT_VERBOSE -# define str_fan_mark_add "0x1 /* FAN_MARK_ADD */" -# define str_fan_modify_ondir "0x40000002 /* FAN_MODIFY|FAN_ONDIR */" -# define str_at_fdcwd "-100 /* AT_FDCWD */" -#else -# define str_fan_mark_add "FAN_MARK_ADD" -# define str_fan_modify_ondir "FAN_MODIFY|FAN_ONDIR" -# define str_at_fdcwd "AT_FDCWD" -#endif +# if XLAT_RAW +# define str_fan_mark_add "0x1" +# define str_fan_modify_ondir "0x40000002" +# define str_at_fdcwd "-100" +# elif XLAT_VERBOSE +# define str_fan_mark_add "0x1 /* FAN_MARK_ADD */" +# define str_fan_modify_ondir "0x40000002 /* FAN_MODIFY|FAN_ONDIR */" +# define str_at_fdcwd "-100 /* AT_FDCWD */" +# else +# define str_fan_mark_add "FAN_MARK_ADD" +# define str_fan_modify_ondir "FAN_MODIFY|FAN_ONDIR" +# define str_at_fdcwd "AT_FDCWD" +# endif /* Performs fanotify_mark call via the syscall interface. */ static void @@ -73,8 +73,8 @@ struct strval64 { const char *str; }; -#define STR16 "0123456789abcdef" -#define STR64 STR16 STR16 STR16 STR16 +# define STR16 "0123456789abcdef" +# define STR64 STR16 STR16 STR16 STR16 int main(void) @@ -92,70 +92,70 @@ main(void) { F8ILL_KULONG_MASK, "0" }, { (kernel_ulong_t) 0xdec0deddefaced00ULL, "0xefaced00" -#if !XLAT_RAW +# if !XLAT_RAW " /* FAN_MARK_??? */" -#endif +# endif }, { (kernel_ulong_t) 0xda7a105700000040ULL, -#if XLAT_RAW +# if XLAT_RAW "0x40" -#elif XLAT_VERBOSE +# elif XLAT_VERBOSE "0x40 /* FAN_MARK_IGNORED_SURV_MODIFY */" -#else +# else "FAN_MARK_IGNORED_SURV_MODIFY" -#endif +# endif }, { (kernel_ulong_t) 0xbadc0deddeadfeedULL, -#if XLAT_RAW || XLAT_VERBOSE +# if XLAT_RAW || XLAT_VERBOSE "0xdeadfeed" -#endif -#if XLAT_VERBOSE +# endif +# if XLAT_VERBOSE " /* " -#endif -#if !XLAT_RAW +# endif +# if !XLAT_RAW "FAN_MARK_ADD|FAN_MARK_DONT_FOLLOW|FAN_MARK_ONLYDIR|" "FAN_MARK_IGNORED_MASK|FAN_MARK_IGNORED_SURV_MODIFY|" "FAN_MARK_FLUSH|0xdeadfe00" -#endif -#if XLAT_VERBOSE +# endif +# if XLAT_VERBOSE " */" -#endif +# endif }, }; static const struct strval64 masks[] = { { ARG_ULL_STR(0) }, { 0xdeadfeedfacebeefULL, -#if XLAT_RAW || XLAT_VERBOSE +# if XLAT_RAW || XLAT_VERBOSE "0xdeadfeedfacebeef" -#endif -#if XLAT_VERBOSE +# endif +# if XLAT_VERBOSE " /* " -#endif -#if !XLAT_RAW +# endif +# if !XLAT_RAW "FAN_ACCESS|FAN_MODIFY|FAN_CLOSE_WRITE|FAN_OPEN|" "FAN_ACCESS_PERM|FAN_ONDIR|FAN_EVENT_ON_CHILD|" "0xdeadfeedb2ccbec4" -#endif -#if XLAT_VERBOSE +# endif +# if XLAT_VERBOSE " */" -#endif +# endif }, { ARG_ULL_STR(0xffffffffb7fcbfc4) -#if !XLAT_RAW +# if !XLAT_RAW " /* FAN_??? */" -#endif +# endif }, }; static const struct strval dirfds[] = { { (kernel_ulong_t) 0xfacefeed00000001ULL, "1" }, { (kernel_ulong_t) 0xdec0ded0ffffffffULL, -#if XLAT_RAW +# if XLAT_RAW "-1" -#elif XLAT_VERBOSE +# elif XLAT_VERBOSE "-1 /* FAN_NOFD */" -#else +# else "FAN_NOFD" -#endif +# endif }, { (kernel_ulong_t) 0xbadfacedffffff9cULL, str_at_fdcwd }, { (kernel_ulong_t) 0xdefaced1beeff00dULL, "-1091571699" }, diff --git a/tests/fcntl.c b/tests/fcntl.c index 210e9727..bd9ffbdd 100644 --- a/tests/fcntl.c +++ b/tests/fcntl.c @@ -28,7 +28,7 @@ test_flock64_undecoded(const int cmd, const char *name) TEST_SYSCALL_STR, name, &fl, errstr); } -#define TEST_FLOCK64_UNDECODED(cmd) test_flock64_undecoded(cmd, #cmd) +# define TEST_FLOCK64_UNDECODED(cmd) test_flock64_undecoded(cmd, #cmd) static void test_flock64_lk64(void) diff --git a/tests/file_handle.c b/tests/file_handle.c index e870e001..38cd5af8 100644 --- a/tests/file_handle.c +++ b/tests/file_handle.c @@ -137,8 +137,8 @@ struct strval { const char *str; }; -#define STR16 "0123456789abcdef" -#define STR64 STR16 STR16 STR16 STR16 +# define STR16 "0123456789abcdef" +# define STR64 STR16 STR16 STR16 STR16 int main(void) diff --git a/tests/getgroups.c b/tests/getgroups.c index 02fda126..36c095df 100644 --- a/tests/getgroups.c +++ b/tests/getgroups.c @@ -38,7 +38,7 @@ # include # include -#define MAX_STRLEN 32 +# define MAX_STRLEN 32 static long ngroups; static void diff --git a/tests/group_req.c b/tests/group_req.c index ae4c1e48..575e1569 100644 --- a/tests/group_req.c +++ b/tests/group_req.c @@ -20,8 +20,8 @@ # include # include -#define multi4addr "224.0.0.3" -#define multi6addr "ff01::c" +# define multi4addr "224.0.0.3" +# define multi6addr "ff01::c" static const char *errstr; diff --git a/tests/init_delete_module.h b/tests/init_delete_module.h index 07c53116..85a4a396 100644 --- a/tests/init_delete_module.h +++ b/tests/init_delete_module.h @@ -10,7 +10,7 @@ */ #ifndef STRACE_TESTS_INIT_DELETE_MODULE_H -#define STRACE_TESTS_INIT_DELETE_MODULE_H +# define STRACE_TESTS_INIT_DELETE_MODULE_H # include # include diff --git a/tests/ioctl.c b/tests/ioctl.c index 28703624..ec4e3670 100644 --- a/tests/ioctl.c +++ b/tests/ioctl.c @@ -38,12 +38,12 @@ main(void) { uint64_t data = 0; -#ifndef POWERPC +# ifndef POWERPC struct termios tty; (void) ioctl(-1, TCGETS, &tty); printf("ioctl(-1, TCGETS, %p)" " = -1 EBADF (%m)\n", &tty); -#endif +# endif (void) ioctl(-1, MMTIMER_GETRES, &data); printf("ioctl(-1, MMTIMER_GETRES, %p)" diff --git a/tests/ioctl_dm.c b/tests/ioctl_dm.c index 2344b7c0..f05528f9 100644 --- a/tests/ioctl_dm.c +++ b/tests/ioctl_dm.c @@ -33,9 +33,9 @@ # define ALIGNED_OFFSET(t_, m_) \ ALIGNED_SIZE(offsetof(t_, m_), t_) -# ifndef DM_DEV_ARM_POLL -# define DM_DEV_ARM_POLL _IOWR(DM_IOCTL, 0x10, struct dm_ioctl) -# endif +# ifndef DM_DEV_ARM_POLL +# define DM_DEV_ARM_POLL _IOWR(DM_IOCTL, 0x10, struct dm_ioctl) +# endif static const char str129[] = STR32 STR32 STR32 STR32 "6"; @@ -482,7 +482,7 @@ main(void) # endif /* VERBOSE */ printf("}) = %s\n", errstr); - #define FILL_DM_TARGET(id, id_next) \ +# define FILL_DM_TARGET(id, id_next) \ do { \ init_dm_target_spec(&dm_arg_open3->target##id, id); \ dm_arg_open3->target##id.next = \ @@ -493,7 +493,7 @@ main(void) memcpy(dm_arg_open3->param##id, str129 + id * 2, id); \ dm_arg_open3->param##id[id] = '\0'; \ } while (0) - #define PRINT_DM_TARGET(id) \ +# define PRINT_DM_TARGET(id) \ do { \ print_dm_target_spec(&dm_arg_open3->target##id, id); \ printf("\"%.*s\"}, ", id, str129 + id * 2); \ diff --git a/tests/ioctl_evdev.c b/tests/ioctl_evdev.c index 5fee02d4..02be472c 100644 --- a/tests/ioctl_evdev.c +++ b/tests/ioctl_evdev.c @@ -212,17 +212,17 @@ main(void) ioctl(-1, EVIOCSFF, ffe); print_ffe_common(ffe, "FF_CONSTANT"); -# if VERBOSE +# if VERBOSE printf(", constant={level=%hd", ffe->u.constant.level); print_envelope(&ffe->u.constant.envelope); printf("}"); -# else +# else printf("..."); -# endif +# endif errno = EBADF; printf("}) = -1 EBADF (%m)\n"); -# if VERBOSE +# if VERBOSE ffe->type = FF_RAMP; ioctl(-1, EVIOCSFF, ffe); print_ffe_common(ffe, "FF_RAMP"); @@ -259,7 +259,7 @@ main(void) print_ffe_common(ffe, "0xff /* FF_??? */"); errno = EBADF; printf("}) = -1 EBADF (%m)\n"); -# endif +# endif ioctl(-1, _IOC(_IOC_READ, 0x45, 0x1, 0xff), lmagic); printf("ioctl(-1, %s, %#lx) = -1 EBADF (%m)\n", diff --git a/tests/ioctl_kvm_run_common.c b/tests/ioctl_kvm_run_common.c index 2e7eda41..26e72cec 100644 --- a/tests/ioctl_kvm_run_common.c +++ b/tests/ioctl_kvm_run_common.c @@ -48,8 +48,8 @@ # define KVM_MAX_CPUID_ENTRIES 80 # endif -#include "xlat.h" -#include "xlat/kvm_cpuid_flags.h" +# include "xlat.h" +# include "xlat/kvm_cpuid_flags.h" static int kvm_ioctl(int fd, unsigned long cmd, const char *cmd_str, void *arg) @@ -60,7 +60,7 @@ kvm_ioctl(int fd, unsigned long cmd, const char *cmd_str, void *arg) return rc; } -#define KVM_IOCTL(fd_, cmd_, arg_) \ +# define KVM_IOCTL(fd_, cmd_, arg_) \ kvm_ioctl((fd_), (cmd_), #cmd_, (arg_)) static const char dev[] = "/dev/kvm"; @@ -100,7 +100,7 @@ print_kvm_sregs(const struct kvm_sregs *sregs) { printf("{cs="); print_kvm_segment(&sregs->cs); -#if VERBOSE +# if VERBOSE printf(", ds="); print_kvm_segment(&sregs->ds); printf(", es="); @@ -128,9 +128,9 @@ print_kvm_sregs(const struct kvm_sregs *sregs) printf("%#jx", (uintmax_t) sregs->interrupt_bitmap[i]); } printf("]"); -#else +# else printf(", ..."); -#endif +# endif printf("}"); } @@ -138,26 +138,26 @@ static void print_kvm_regs(const struct kvm_regs *regs) { printf("{rax=%#jx", (uintmax_t) regs->rax); -#if VERBOSE +# if VERBOSE printf(", rbx=%#jx, rcx=%#jx, rdx=%#jx, rsi=%#jx, rdi=%#jx", (uintmax_t) regs->rbx, (uintmax_t) regs->rcx, (uintmax_t) regs->rdx, (uintmax_t) regs->rsi, (uintmax_t) regs->rdi); -#else +# else printf(", ..."); -#endif +# endif printf(", rsp=%#jx, rbp=%#jx", (uintmax_t) regs->rsp, (uintmax_t) regs->rbp); -#if VERBOSE +# if VERBOSE printf(", r8=%#jx, r9=%#jx, r10=%#jx, r11=%#jx, r12=%#jx, r13=%#jx" ", r14=%#jx, r15=%#jx", (uintmax_t) regs->r8, (uintmax_t) regs->r9, (uintmax_t) regs->r10, (uintmax_t) regs->r11, (uintmax_t) regs->r12, (uintmax_t) regs->r13, (uintmax_t) regs->r14, (uintmax_t) regs->r15); -#else +# else printf(", ..."); -#endif +# endif printf(", rip=%#jx, rflags=%#jx}", (uintmax_t) regs->rip, (uintmax_t) regs->rflags); } @@ -269,7 +269,7 @@ print_cpuid_ioctl(int fd, const char *fd_dev, { printf("ioctl(%d<%s>, %s, {nent=%u, entries=[", fd, fd_dev, ioctl_name, cpuid->nent); -#if VERBOSE +# if VERBOSE for (size_t i = 0; i < cpuid->nent; i++) { if (i) printf(", "); @@ -281,10 +281,10 @@ print_cpuid_ioctl(int fd, const char *fd_dev, cpuid->entries[i].eax, cpuid->entries[i].ebx, cpuid->entries[i].ecx, cpuid->entries[i].edx); } -#else +# else if (cpuid->nent) printf("..."); -#endif +# endif printf("]}) = 0\n"); } @@ -344,9 +344,9 @@ main(void) * "anon_inode:kvm-vcpu:0" -> "anon_inode:kvm-vcpu" */ vcpu_dev[strlen (vcpu_dev) - 2] = '\0'; -#ifdef KVM_NO_CPUID_CALLBACK +# ifdef KVM_NO_CPUID_CALLBACK KVM_NO_CPUID_CALLBACK; -#endif +# endif } printf("ioctl(%d<%s>, KVM_CREATE_VCPU, 0) = %d<%s>\n", diff --git a/tests/ioctl_loop.c b/tests/ioctl_loop.c index 59d98318..53665603 100644 --- a/tests/ioctl_loop.c +++ b/tests/ioctl_loop.c @@ -23,7 +23,7 @@ #include "print_fields.h" #define XLAT_MACROS_ONLY -# include "xlat/loop_cmds.h" +#include "xlat/loop_cmds.h" #undef XLAT_MACROS_ONLY #ifndef ABBREV diff --git a/tests/ioctl_nbd.c b/tests/ioctl_nbd.c index 8c070d45..0992ca28 100644 --- a/tests/ioctl_nbd.c +++ b/tests/ioctl_nbd.c @@ -14,8 +14,8 @@ #include #define XLAT_MACROS_ONLY -# include "xlat/nbd_ioctl_cmds.h" -# include "xlat/nbd_ioctl_flags.h" +#include "xlat/nbd_ioctl_cmds.h" +#include "xlat/nbd_ioctl_flags.h" #undef XLAT_MACROS_ONLY #define RVAL_EBADF " = -1 EBADF (%m)\n" diff --git a/tests/ioctl_perf.c b/tests/ioctl_perf.c index ae786fbe..30cb35f6 100644 --- a/tests/ioctl_perf.c +++ b/tests/ioctl_perf.c @@ -28,7 +28,7 @@ # endif # define XLAT_MACROS_ONLY -# include "xlat/perf_ioctl_cmds.h" +# include "xlat/perf_ioctl_cmds.h" # undef XLAT_MACROS_ONLY # define STR16 "0123456789abcdef" diff --git a/tests/ioctl_ptp.c b/tests/ioctl_ptp.c index 17ab2372..52d9698a 100644 --- a/tests/ioctl_ptp.c +++ b/tests/ioctl_ptp.c @@ -12,17 +12,17 @@ #ifdef HAVE_STRUCT_PTP_SYS_OFFSET -#include -#include -#include -#include -#include -#include -#include -#include - -#include "xlat.h" -#include "xlat/ptp_flags_options.h" +# include +# include +# include +# include +# include +# include +# include +# include + +# include "xlat.h" +# include "xlat/ptp_flags_options.h" static void test_no_device(void) diff --git a/tests/ioctl_random.c b/tests/ioctl_random.c index fc81f047..e7bd7b78 100644 --- a/tests/ioctl_random.c +++ b/tests/ioctl_random.c @@ -16,7 +16,7 @@ #include #define XLAT_MACROS_ONLY -# include "xlat/random_ioctl_cmds.h" +#include "xlat/random_ioctl_cmds.h" #undef XLAT_MACROS_ONLY #define RVAL_EBADF " = -1 EBADF (%m)\n" diff --git a/tests/ioctl_uffdio.c b/tests/ioctl_uffdio.c index 815252fa..19104442 100644 --- a/tests/ioctl_uffdio.c +++ b/tests/ioctl_uffdio.c @@ -24,8 +24,8 @@ # include # include -#include "xlat.h" -#include "xlat/uffd_api_features.h" +# include "xlat.h" +# include "xlat/uffd_api_features.h" int main(void) diff --git a/tests/ioctl_v4l2.c b/tests/ioctl_v4l2.c index 6a34b401..54e9ee7c 100644 --- a/tests/ioctl_v4l2.c +++ b/tests/ioctl_v4l2.c @@ -339,13 +339,13 @@ dprint_ioctl_v4l2(struct v4l2_format *const f, errno = saved_errno; printf( -#ifdef HAVE_STRUCT_V4L2_SDR_FORMAT_BUFFERSIZE +# ifdef HAVE_STRUCT_V4L2_SDR_FORMAT_BUFFERSIZE ", buffersize=%u" -#endif +# endif "}}) = -1 EBADF (%m)\n" -#ifdef HAVE_STRUCT_V4L2_SDR_FORMAT_BUFFERSIZE +# ifdef HAVE_STRUCT_V4L2_SDR_FORMAT_BUFFERSIZE , f->fmt.sdr.buffersize -#endif +# endif ); break; #endif @@ -748,14 +748,14 @@ main(void) struct v4l2_queryctrl *const p_v4l2_queryctrl = page_end - sizeof(*p_v4l2_queryctrl); ioctl(-1, VIDIOC_QUERYCTRL, p_v4l2_queryctrl); -# ifdef V4L2_CTRL_FLAG_NEXT_CTRL +#ifdef V4L2_CTRL_FLAG_NEXT_CTRL printf("ioctl(-1, VIDIOC_QUERYCTRL, {id=V4L2_CTRL_FLAG_NEXT_CTRL" "|%#x /* V4L2_CID_??? */}) = -1 EBADF (%m)\n", p_v4l2_queryctrl->id & ~V4L2_CTRL_FLAG_NEXT_CTRL); -# else +#else printf("ioctl(-1, VIDIOC_QUERYCTRL, {id=%#x /* V4L2_CID_??? */})" " = -1 EBADF (%m)\n", p_v4l2_queryctrl->id); -# endif +#endif TAIL_ALLOC_OBJECT_CONST_PTR(struct v4l2_queryctrl, p_queryctrl); p_queryctrl->id = V4L2_CID_SATURATION; diff --git a/tests/ip_mreq.c b/tests/ip_mreq.c index 4ef342e6..4744bd38 100644 --- a/tests/ip_mreq.c +++ b/tests/ip_mreq.c @@ -19,9 +19,9 @@ # include # include -#define multi4addr "224.0.0.3" -#define multi6addr "ff01::c" -#define interface "127.0.0.1" +# define multi4addr "224.0.0.3" +# define multi6addr "ff01::c" +# define interface "127.0.0.1" int main(void) diff --git a/tests/ipc_shm.c b/tests/ipc_shm.c index ffd1e721..76c19d8d 100644 --- a/tests/ipc_shm.c +++ b/tests/ipc_shm.c @@ -94,11 +94,11 @@ main(void) * musl sets size to SIZE_MAX if size argument is greater than * PTRDIFF_MAX - musl/src/ipc/shmget.c */ - #ifdef __GLIBC__ +#ifdef __GLIBC__ (size_t) 0xdec0ded1dec0ded2ULL; - #else +#else (size_t) 0x1e55c0de5dec0dedULL; - #endif +#endif static const unsigned int bogus_ipc_shm_flags = IPC_CREAT | IPC_EXCL | SHM_HUGETLB | SHM_NORESERVE; static const unsigned int huge_mask = SHM_HUGE_MASK << SHM_HUGE_SHIFT; diff --git a/tests/kexec_file_load.c b/tests/kexec_file_load.c index 2222a7e6..5e5d91ed 100644 --- a/tests/kexec_file_load.c +++ b/tests/kexec_file_load.c @@ -25,7 +25,7 @@ struct strval { const char *str; }; -#define CMDLINE_STR "deadcodebaddatadefaced" +# define CMDLINE_STR "deadcodebaddatadefaced" int main(void) diff --git a/tests/keyctl.c b/tests/keyctl.c index 1629bc11..ccfd3b44 100644 --- a/tests/keyctl.c +++ b/tests/keyctl.c @@ -69,13 +69,13 @@ bool buf_in_arg; /* From ioctl_dm.c */ # define STR32 "AbCdEfGhIjKlMnOpQrStUvWxYz012345" -#if XLAT_RAW -# define XARG_STR(v_) (v_), STRINGIFY(v_) -#elif XLAT_VERBOSE -# define XARG_STR(v_) (v_), STRINGIFY(v_) " /* " #v_ " */" -#else -# define XARG_STR ARG_STR -#endif +# if XLAT_RAW +# define XARG_STR(v_) (v_), STRINGIFY(v_) +# elif XLAT_VERBOSE +# define XARG_STR(v_) (v_), STRINGIFY(v_) " /* " #v_ " */" +# else +# define XARG_STR ARG_STR +# endif /* * When this is called with positive size, the buffer provided is an "out" @@ -175,13 +175,13 @@ do_keyctl(kernel_ulong_t cmd, const char *cmd_str, ...) long rc = syscall(__NR_keyctl, cmd, args[0], args[1], args[2], args[3]); const char *errstr = sprintrc(rc); -#if XLAT_RAW +# if XLAT_RAW printf("keyctl(%#x", (unsigned) cmd); -#elif XLAT_VERBOSE +# elif XLAT_VERBOSE printf("keyctl(%#x /* %s */", (unsigned) cmd, cmd_str); -#else +# else printf("keyctl(%s", cmd_str); -#endif +# endif for (i = 0; i < cnt; i++) { printf(", "); print_arg(args[i], arg_str[i], arg_fmt[i], arg_sz[i], rc); @@ -297,18 +297,18 @@ main(void) .base = 3141592653U }; static const char *kcdhp_str = "{private=" -#if XLAT_RAW || XLAT_VERBOSE +# if XLAT_RAW || XLAT_VERBOSE "-6" -#endif -#if XLAT_VERBOSE +# endif +# if XLAT_VERBOSE " /* " -#endif -#if !XLAT_RAW +# endif +# if !XLAT_RAW "KEY_SPEC_GROUP_KEYRING" -#endif -#if XLAT_VERBOSE +# endif +# if XLAT_VERBOSE " */" -#endif +# endif ", prime=1234567890, base=-1153374643}"; /* @@ -427,14 +427,14 @@ main(void) /* Invalid command */ do_keyctl((kernel_ulong_t) 0xbadc0dedfacefeedULL, -#if XLAT_VERBOSE +# if XLAT_VERBOSE "KEYCTL_???" -#else +# else "0xfacefeed" -# if !XLAT_RAW +# if !XLAT_RAW " /* KEYCTL_??? */" +# endif # endif -#endif , sizeof(kernel_ulong_t), (kernel_ulong_t) 0xdeadfee1badc0de5ULL, NULL, @@ -545,13 +545,13 @@ main(void) do_keyctl(ARG_STR(KEYCTL_SETPERM), sizeof(int32_t), XARG_STR(KEY_SPEC_REQKEY_AUTH_KEY), NULL, sizeof(uint32_t), 0xffffffffU, -#if XLAT_RAW || XLAT_VERBOSE +# if XLAT_RAW || XLAT_VERBOSE "0xffffffff" -#endif -#if XLAT_VERBOSE +# endif +# if XLAT_VERBOSE " /* " -#endif -#if !XLAT_RAW +# endif +# if !XLAT_RAW "KEY_POS_VIEW|KEY_POS_READ|KEY_POS_WRITE|" "KEY_POS_SEARCH|KEY_POS_LINK|KEY_POS_SETATTR|" "KEY_USR_VIEW|KEY_USR_READ|KEY_USR_WRITE|" @@ -561,10 +561,10 @@ main(void) "KEY_OTH_VIEW|KEY_OTH_READ|KEY_OTH_WRITE|" "KEY_OTH_SEARCH|KEY_OTH_LINK|KEY_OTH_SETATTR|" "0xc0c0c0c0" -#endif -#if XLAT_VERBOSE +# endif +# if XLAT_VERBOSE " */" -#endif +# endif , NULL, 0UL); do_keyctl(ARG_STR(KEYCTL_SETPERM), @@ -575,9 +575,9 @@ main(void) sizeof(kernel_ulong_t), bogus_key3, bogus_key3_str, NULL, sizeof(uint32_t), 0xc0c0c0c0, "0xc0c0c0c0" -#if !XLAT_RAW +# if !XLAT_RAW " /* KEY_??? */" -#endif +# endif , NULL, 0UL); @@ -835,9 +835,9 @@ main(void) sizeof(kernel_ulong_t), (kernel_ulong_t) 0xfeedf157badc0dedLLU, "-1159983635" -#if !XLAT_RAW +# if !XLAT_RAW " /* KEY_REQKEY_DEFL_??? */" -#endif +# endif , NULL, 0UL); diff --git a/tests/libsocketcall.c b/tests/libsocketcall.c index 655e681e..34f65478 100644 --- a/tests/libsocketcall.c +++ b/tests/libsocketcall.c @@ -23,7 +23,7 @@ socketcall(const int nr, const int call, int rc = -1; errno = ENOSYS; -# ifdef __NR_socketcall +#ifdef __NR_socketcall static int have_socketcall = -1; if (have_socketcall < 0) { @@ -39,7 +39,7 @@ socketcall(const int nr, const int call, const long args[] = { a1, a2, a3, a4, a5 }; rc = syscall(__NR_socketcall, call, args); } else -# endif +#endif { if (nr != -1) rc = syscall(nr, a1, a2, a3, a4, a5); diff --git a/tests/mmsg_name.c b/tests/mmsg_name.c index 49e1065f..fce004bb 100644 --- a/tests/mmsg_name.c +++ b/tests/mmsg_name.c @@ -100,9 +100,9 @@ test_mmsg_name(const int send_fd, const int recv_fd) if (i) printf(", "); if (i >= IOV_MAX -# if !VERBOSE +#if !VERBOSE || i >= DEFAULT_STRLEN -# endif +#endif ) { printf("..."); break; diff --git a/tests/modify_ldt.c b/tests/modify_ldt.c index 02626be2..78e370e4 100644 --- a/tests/modify_ldt.c +++ b/tests/modify_ldt.c @@ -22,7 +22,7 @@ void printrc(long rc) { -#ifdef __x86_64__ +# ifdef __x86_64__ int err = -rc; /* Thanks, long return type of syscall(2) */ @@ -32,9 +32,9 @@ printrc(long rc) errno = err; printf(" %s (%m)", errno2name()); } -#else +# else printf("%s", sprintrc(rc)); -#endif +# endif puts(""); } diff --git a/tests/mq_sendrecv.c b/tests/mq_sendrecv.c index b673e5f3..7af0f36e 100644 --- a/tests/mq_sendrecv.c +++ b/tests/mq_sendrecv.c @@ -60,7 +60,7 @@ printstr(unsigned char start, unsigned int count) printf("\""); } -#if DUMPIO_READ || DUMPIO_WRITE +# if DUMPIO_READ || DUMPIO_WRITE static void dumpstr(unsigned char start, unsigned int count) { @@ -94,7 +94,7 @@ dumpstr(unsigned char start, unsigned int count) } } } -#endif /* DUMPIO_READ || DUMPIO_WRITE */ +# endif /* DUMPIO_READ || DUMPIO_WRITE */ static void cleanup(void) diff --git a/tests/net-sockaddr.c b/tests/net-sockaddr.c index 4c41bcb6..95c10f14 100644 --- a/tests/net-sockaddr.c +++ b/tests/net-sockaddr.c @@ -598,9 +598,9 @@ check_l2(void) .l2_psm = htobs(h_psm), .l2_bdaddr.b = "abcdef", .l2_cid = htobs(h_cid), -#ifdef HAVE_STRUCT_SOCKADDR_L2_L2_BDADDR_TYPE +# ifdef HAVE_STRUCT_SOCKADDR_L2_L2_BDADDR_TYPE .l2_bdaddr_type = 0xce, -#endif +# endif }; void *l2 = tail_memdup(&c_l2, sizeof(c_l2)); unsigned int len = sizeof(c_l2); @@ -610,9 +610,9 @@ check_l2(void) ", l2_psm=htobs(L2CAP_PSM_DYN_START + %hu)" ", l2_bdaddr=%02x:%02x:%02x:%02x:%02x:%02x" ", l2_cid=htobs(L2CAP_CID_DYN_START + %hu)" -#ifdef HAVE_STRUCT_SOCKADDR_L2_L2_BDADDR_TYPE +# ifdef HAVE_STRUCT_SOCKADDR_L2_L2_BDADDR_TYPE ", l2_bdaddr_type=0xce /* BDADDR_??? */" -#endif +# endif "}, %u) = %d EBADF (%m)\n", (short) (h_psm - 0x1001), c_l2.l2_bdaddr.b[0], c_l2.l2_bdaddr.b[1], @@ -622,18 +622,18 @@ check_l2(void) c_l2.l2_psm = htobs(1); c_l2.l2_cid = htobs(1); -#ifdef HAVE_STRUCT_SOCKADDR_L2_L2_BDADDR_TYPE +# ifdef HAVE_STRUCT_SOCKADDR_L2_L2_BDADDR_TYPE c_l2.l2_bdaddr_type = BDADDR_LE_RANDOM; -#endif +# endif memcpy(l2, &c_l2, sizeof(c_l2)); ret = connect(-1, l2, len); printf("connect(-1, {sa_family=AF_BLUETOOTH" ", l2_psm=htobs(L2CAP_PSM_SDP)" ", l2_bdaddr=%02x:%02x:%02x:%02x:%02x:%02x" ", l2_cid=htobs(L2CAP_CID_SIGNALING)" -#ifdef HAVE_STRUCT_SOCKADDR_L2_L2_BDADDR_TYPE +# ifdef HAVE_STRUCT_SOCKADDR_L2_L2_BDADDR_TYPE ", l2_bdaddr_type=BDADDR_LE_RANDOM" -#endif +# endif "}, %u) = %d EBADF (%m)\n", c_l2.l2_bdaddr.b[0], c_l2.l2_bdaddr.b[1], c_l2.l2_bdaddr.b[2], c_l2.l2_bdaddr.b[3], @@ -642,18 +642,18 @@ check_l2(void) c_l2.l2_psm = htobs(0xbad); c_l2.l2_cid = htobs(8); -#ifdef HAVE_STRUCT_SOCKADDR_L2_L2_BDADDR_TYPE +# ifdef HAVE_STRUCT_SOCKADDR_L2_L2_BDADDR_TYPE c_l2.l2_bdaddr_type = 3; -#endif +# endif memcpy(l2, &c_l2, sizeof(c_l2)); ret = connect(-1, l2, len); printf("connect(-1, {sa_family=AF_BLUETOOTH" ", l2_psm=htobs(0xbad /* L2CAP_PSM_??? */)" ", l2_bdaddr=%02x:%02x:%02x:%02x:%02x:%02x" ", l2_cid=htobs(0x8 /* L2CAP_CID_??? */)" -#ifdef HAVE_STRUCT_SOCKADDR_L2_L2_BDADDR_TYPE +# ifdef HAVE_STRUCT_SOCKADDR_L2_L2_BDADDR_TYPE ", l2_bdaddr_type=0x3 /* BDADDR_??? */" -#endif +# endif "}, %u) = %d EBADF (%m)\n", c_l2.l2_bdaddr.b[0], c_l2.l2_bdaddr.b[1], c_l2.l2_bdaddr.b[2], c_l2.l2_bdaddr.b[3], diff --git a/tests/netlink_protocol.c b/tests/netlink_protocol.c index 30a0a079..fd901d88 100644 --- a/tests/netlink_protocol.c +++ b/tests/netlink_protocol.c @@ -345,7 +345,7 @@ test_nlmsg_done(const int fd) fd, nlh->nlmsg_len, num, nlh->nlmsg_len, sprintrc(rc)); } -#if defined NLM_F_CAPPED || defined NLM_F_ACK_TLVS +# if defined NLM_F_CAPPED || defined NLM_F_ACK_TLVS static void test_ack_flags(const int fd) { @@ -355,34 +355,34 @@ test_ack_flags(const int fd) .nlmsg_type = NLMSG_ERROR, }; -#ifdef NLM_F_CAPPED +# ifdef NLM_F_CAPPED nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_CAPPED, rc = sendto(fd, &nlh, sizeof(nlh), MSG_DONTWAIT, NULL, 0); printf("sendto(%d, {len=%u, type=NLMSG_ERROR" ", flags=NLM_F_REQUEST|NLM_F_CAPPED, seq=0, pid=0}" ", %u, MSG_DONTWAIT, NULL, 0) = %s\n", fd, nlh.nlmsg_len, (unsigned) sizeof(nlh), sprintrc(rc)); -#endif +# endif -#ifdef NLM_F_ACK_TLVS +# ifdef NLM_F_ACK_TLVS nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK_TLVS; rc = sendto(fd, &nlh, sizeof(nlh), MSG_DONTWAIT, NULL, 0); printf("sendto(%d, {len=%u, type=NLMSG_ERROR" ", flags=NLM_F_REQUEST|NLM_F_ACK_TLVS, seq=0, pid=0}" ", %u, MSG_DONTWAIT, NULL, 0) = %s\n", fd, nlh.nlmsg_len, (unsigned) sizeof(nlh), sprintrc(rc)); -#endif +# endif -#if defined NLM_F_CAPPED && defined NLM_F_ACK_TLVS +# if defined NLM_F_CAPPED && defined NLM_F_ACK_TLVS nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_CAPPED | NLM_F_ACK_TLVS; rc = sendto(fd, &nlh, sizeof(nlh), MSG_DONTWAIT, NULL, 0); printf("sendto(%d, {len=%u, type=NLMSG_ERROR" ", flags=NLM_F_REQUEST|NLM_F_CAPPED|NLM_F_ACK_TLVS, seq=0, pid=0}" ", %u, MSG_DONTWAIT, NULL, 0) = %s\n", fd, nlh.nlmsg_len, (unsigned) sizeof(nlh), sprintrc(rc)); -#endif +# endif } -#endif +# endif int main(void) { @@ -399,9 +399,9 @@ int main(void) send_query(fd); test_nlmsgerr(fd); test_nlmsg_done(fd); -#if defined NLM_F_CAPPED || defined NLM_F_ACK_TLVS +# if defined NLM_F_CAPPED || defined NLM_F_ACK_TLVS test_ack_flags(fd); -#endif +# endif puts("+++ exited with 0 +++"); return 0; diff --git a/tests/nlattr_crypto_user_alg.c b/tests/nlattr_crypto_user_alg.c index ce2cf767..f90c6208 100644 --- a/tests/nlattr_crypto_user_alg.c +++ b/tests/nlattr_crypto_user_alg.c @@ -76,7 +76,7 @@ main(void) DEFAULT_STRLEN, str, DEFAULT_STRLEN, printf("{type=\"%s\"}", str)); -#ifdef HAVE_STRUCT_CRYPTO_REPORT_HASH +# ifdef HAVE_STRUCT_CRYPTO_REPORT_HASH static const struct crypto_report_hash rhash = { .type = "efgh", .blocksize = 0xabcdefdc, @@ -90,9 +90,9 @@ main(void) PRINT_FIELD_U(", ", rhash, blocksize); PRINT_FIELD_U(", ", rhash, digestsize); printf("}")); -#endif +# endif -#ifdef HAVE_STRUCT_CRYPTO_REPORT_BLKCIPHER +# ifdef HAVE_STRUCT_CRYPTO_REPORT_BLKCIPHER static const struct crypto_report_blkcipher rblkcipher = { .type = "abcd", .geniv = "efgh", @@ -111,9 +111,9 @@ main(void) PRINT_FIELD_U(", ", rblkcipher, max_keysize); PRINT_FIELD_U(", ", rblkcipher, ivsize); printf("}")); -#endif +# endif -#ifdef HAVE_STRUCT_CRYPTO_REPORT_AEAD +# ifdef HAVE_STRUCT_CRYPTO_REPORT_AEAD static const struct crypto_report_aead raead = { .type = "abcd", .geniv = "efgh", @@ -130,9 +130,9 @@ main(void) PRINT_FIELD_U(", ", raead, maxauthsize); PRINT_FIELD_U(", ", raead, ivsize); printf("}")); -#endif +# endif -#ifdef HAVE_STRUCT_CRYPTO_REPORT_RNG +# ifdef HAVE_STRUCT_CRYPTO_REPORT_RNG static const struct crypto_report_rng rrng = { .type = "abcd", .seedsize = 0xabcdefac @@ -144,9 +144,9 @@ main(void) printf("{type=\"abcd\""); PRINT_FIELD_U(", ", rrng, seedsize); printf("}")); -#endif +# endif -#ifdef HAVE_STRUCT_CRYPTO_REPORT_CIPHER +# ifdef HAVE_STRUCT_CRYPTO_REPORT_CIPHER static const struct crypto_report_cipher rcipher = { .type = "abcd", .blocksize = 0xabcdefac, @@ -162,7 +162,7 @@ main(void) PRINT_FIELD_U(", ", rcipher, min_keysize); PRINT_FIELD_U(", ", rcipher, max_keysize); printf("}")); -#endif +# endif puts("+++ exited with 0 +++"); return 0; diff --git a/tests/nlattr_fib_rule_hdr.c b/tests/nlattr_fib_rule_hdr.c index fee503c7..d5ba13e2 100644 --- a/tests/nlattr_fib_rule_hdr.c +++ b/tests/nlattr_fib_rule_hdr.c @@ -18,13 +18,13 @@ # include # include -#define FRA_TUN_ID 12 -#define FRA_TABLE 15 -#define FRA_UID_RANGE 20 -#define FRA_PROTOCOL 21 -#define FRA_IP_PROTO 22 -#define FRA_SPORT_RANGE 23 -#define FRA_DPORT_RANGE 24 +# define FRA_TUN_ID 12 +# define FRA_TABLE 15 +# define FRA_UID_RANGE 20 +# define FRA_PROTOCOL 21 +# define FRA_IP_PROTO 22 +# define FRA_SPORT_RANGE 23 +# define FRA_DPORT_RANGE 24 # ifndef HAVE_STRUCT_FIB_RULE_PORT_RANGE struct fib_rule_port_range { @@ -97,7 +97,7 @@ main(void) FRA_TABLE, pattern, table_id, printf("RT_TABLE_DEFAULT")); -#ifdef HAVE_STRUCT_FIB_RULE_UID_RANGE +# ifdef HAVE_STRUCT_FIB_RULE_UID_RANGE static const struct fib_rule_uid_range range = { .start = 0xabcdedad, .end = 0xbcdeadba @@ -108,14 +108,14 @@ main(void) PRINT_FIELD_U("{", range, start); PRINT_FIELD_U(", ", range, end); printf("}")); -#endif -#if defined HAVE_BE64TOH || defined be64toh +# endif +# if defined HAVE_BE64TOH || defined be64toh const uint64_t tun_id = 0xabcdcdbeedabadef; TEST_NLATTR_OBJECT(fd, nlh0, hdrlen, init_rtmsg, print_rtmsg, FRA_TUN_ID, pattern, tun_id, printf("htobe64(%" PRIu64 ")", be64toh(tun_id))); -#endif +# endif uint8_t proto; diff --git a/tests/nlattr_ifinfomsg.c b/tests/nlattr_ifinfomsg.c index eba1ca12..a8660196 100644 --- a/tests/nlattr_ifinfomsg.c +++ b/tests/nlattr_ifinfomsg.c @@ -270,12 +270,12 @@ main(void) PRINT_FIELD_U(", ", st64, tx_window_errors); PRINT_FIELD_U(", ", st64, rx_compressed); PRINT_FIELD_U(", ", st64, tx_compressed); -#ifdef HAVE_STRUCT_RTNL_LINK_STATS64_RX_NOHANDLER +# ifdef HAVE_STRUCT_RTNL_LINK_STATS64_RX_NOHANDLER PRINT_FIELD_U(", ", st64, rx_nohandler); -#endif +# endif printf("}")); -#ifdef HAVE_STRUCT_RTNL_LINK_STATS64_RX_NOHANDLER +# ifdef HAVE_STRUCT_RTNL_LINK_STATS64_RX_NOHANDLER const unsigned int sizeof_stats64 = offsetofend(struct rtnl_link_stats64, tx_compressed); TEST_NLATTR(fd, nlh0, hdrlen, @@ -305,7 +305,7 @@ main(void) PRINT_FIELD_U(", ", st64, rx_compressed); PRINT_FIELD_U(", ", st64, tx_compressed); printf("}")); -#endif /* HAVE_STRUCT_RTNL_LINK_STATS64_RX_NOHANDLER */ +# endif /* HAVE_STRUCT_RTNL_LINK_STATS64_RX_NOHANDLER */ #endif /* HAVE_STRUCT_RTNL_LINK_STATS64 */ struct nlattr nla = { diff --git a/tests/nlattr_ifla.h b/tests/nlattr_ifla.h index 78d3f6f0..6772ae29 100644 --- a/tests/nlattr_ifla.h +++ b/tests/nlattr_ifla.h @@ -9,13 +9,13 @@ */ #ifndef STRACE_TESTS_NLATTR_IFLA_H -#define STRACE_TESTS_NLATTR_IFLA_H +# define STRACE_TESTS_NLATTR_IFLA_H -#include "tests.h" +# include "tests.h" -#ifndef IFLA_ATTR -# error "Please define IFLA_ATTR before including this file" -#endif +# ifndef IFLA_ATTR +# error "Please define IFLA_ATTR before including this file" +# endif static const unsigned int hdrlen = sizeof(struct ifinfomsg); diff --git a/tests/nlattr_ifla_af_spec.c b/tests/nlattr_ifla_af_spec.c index 8b61b53f..e5e76c60 100644 --- a/tests/nlattr_ifla_af_spec.c +++ b/tests/nlattr_ifla_af_spec.c @@ -26,8 +26,8 @@ enum { IFLA_AF_SPEC = 26 }; #endif #define XLAT_MACROS_ONLY -# include "xlat/rtnl_ifla_af_spec_inet_attrs.h" -# include "xlat/rtnl_ifla_af_spec_inet6_attrs.h" +#include "xlat/rtnl_ifla_af_spec_inet_attrs.h" +#include "xlat/rtnl_ifla_af_spec_inet6_attrs.h" #undef XLAT_MACROS_ONLY #ifndef HAVE_STRUCT_IFLA_CACHEINFO diff --git a/tests/nlattr_ifla_linkinfo.c b/tests/nlattr_ifla_linkinfo.c index 901baa04..56aad584 100644 --- a/tests/nlattr_ifla_linkinfo.c +++ b/tests/nlattr_ifla_linkinfo.c @@ -24,8 +24,8 @@ #include #define XLAT_MACROS_ONLY -# include -# include +#include +#include #undef XLAT_MACROS_ONLY #define IFLA_ATTR IFLA_LINKINFO diff --git a/tests/nlattr_ndtmsg.c b/tests/nlattr_ndtmsg.c index c494218d..c41ff40c 100644 --- a/tests/nlattr_ndtmsg.c +++ b/tests/nlattr_ndtmsg.c @@ -111,9 +111,9 @@ main(void) .ndts_rcv_probes_ucast = 0xbcdefeacdadecdfe, .ndts_periodic_gc_runs = 0xedffeadedeffbecc, .ndts_forced_gc_runs = 0xfeefefeabedeedcd, -#ifdef HAVE_STRUCT_NDT_STATS_NDTS_TABLE_FULLS +# ifdef HAVE_STRUCT_NDT_STATS_NDTS_TABLE_FULLS .ndts_table_fulls = 0xadebfefaecdfeade -#endif /* HAVE_STRUCT_NDT_STATS_NDTS_TABLE_FULLS */ +# endif /* HAVE_STRUCT_NDT_STATS_NDTS_TABLE_FULLS */ }; TEST_NLATTR_OBJECT(fd, nlh0, hdrlen, init_ndtmsg, print_ndtmsg, @@ -128,9 +128,9 @@ main(void) PRINT_FIELD_U(", ", ndtst, ndts_rcv_probes_ucast); PRINT_FIELD_U(", ", ndtst, ndts_periodic_gc_runs); PRINT_FIELD_U(", ", ndtst, ndts_forced_gc_runs); -#ifdef HAVE_STRUCT_NDT_STATS_NDTS_TABLE_FULLS +# ifdef HAVE_STRUCT_NDT_STATS_NDTS_TABLE_FULLS PRINT_FIELD_U(", ", ndtst, ndts_table_fulls); -#endif /* HAVE_STRUCT_NDT_STATS_NDTS_TABLE_FULLS */ +# endif /* HAVE_STRUCT_NDT_STATS_NDTS_TABLE_FULLS */ printf("}")); #endif /* HAVE_STRUCT_NDT_STATS */ diff --git a/tests/nlattr_tc_stats.c b/tests/nlattr_tc_stats.c index 95b2c0b8..c0ebaf89 100644 --- a/tests/nlattr_tc_stats.c +++ b/tests/nlattr_tc_stats.c @@ -75,7 +75,7 @@ main(void) PRINT_FIELD_U(", ", sb, packets); printf("}")); -#ifdef HAVE_STRUCT_GNET_STATS_RATE_EST +# ifdef HAVE_STRUCT_GNET_STATS_RATE_EST static const struct gnet_stats_rate_est est = { .bps = 0xebcdaebd, .pps = 0xabdceade, @@ -86,9 +86,9 @@ main(void) PRINT_FIELD_U("{", est, bps); PRINT_FIELD_U(", ", est, pps); printf("}")); -#endif +# endif -#ifdef HAVE_STRUCT_GNET_STATS_QUEUE +# ifdef HAVE_STRUCT_GNET_STATS_QUEUE static const struct gnet_stats_queue qstats = { .qlen = 0xabcdeabd, .backlog = 0xbcdaebad, @@ -105,9 +105,9 @@ main(void) PRINT_FIELD_U(", ", qstats, requeues); PRINT_FIELD_U(", ", qstats, overlimits); printf("}")); -#endif +# endif -#ifdef HAVE_STRUCT_GNET_STATS_RATE_EST64 +# ifdef HAVE_STRUCT_GNET_STATS_RATE_EST64 static const struct gnet_stats_rate_est64 est64 = { .bps = 0xacbdcdefafecaebf, .pps = 0xcdabeabdfeabceaf @@ -118,7 +118,7 @@ main(void) PRINT_FIELD_U("{", est64, bps); PRINT_FIELD_U(", ", est64, pps); printf("}")); -#endif +# endif puts("+++ exited with 0 +++"); return 0; diff --git a/tests/oldselect-efault.c b/tests/oldselect-efault.c index 378b9fc9..4e927521 100644 --- a/tests/oldselect-efault.c +++ b/tests/oldselect-efault.c @@ -36,14 +36,14 @@ main(void) memset(args, 0, sizeof(*args) * 4); xselect(0); -#ifndef PATH_TRACING_FD +# ifndef PATH_TRACING_FD printf("select(NULL) = %s\n", errstr); -#endif +# endif xselect((uintptr_t) args); -#ifndef PATH_TRACING_FD +# ifndef PATH_TRACING_FD printf("select(%p) = %s\n", args, errstr); -#endif +# endif puts("+++ exited with 0 +++"); return 0; diff --git a/tests/openat.c b/tests/openat.c index 6c63f714..d4a74178 100644 --- a/tests/openat.c +++ b/tests/openat.c @@ -15,12 +15,12 @@ # include # include -#ifdef O_TMPFILE +# ifdef O_TMPFILE /* The kernel & C libraries often inline O_DIRECTORY. */ -# define STRACE_O_TMPFILE (O_TMPFILE & ~O_DIRECTORY) -#else -# define STRACE_O_TMPFILE 0 -#endif +# define STRACE_O_TMPFILE (O_TMPFILE & ~O_DIRECTORY) +# else +# define STRACE_O_TMPFILE 0 +# endif static const char sample[] = "openat.sample"; diff --git a/tests/perf_event_open.c b/tests/perf_event_open.c index ab8043f2..ae38b6de 100644 --- a/tests/perf_event_open.c +++ b/tests/perf_event_open.c @@ -236,107 +236,107 @@ print_event_attr(struct perf_event_attr *attr_ptr, size_t size, flags_data.raw = ((uint64_t *) attr)[5]; val = -# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_PRECISE_IP +# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_PRECISE_IP attr->precise_ip; -# else +# else flags_data.flags.precise_ip; -# endif +# endif printf(", precise_ip=%" PRIu64 " /* %s */", val, precise_ip_desc); val = -# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_MMAP_DATA +# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_MMAP_DATA attr->mmap_data; -# else +# else flags_data.flags.mmap_data; -# endif +# endif printf(", mmap_data=%" PRIu64, val); val = -# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_SAMPLE_ID_ALL +# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_SAMPLE_ID_ALL attr->sample_id_all; -# else +# else flags_data.flags.sample_id_all; -# endif +# endif printf(", sample_id_all=%" PRIu64, val); val = -# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_EXCLUDE_HOST +# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_EXCLUDE_HOST attr->exclude_host; -# else +# else flags_data.flags.exclude_host; -# endif +# endif printf(", exclude_host=%" PRIu64, val); val = -# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_EXCLUDE_GUEST +# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_EXCLUDE_GUEST attr->exclude_guest; -# else +# else flags_data.flags.exclude_guest; -# endif +# endif printf(", exclude_guest=%" PRIu64, val); val = -# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_EXCLUDE_CALLCHAIN_KERNEL +# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_EXCLUDE_CALLCHAIN_KERNEL attr->exclude_callchain_kernel; -# else +# else flags_data.flags.exclude_callchain_kernel; -# endif +# endif printf(", exclude_callchain_kernel=%" PRIu64, val); val = -# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_EXCLUDE_CALLCHAIN_USER +# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_EXCLUDE_CALLCHAIN_USER attr->exclude_callchain_user; -# else +# else flags_data.flags.exclude_callchain_user; -# endif +# endif printf(", exclude_callchain_user=%" PRIu64, val); val = -# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_MMAP2 +# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_MMAP2 attr->mmap2; -# else +# else flags_data.flags.mmap2; -# endif +# endif printf(", mmap2=%" PRIu64, val); val = -# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_COMM_EXEC +# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_COMM_EXEC attr->comm_exec; -# else +# else flags_data.flags.comm_exec; -# endif +# endif printf(", comm_exec=%" PRIu64, val); use_clockid = val = -# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_USE_CLOCKID +# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_USE_CLOCKID attr->use_clockid; -# else +# else flags_data.flags.use_clockid; -# endif +# endif printf(", use_clockid=%" PRIu64, val); val = -# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_CONTEXT_SWITCH +# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_CONTEXT_SWITCH attr->context_switch; -# else +# else flags_data.flags.context_switch; -# endif +# endif printf(", context_switch=%" PRIu64, val); val = -# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_WRITE_BACKWARD +# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_WRITE_BACKWARD attr->write_backward; -# else +# else flags_data.flags.write_backward; -# endif +# endif printf(", write_backward=%" PRIu64, val); val = -# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_NAMESPACES +# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_NAMESPACES attr->namespaces; -# else +# else flags_data.flags.namespaces; -# endif +# endif printf(", namespaces=%" PRIu64, val); val = flags_data.flags.__reserved_1; @@ -351,11 +351,11 @@ print_event_attr(struct perf_event_attr *attr_ptr, size_t size, printf(", bp_type=%s", bp_type); val = -# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_CONFIG1 +# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_CONFIG1 attr->config1; -# else +# else ((uint64_t *) attr)[56 / sizeof(uint64_t)]; -# endif +# endif printf(", %s=%#" PRIx64, attr->type == PERF_TYPE_BREAKPOINT ? "bp_addr" : "config1", val); @@ -367,11 +367,11 @@ print_event_attr(struct perf_event_attr *attr_ptr, size_t size, } val = -# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_CONFIG2 +# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_CONFIG2 attr->config2; -# else +# else ((uint64_t *) attr)[64 / sizeof(uint64_t)]; -# endif +# endif if (attr->type == PERF_TYPE_BREAKPOINT) printf(", bp_len=%" PRIu64, val); else @@ -397,11 +397,11 @@ print_event_attr(struct perf_event_attr *attr_ptr, size_t size, } val = -# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_SAMPLE_REGS_USER +# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_SAMPLE_REGS_USER attr->sample_regs_user; -# else +# else ((uint64_t *) attr)[80 / sizeof(uint64_t)]; -# endif +# endif printf(", sample_regs_user=%#" PRIx64, val); if (size <= 88) { @@ -410,11 +410,11 @@ print_event_attr(struct perf_event_attr *attr_ptr, size_t size, } val = -# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_SAMPLE_STACK_USER +# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_SAMPLE_STACK_USER attr->sample_stack_user; -# else +# else ((uint32_t *) attr)[88 / sizeof(uint32_t)]; -# endif +# endif /* * Print branch sample type only in case PERF_SAMPLE_STACK_USER * is set in the sample_type field. @@ -437,11 +437,11 @@ print_event_attr(struct perf_event_attr *attr_ptr, size_t size, } val = -# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_SAMPLE_REGS_INTR +# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_SAMPLE_REGS_INTR attr->sample_regs_intr; -# else +# else ((uint64_t *) attr)[96 / sizeof(uint64_t)]; -# endif +# endif printf(", sample_regs_intr=%#" PRIx64, val); /* End of version 4 of the structure */ @@ -451,11 +451,11 @@ print_event_attr(struct perf_event_attr *attr_ptr, size_t size, } val = -# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_AUX_WATERMARK +# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_AUX_WATERMARK attr->aux_watermark; -# else +# else ((uint32_t *) attr)[104 / sizeof(uint32_t)]; -# endif +# endif printf(", aux_watermark=%" PRIu32, (uint32_t) val); if (size <= 108) { @@ -464,11 +464,11 @@ print_event_attr(struct perf_event_attr *attr_ptr, size_t size, } val = -# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_SAMPLE_MAX_STACK +# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_SAMPLE_MAX_STACK attr->sample_max_stack; -# else +# else ((uint16_t *) attr)[108 / sizeof(uint16_t)]; -# endif +# endif printf(", sample_max_stack=%" PRIu16, (uint16_t) val); if (size <= 110) { diff --git a/tests/perf_event_open_nonverbose.c b/tests/perf_event_open_nonverbose.c index c0e01b22..b87cb2c6 100644 --- a/tests/perf_event_open_nonverbose.c +++ b/tests/perf_event_open_nonverbose.c @@ -22,11 +22,11 @@ # include "xlat.h" # include "xlat/perf_event_open_flags.h" -#if ULONG_MAX > UINT_MAX -#define LONG_STR_PREFIX "ffffffff" -#else -#define LONG_STR_PREFIX "" -#endif +# if ULONG_MAX > UINT_MAX +# define LONG_STR_PREFIX "ffffffff" +# else +# define LONG_STR_PREFIX "" +# endif static const char *printaddr(void *ptr) { diff --git a/tests/poll.c b/tests/poll.c index 32719ac7..c08bee8e 100644 --- a/tests/poll.c +++ b/tests/poll.c @@ -20,7 +20,7 @@ # include # include -#define PRINT_EVENT(flag, member) \ +# define PRINT_EVENT(flag, member) \ do { \ if (member & flag) { \ if (member != pfd->member) \ @@ -42,18 +42,18 @@ print_pollfd_entering(const struct pollfd *const pfd) PRINT_EVENT(POLLIN, events); PRINT_EVENT(POLLPRI, events); PRINT_EVENT(POLLOUT, events); -#ifdef POLLRDNORM +# ifdef POLLRDNORM PRINT_EVENT(POLLRDNORM, events); -#endif -#ifdef POLLWRNORM +# endif +# ifdef POLLWRNORM PRINT_EVENT(POLLWRNORM, events); -#endif -#ifdef POLLRDBAND +# endif +# ifdef POLLRDBAND PRINT_EVENT(POLLRDBAND, events); -#endif -#ifdef POLLWRBAND +# endif +# ifdef POLLWRBAND PRINT_EVENT(POLLWRBAND, events); -#endif +# endif PRINT_EVENT(POLLERR, events); PRINT_EVENT(POLLHUP, events); PRINT_EVENT(POLLNVAL, events); @@ -109,18 +109,18 @@ print_pollfd_exiting(const struct pollfd *const pfd, PRINT_EVENT(POLLIN, revents); PRINT_EVENT(POLLPRI, revents); PRINT_EVENT(POLLOUT, revents); -#ifdef POLLRDNORM +# ifdef POLLRDNORM PRINT_EVENT(POLLRDNORM, revents); -#endif -#ifdef POLLWRNORM +# endif +# ifdef POLLWRNORM PRINT_EVENT(POLLWRNORM, revents); -#endif -#ifdef POLLRDBAND +# endif +# ifdef POLLRDBAND PRINT_EVENT(POLLRDBAND, revents); -#endif -#ifdef POLLWRBAND +# endif +# ifdef POLLWRBAND PRINT_EVENT(POLLWRBAND, revents); -#endif +# endif PRINT_EVENT(POLLERR, revents); PRINT_EVENT(POLLHUP, revents); PRINT_EVENT(POLLNVAL, revents); diff --git a/tests/prctl-seccomp-filter-v.c b/tests/prctl-seccomp-filter-v.c index 4259a184..f29cfad6 100644 --- a/tests/prctl-seccomp-filter-v.c +++ b/tests/prctl-seccomp-filter-v.c @@ -31,23 +31,23 @@ && defined BPF_JUMP \ && defined BPF_STMT -#define SOCK_FILTER_ALLOW_SYSCALL(nr) \ +# define SOCK_FILTER_ALLOW_SYSCALL(nr) \ BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, __NR_ ## nr, 0, 1), \ BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ALLOW) -#define SOCK_FILTER_DENY_SYSCALL(nr, err) \ +# define SOCK_FILTER_DENY_SYSCALL(nr, err) \ BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, __NR_ ## nr, 0, 1), \ BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ERRNO|(SECCOMP_RET_DATA & (err))) -#define SOCK_FILTER_KILL_PROCESS \ +# define SOCK_FILTER_KILL_PROCESS \ BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_KILL) -#define PRINT_ALLOW_SYSCALL(nr) \ +# define PRINT_ALLOW_SYSCALL(nr) \ printf("BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, %#x, 0, 0x1), " \ "BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ALLOW), ", \ __NR_ ## nr) -#define PRINT_DENY_SYSCALL(nr, err) \ +# define PRINT_DENY_SYSCALL(nr, err) \ printf("BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, %#x, 0, 0x1), " \ "BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ERRNO|%#x), ", \ __NR_ ## nr, err) diff --git a/tests/preadv2-pwritev2.c b/tests/preadv2-pwritev2.c index d67702e4..f0e6987d 100644 --- a/tests/preadv2-pwritev2.c +++ b/tests/preadv2-pwritev2.c @@ -170,34 +170,34 @@ main(void) tprintf("%s", ""); -#if defined __x86_64__ && defined __ILP32__ +# if defined __x86_64__ && defined __ILP32__ /* * x32 is the only architecture where preadv2 takes 5 arguments, * see preadv64v2 in kernel sources. */ rc = syscall(__NR_preadv2, -1, NULL, vlen, pos_l, 1); -#else +# else const kernel_ulong_t pos_h = (sizeof(pos_l) == sizeof(pos)) ? (kernel_ulong_t) 0xbadc0deddeadbeefULL : (kernel_ulong_t) (pos >> 32); rc = syscall(__NR_preadv2, -1, NULL, vlen, pos_l, pos_h, 1); -#endif +# endif if (rc != -1 || (ENOSYS != errno && EBADF != errno)) perror_msg_and_fail("preadv2"); test_dumpio = EBADF == errno; tprintf("preadv2(-1, NULL, %lu, %lld, RWF_HIPRI) = %s\n", (unsigned long) vlen, pos, sprintrc(rc)); -#if defined __x86_64__ && defined __ILP32__ +# if defined __x86_64__ && defined __ILP32__ /* * x32 is the only architecture where pwritev2 takes 5 arguments, * see pwritev64v2 in kernel sources. */ rc = syscall(__NR_pwritev2, -1, NULL, vlen, pos_l, 1); -#else +# else rc = syscall(__NR_pwritev2, -1, NULL, vlen, pos_l, pos_h, 1); -#endif +# endif if (rc != -1 || (ENOSYS != errno && EBADF != errno)) perror_msg_and_fail("pwritev2"); tprintf("pwritev2(-1, NULL, %lu, %lld, RWF_HIPRI) = %s\n", diff --git a/tests/quotactl.c b/tests/quotactl.c index 1df75cb1..3a995276 100644 --- a/tests/quotactl.c +++ b/tests/quotactl.c @@ -57,9 +57,9 @@ struct if_nextdqblk { # include "xlat/if_dqinfo_flags.h" # include "xlat/if_dqinfo_valid.h" -#define QUOTA_STR(_arg) (_arg), gen_quotacmd(#_arg, _arg) -#define QUOTA_ID_STR(_arg) (_arg), gen_quotaid(#_arg, _arg) -#define QUOTA_STR_INVALID(_arg, str) (_arg), gen_quotacmd(str, _arg) +# define QUOTA_STR(_arg) (_arg), gen_quotacmd(#_arg, _arg) +# define QUOTA_ID_STR(_arg) (_arg), gen_quotaid(#_arg, _arg) +# define QUOTA_STR_INVALID(_arg, str) (_arg), gen_quotacmd(str, _arg) void print_dqblk(long rc, void *ptr, void *arg) @@ -139,25 +139,25 @@ print_dqinfo(long rc, void *ptr, void *arg) PRINT_FIELD_U(", ", *di, dqi_igrace); printf(", dqi_flags="); -#if XLAT_RAW +# if XLAT_RAW printf("%#x", di->dqi_flags); -#elif XLAT_VERBOSE +# elif XLAT_VERBOSE printf("%#x /* ", di->dqi_flags); printflags(if_dqinfo_flags, di->dqi_flags, "DQF_???"); printf(" */"); -#else /* XLAT_ABBREV */ +# else /* XLAT_ABBREV */ printflags(if_dqinfo_flags, di->dqi_flags, "DQF_???"); -#endif +# endif printf(", dqi_valid="); -#if XLAT_RAW +# if XLAT_RAW printf("%#x", di->dqi_valid); -#elif XLAT_VERBOSE +# elif XLAT_VERBOSE printf("%#x /* ", di->dqi_valid); printflags(if_dqinfo_valid, di->dqi_valid, "IIF_???"); printf(" */"); -#else /* XLAT_ABBREV */ +# else /* XLAT_ABBREV */ printflags(if_dqinfo_valid, di->dqi_valid, "IIF_???"); -#endif +# endif printf("}"); } @@ -173,10 +173,10 @@ print_dqfmt(long rc, void *ptr, void *arg) return; } printf("["); -#if XLAT_RAW +# if XLAT_RAW printf("%#x]", *fmtval); return; -#else +# else switch (*fmtval) { case 1: fmtstr = "QFMT_VFS_OLD"; @@ -194,12 +194,12 @@ print_dqfmt(long rc, void *ptr, void *arg) printf("%#x /* QFMT_VFS_??? */]", *fmtval); return; } -#endif -#if XLAT_VERBOSE +# endif +# if XLAT_VERBOSE printf("%#x /* %s */]", *fmtval, fmtstr); -#else +# else printf("%s]", fmtstr); -#endif +# endif } const char * @@ -207,13 +207,13 @@ gen_quotacmd(const char *abbrev_str, const uint32_t cmd) { static char quotacmd_str[2048]; -#if XLAT_RAW +# if XLAT_RAW snprintf(quotacmd_str, sizeof(quotacmd_str), "%u", cmd); -#elif XLAT_VERBOSE +# elif XLAT_VERBOSE snprintf(quotacmd_str, sizeof(quotacmd_str), "%u /* %s */", cmd, abbrev_str); -#else +# else return abbrev_str; -#endif +# endif return quotacmd_str; } @@ -222,13 +222,13 @@ gen_quotaid(const char *abbrev_str, const uint32_t id) { static char quotaid_str[1024]; -#if XLAT_RAW +# if XLAT_RAW snprintf(quotaid_str, sizeof(quotaid_str), "%#x", id); -#elif XLAT_VERBOSE +# elif XLAT_VERBOSE snprintf(quotaid_str, sizeof(quotaid_str), "%#x /* %s */", id, abbrev_str); -#else +# else return abbrev_str; -#endif +# endif return quotaid_str; } @@ -279,13 +279,13 @@ main(void) snprintf(invalid_cmd_str, sizeof(invalid_cmd_str), "QCMD(Q_QUOTAON, %#x /* ???QUOTA */)", QCMD_TYPE(QCMD(Q_QUOTAON, 0xfacefeed))); -#if XLAT_RAW +# if XLAT_RAW snprintf(invalid_id_str, sizeof(invalid_id_str), "%#x", bogus_id); -#else +# else snprintf(invalid_id_str, sizeof(invalid_id_str), "%#x /* QFMT_VFS_??? */", bogus_id); -#endif +# endif check_quota(CQF_ID_STR, QCMD(Q_QUOTAON, 0xfacefeed), gen_quotacmd(invalid_cmd_str, QCMD(Q_QUOTAON, 0xfacefeed)), bogus_dev, bogus_dev_str, diff --git a/tests/quotactl.h b/tests/quotactl.h index e624c6ae..4d29ac11 100644 --- a/tests/quotactl.h +++ b/tests/quotactl.h @@ -10,7 +10,7 @@ */ #ifndef STRACE_TESTS_QUOTACTL_H -#define STRACE_TESTS_QUOTACTL_H +# define STRACE_TESTS_QUOTACTL_H # include # include @@ -165,7 +165,7 @@ check_quota(uint32_t flags, int cmd, const char *cmd_str, errstr = sprintrc(rc); -#ifdef INJECT_RETVAL +# ifdef INJECT_RETVAL if (rc != INJECT_RETVAL) error_msg_and_fail("Got a return value of %ld != %d", rc, INJECT_RETVAL); @@ -174,7 +174,7 @@ check_quota(uint32_t flags, int cmd, const char *cmd_str, snprintf(inj_errstr, sizeof(inj_errstr), "%s (INJECTED)", errstr); errstr = inj_errstr; -#endif +# endif printf("quotactl(%s, %s", cmd_str, special_str); diff --git a/tests/remap_file_pages.c b/tests/remap_file_pages.c index 3822e27f..2a2bfc6e 100644 --- a/tests/remap_file_pages.c +++ b/tests/remap_file_pages.c @@ -62,13 +62,13 @@ main(void) (uintmax_t) pgoff, flags1_str, errstr); # endif -#ifdef MAP_HUGETLB -# ifndef MAP_HUGE_2MB -# ifndef MAP_HUGE_SHIFT -# define MAP_HUGE_SHIFT 26 -# endif -# define MAP_HUGE_2MB (21 << MAP_HUGE_SHIFT) -# endif /* !MAP_HUGE_2MB */ +# ifdef MAP_HUGETLB +# ifndef MAP_HUGE_2MB +# ifndef MAP_HUGE_SHIFT +# define MAP_HUGE_SHIFT 26 +# endif +# define MAP_HUGE_2MB (21 << MAP_HUGE_SHIFT) +# endif /* !MAP_HUGE_2MB */ addr = (kernel_ulong_t) 0xfacefeeddeadf00dULL; size = (kernel_ulong_t) 0xdefaced1bad2beefULL; prot = (kernel_ulong_t) 0xdefaced00000000ULL | PROT_NONE; @@ -80,32 +80,32 @@ main(void) * HP PA-RISC is the only architecture that has MAP_TYPE defined to 0x3, which * is also used for MAP_SHARED_VALIDATE since Linux commit v4.15-rc1~71^2^2~23. */ -# ifdef __hppa__ -# define MAP_TYPE_str "MAP_SHARED_VALIDATE" -# else -# define MAP_TYPE_str "0xf /* MAP_??? */" -# endif -# define flags2_str \ +# ifdef __hppa__ +# define MAP_TYPE_str "MAP_SHARED_VALIDATE" +# else +# define MAP_TYPE_str "0xf /* MAP_??? */" +# endif +# define flags2_str \ MAP_TYPE_str "|MAP_FIXED|MAP_NORESERVE|MAP_HUGETLB|21<)\\) = 0\n", diff --git a/tests/rt_sigpending.c b/tests/rt_sigpending.c index 8d2dc455..06b15db2 100644 --- a/tests/rt_sigpending.c +++ b/tests/rt_sigpending.c @@ -35,12 +35,12 @@ iterate(const char *const text, unsigned int size, void *set) break; } if (size) { -#if WORDS_BIGENDIAN +# if WORDS_BIGENDIAN if (size < sizeof(long)) tprintf("rt_sigpending(%s, %u) = 0\n", "[]", size); else -#endif +# endif tprintf("rt_sigpending(%s, %u) = 0\n", text, size); } else { diff --git a/tests/seccomp-filter-v.c b/tests/seccomp-filter-v.c index a6fb0781..b4bc9f82 100644 --- a/tests/seccomp-filter-v.c +++ b/tests/seccomp-filter-v.c @@ -31,23 +31,23 @@ && defined BPF_JUMP \ && defined BPF_STMT -#define SOCK_FILTER_ALLOW_SYSCALL(nr) \ +# define SOCK_FILTER_ALLOW_SYSCALL(nr) \ BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, __NR_ ## nr, 0, 1), \ BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ALLOW) -#define SOCK_FILTER_DENY_SYSCALL(nr, err) \ +# define SOCK_FILTER_DENY_SYSCALL(nr, err) \ BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, __NR_ ## nr, 0, 1), \ BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ERRNO|(SECCOMP_RET_DATA & (err))) -#define SOCK_FILTER_KILL_PROCESS \ +# define SOCK_FILTER_KILL_PROCESS \ BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_KILL) -#define PRINT_ALLOW_SYSCALL(nr) \ +# define PRINT_ALLOW_SYSCALL(nr) \ tprintf("BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, %#x, 0, 0x1), " \ "BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ALLOW), ", \ __NR_ ## nr) -#define PRINT_DENY_SYSCALL(nr, err) \ +# define PRINT_DENY_SYSCALL(nr, err) \ tprintf("BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, %#x, 0, 0x1), " \ "BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ERRNO|%#x), ", \ __NR_ ## nr, err) diff --git a/tests/sethostname.c b/tests/sethostname.c index 5e232302..c9b89c12 100644 --- a/tests/sethostname.c +++ b/tests/sethostname.c @@ -17,13 +17,13 @@ # include # include -#ifdef HAVE_LINUX_UTSNAME_H -# include -#endif +# ifdef HAVE_LINUX_UTSNAME_H +# include +# endif -#ifndef __NEW_UTS_LEN -# define __NEW_UTS_LEN 64 -#endif +# ifndef __NEW_UTS_LEN +# define __NEW_UTS_LEN 64 +# endif int main(void) diff --git a/tests/sigaction.c b/tests/sigaction.c index 95be1971..fe6280ce 100644 --- a/tests/sigaction.c +++ b/tests/sigaction.c @@ -19,29 +19,29 @@ # include struct set_sa { -#if defined MIPS +# if defined MIPS unsigned int flags; unsigned long handler; unsigned long mask[1]; -#elif defined ALPHA +# elif defined ALPHA unsigned long handler; unsigned long mask[1]; unsigned int flags; -#else +# else unsigned long handler; unsigned long mask[1]; unsigned long flags; unsigned long restorer; -#endif +# endif } -#ifdef ALPHA +# ifdef ALPHA ATTRIBUTE_PACKED -#endif +# endif ; typedef struct set_sa struct_set_sa; -#ifdef MIPS +# ifdef MIPS struct get_sa { unsigned int flags; @@ -51,11 +51,11 @@ struct get_sa { typedef struct get_sa struct_get_sa; -#else +# else typedef struct set_sa struct_get_sa; -#endif +# endif static long k_sigaction(const kernel_ulong_t signum, const kernel_ulong_t new_act, @@ -64,19 +64,19 @@ k_sigaction(const kernel_ulong_t signum, const kernel_ulong_t new_act, return syscall(__NR_sigaction, signum, new_act, old_act); } -#if defined SPARC || defined SPARC64 +# if defined SPARC || defined SPARC64 /* * See arch/sparc/kernel/sys_sparc_32.c:sys_sparc_sigaction * and arch/sparc/kernel/sys_sparc32.c:compat_sys_sparc_sigaction */ -# define ADDR_INT ((unsigned int) -0xdefaced) -# define SIGNO_INT ((unsigned int) -SIGUSR1) -# define SIG_STR "-SIGUSR1" -#else -# define ADDR_INT ((unsigned int) 0xdefaced) -# define SIGNO_INT ((unsigned int) SIGUSR1) -# define SIG_STR "SIGUSR1" -#endif +# define ADDR_INT ((unsigned int) -0xdefaced) +# define SIGNO_INT ((unsigned int) -SIGUSR1) +# define SIG_STR "-SIGUSR1" +# else +# define ADDR_INT ((unsigned int) 0xdefaced) +# define SIGNO_INT ((unsigned int) SIGUSR1) +# define SIG_STR "SIGUSR1" +# endif static const kernel_ulong_t signo = (kernel_ulong_t) 0xbadc0ded00000000ULL | SIGNO_INT; static const kernel_ulong_t addr = @@ -156,16 +156,16 @@ main(void) sigdelset(mask.libc, SIGHUP); memcpy(new_act->mask, mask.old, sizeof(mask.old)); -#ifdef SA_RESTORER +# ifdef SA_RESTORER new_act->flags = SA_RESTORER; new_act->restorer = (unsigned long) 0xdeadfacecafef00dULL; -# define SA_RESTORER_FMT ", sa_flags=SA_RESTORER, sa_restorer=%#lx" -# define SA_RESTORER_ARGS , new_act->restorer -#else +# define SA_RESTORER_FMT ", sa_flags=SA_RESTORER, sa_restorer=%#lx" +# define SA_RESTORER_ARGS , new_act->restorer +# else new_act->flags = SA_NODEFER; -# define SA_RESTORER_FMT ", sa_flags=SA_NODEFER" -# define SA_RESTORER_ARGS -#endif +# define SA_RESTORER_FMT ", sa_flags=SA_NODEFER" +# define SA_RESTORER_ARGS +# endif k_sigaction(signo, (uintptr_t) new_act, (uintptr_t) old_act); printf("sigaction(" SIG_STR ", {sa_handler=%#lx, sa_mask=~[HUP]" diff --git a/tests/sigsuspend.c b/tests/sigsuspend.c index aec2a6b6..11ffae83 100644 --- a/tests/sigsuspend.c +++ b/tests/sigsuspend.c @@ -75,11 +75,11 @@ main(void) sigdelset(&u.libc_mask, SIGUSR2); const unsigned long mask2 = u.old_mask; -#if SIGNAL_MASK_BY_REF +# if SIGNAL_MASK_BY_REF k_sigsuspend((uintptr_t) &mask1, 0xdeadbeef, (uintptr_t) &mask2); -#else +# else k_sigsuspend(mask1, 0xdeadbeef, mask2); -#endif +# endif if (EINTR != errno) perror_msg_and_skip("sigsuspend"); diff --git a/tests/stack-fcall.h b/tests/stack-fcall.h index 8dbe8b28..cca0f94f 100644 --- a/tests/stack-fcall.h +++ b/tests/stack-fcall.h @@ -7,10 +7,10 @@ #ifdef MANGLE -#define f0 _ZN2ns2f0Ei -#define f1 _ZN2ns2f1Ei -#define f2 _ZN2ns2f2Ei -#define f3 _ZN2ns2f3Ei +# define f0 _ZN2ns2f0Ei +# define f1 _ZN2ns2f1Ei +# define f2 _ZN2ns2f2Ei +# define f3 _ZN2ns2f3Ei #endif diff --git a/tests/tests.h b/tests/tests.h index 3c2ec378..69ec810a 100644 --- a/tests/tests.h +++ b/tests/tests.h @@ -7,53 +7,53 @@ */ #ifndef STRACE_TESTS_H -#define STRACE_TESTS_H +# define STRACE_TESTS_H -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif +# ifdef HAVE_CONFIG_H +# include "config.h" +# endif -#ifdef TESTS_SIZEOF_KERNEL_LONG_T -# undef SIZEOF_KERNEL_LONG_T -# define SIZEOF_KERNEL_LONG_T TESTS_SIZEOF_KERNEL_LONG_T -#endif +# ifdef TESTS_SIZEOF_KERNEL_LONG_T +# undef SIZEOF_KERNEL_LONG_T +# define SIZEOF_KERNEL_LONG_T TESTS_SIZEOF_KERNEL_LONG_T +# endif -#ifdef TESTS_SIZEOF_LONG -# undef SIZEOF_LONG -# define SIZEOF_LONG TESTS_SIZEOF_LONG -#endif +# ifdef TESTS_SIZEOF_LONG +# undef SIZEOF_LONG +# define SIZEOF_LONG TESTS_SIZEOF_LONG +# endif -#include -#include -#include "kernel_types.h" -#include "gcc_compat.h" -#include "macros.h" +# include +# include +# include "kernel_types.h" +# include "gcc_compat.h" +# include "macros.h" /* * The printf-like function to use in header files * shared between strace and its tests. */ -#ifndef STRACE_PRINTF -# define STRACE_PRINTF printf -#endif +# ifndef STRACE_PRINTF +# define STRACE_PRINTF printf +# endif /* Tests of "strace -v" are expected to define VERBOSE to 1. */ -#ifndef VERBOSE -# define VERBOSE 0 -#endif +# ifndef VERBOSE +# define VERBOSE 0 +# endif /* xlat verbosity defaults */ -#ifndef XLAT_RAW -# define XLAT_RAW 0 -#endif -#ifndef XLAT_VERBOSE -# define XLAT_VERBOSE 0 -#endif - -#ifndef DEFAULT_STRLEN +# ifndef XLAT_RAW +# define XLAT_RAW 0 +# endif +# ifndef XLAT_VERBOSE +# define XLAT_VERBOSE 0 +# endif + +# ifndef DEFAULT_STRLEN /* Default maximum # of bytes printed in printstr et al. */ -# define DEFAULT_STRLEN 32 -#endif +# define DEFAULT_STRLEN 32 +# endif /* Cached sysconf(_SC_PAGESIZE). */ size_t get_page_size(void); @@ -74,14 +74,14 @@ void error_msg_and_skip(const char *, ...) void perror_msg_and_skip(const char *, ...) ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN; -#ifndef perror_msg_and_fail -# define perror_msg_and_fail(fmt_, ...) \ +# ifndef perror_msg_and_fail +# define perror_msg_and_fail(fmt_, ...) \ perror_msg_and_fail("%s:%d: " fmt_, __FILE__, __LINE__, ##__VA_ARGS__) -#endif -#ifndef perror_msg_and_fail -# define error_msg_and_fail(fmt_, ...) \ +# endif +# ifndef perror_msg_and_fail +# define error_msg_and_fail(fmt_, ...) \ error_msg_and_fail("%s:%d: " fmt_, __FILE__, __LINE__, ##__VA_ARGS__) -#endif +# endif /* Stat the specified file and skip the test if the stat call failed. */ void skip_if_unavailable(const char *); @@ -97,7 +97,7 @@ void *tail_alloc(const size_t) void *tail_memdup(const void *, const size_t) ATTRIBUTE_MALLOC ATTRIBUTE_ALLOC_SIZE((2)); -#define midtail_alloc(after_, before_) \ +# define midtail_alloc(after_, before_) \ ((void *) ((char *) tail_alloc(((before_) + (after_))) + (before_))) /* @@ -105,7 +105,7 @@ void *tail_memdup(const void *, const size_t) * of a mapped memory region. * Assign its address to the specified constant pointer. */ -#define TAIL_ALLOC_OBJECT_CONST_PTR(type_name, type_ptr) \ +# define TAIL_ALLOC_OBJECT_CONST_PTR(type_name, type_ptr) \ type_name *const type_ptr = tail_alloc(sizeof(*type_ptr)) /* @@ -113,7 +113,7 @@ void *tail_memdup(const void *, const size_t) * of a mapped memory region. * Assign its address to the specified variable pointer. */ -#define TAIL_ALLOC_OBJECT_VAR_PTR(type_name, type_ptr) \ +# define TAIL_ALLOC_OBJECT_VAR_PTR(type_name, type_ptr) \ type_name *type_ptr = tail_alloc(sizeof(*type_ptr)) /* @@ -216,7 +216,7 @@ int send_mmsg(int, struct mmsghdr *, unsigned int, unsigned int); /* Create a netlink socket. */ int create_nl_socket_ext(int proto, const char *name); -#define create_nl_socket(proto) create_nl_socket_ext((proto), #proto) +# define create_nl_socket(proto) create_nl_socket_ext((proto), #proto) /* Create a pipe with maximized descriptor numbers. */ void pipe_maxfd(int pipefd[2]); @@ -224,14 +224,14 @@ void pipe_maxfd(int pipefd[2]); /* if_nametoindex("lo") */ unsigned int ifindex_lo(void); -#ifdef HAVE_IF_INDEXTONAME -# define IFINDEX_LO_STR "if_nametoindex(\"lo\")" -#else -# define IFINDEX_LO_STR "1" -#endif +# ifdef HAVE_IF_INDEXTONAME +# define IFINDEX_LO_STR "if_nametoindex(\"lo\")" +# else +# define IFINDEX_LO_STR "1" +# endif -#define F8ILL_KULONG_SUPPORTED (sizeof(void *) < sizeof(kernel_ulong_t)) -#define F8ILL_KULONG_MASK ((kernel_ulong_t) 0xffffffff00000000ULL) +# define F8ILL_KULONG_SUPPORTED (sizeof(void *) < sizeof(kernel_ulong_t)) +# define F8ILL_KULONG_MASK ((kernel_ulong_t) 0xffffffff00000000ULL) /* * For 64-bit kernel_ulong_t and 32-bit pointer, @@ -249,7 +249,7 @@ f8ill_ptr_to_kulong(const void *const ptr) # define LENGTH_OF(arg) ((unsigned int) sizeof(arg) - 1) /* Zero-extend a signed integer type to unsigned long long. */ -#define zero_extend_signed_to_ull(v) \ +# define zero_extend_signed_to_ull(v) \ (sizeof(v) == sizeof(char) ? (unsigned long long) (unsigned char) (v) : \ sizeof(v) == sizeof(short) ? (unsigned long long) (unsigned short) (v) : \ sizeof(v) == sizeof(int) ? (unsigned long long) (unsigned int) (v) : \ @@ -257,36 +257,36 @@ f8ill_ptr_to_kulong(const void *const ptr) (unsigned long long) (v)) /* Sign-extend an unsigned integer type to long long. */ -#define sign_extend_unsigned_to_ll(v) \ +# define sign_extend_unsigned_to_ll(v) \ (sizeof(v) == sizeof(char) ? (long long) (char) (v) : \ sizeof(v) == sizeof(short) ? (long long) (short) (v) : \ sizeof(v) == sizeof(int) ? (long long) (int) (v) : \ sizeof(v) == sizeof(long) ? (long long) (long) (v) : \ (long long) (v)) -#define SKIP_MAIN_UNDEFINED(arg) \ +# define SKIP_MAIN_UNDEFINED(arg) \ int main(void) { error_msg_and_skip("undefined: %s", arg); } -#if WORDS_BIGENDIAN -# define LL_PAIR(HI, LO) (HI), (LO) -#else -# define LL_PAIR(HI, LO) (LO), (HI) -#endif -#define LL_VAL_TO_PAIR(llval) LL_PAIR((long) ((llval) >> 32), (long) (llval)) +# if WORDS_BIGENDIAN +# define LL_PAIR(HI, LO) (HI), (LO) +# else +# define LL_PAIR(HI, LO) (LO), (HI) +# endif +# define LL_VAL_TO_PAIR(llval) LL_PAIR((long) ((llval) >> 32), (long) (llval)) -#define ARG_STR(_arg) (_arg), #_arg -#define ARG_ULL_STR(_arg) _arg##ULL, #_arg +# define ARG_STR(_arg) (_arg), #_arg +# define ARG_ULL_STR(_arg) _arg##ULL, #_arg /* * Assign an object of type DEST_TYPE at address DEST_ADDR * using memcpy to avoid potential unaligned access. */ -#define SET_STRUCT(DEST_TYPE, DEST_ADDR, ...) \ +# define SET_STRUCT(DEST_TYPE, DEST_ADDR, ...) \ do { \ DEST_TYPE dest_type_tmp_var = { __VA_ARGS__ }; \ memcpy(DEST_ADDR, &dest_type_tmp_var, sizeof(dest_type_tmp_var)); \ } while (0) -#define NLMSG_ATTR(nlh, hdrlen) ((void *)(nlh) + NLMSG_SPACE(hdrlen)) +# define NLMSG_ATTR(nlh, hdrlen) ((void *)(nlh) + NLMSG_SPACE(hdrlen)) #endif /* !STRACE_TESTS_H */ diff --git a/tests/timer_create.c b/tests/timer_create.c index 53a3ae32..c9c64813 100644 --- a/tests/timer_create.c +++ b/tests/timer_create.c @@ -78,9 +78,9 @@ main(void) sev.sigev_un.sigev_thread.attribute, tid[2]); -#ifndef SIGEV_THREAD_ID -# define SIGEV_THREAD_ID 4 -#endif +# ifndef SIGEV_THREAD_ID +# define SIGEV_THREAD_ID 4 +# endif sev.sigev_notify = SIGEV_THREAD_ID; sev.sigev_un.tid = getpid(); if (syscall(__NR_timer_create, CLOCK_MONOTONIC, &sev, &tid[3])) diff --git a/tests/utimensat.c b/tests/utimensat.c index a5c8f78e..170b2c89 100644 --- a/tests/utimensat.c +++ b/tests/utimensat.c @@ -19,7 +19,7 @@ #if defined __NR_utimensat && defined UTIME_NOW && defined UTIME_OMIT -#if SIZEOF_KERNEL_LONG_T == 4 +# if SIZEOF_KERNEL_LONG_T == 4 # define big_tv_sec "-559038737" # define huge_tv_sec "-559038737" # else diff --git a/tests/xstatx.c b/tests/xstatx.c index fe92449e..0d223bdc 100644 --- a/tests/xstatx.c +++ b/tests/xstatx.c @@ -101,7 +101,7 @@ typedef off_t libc_off_t; # define IS_STATX 0 # endif -#if !XLAT_RAW /* Fixes -Wunused warning */ +# if !XLAT_RAW /* Fixes -Wunused warning */ static void print_ftype(const unsigned int mode) { @@ -122,24 +122,24 @@ print_perms(const unsigned int mode) { printf("%#o", mode & ~S_IFMT); } -#endif +# endif static void print_st_mode(const unsigned int mode) { -#if XLAT_RAW +# if XLAT_RAW printf("%#o", mode); -#elif XLAT_VERBOSE +# elif XLAT_VERBOSE printf("%#o /* ", mode); print_ftype(mode); printf("|"); print_perms(mode); printf(" */"); -#else +# else print_ftype(mode); printf("|"); print_perms(mode); -#endif +# endif } # if !IS_STATX @@ -150,18 +150,18 @@ sprint_makedev(const unsigned long long val) static char devid[256]; int ret; -#if XLAT_RAW +# if XLAT_RAW ret = snprintf(devid, sizeof(devid), "%#llx", val); -#elif XLAT_VERBOSE +# elif XLAT_VERBOSE ret = snprintf(devid, sizeof(devid), "%#llx /* makedev(%#x, %#x) */", val, major(val), minor(val)); -#else /* XLAT_ABBREV */ +# else /* XLAT_ABBREV */ ret = snprintf(devid, sizeof(devid), "makedev(%#x, %#x)", major(val), minor(val)); -#endif +# endif if (ret < 0) perror_msg_and_fail("sprint_makedev(%llx)", val); if ((unsigned) ret >= sizeof(devid)) @@ -208,7 +208,7 @@ print_stat(const STRUCT_STAT *st) # define HAVE_NSEC 0 # endif -#define PRINT_ST_TIME(field) \ +# define PRINT_ST_TIME(field) \ do { \ printf(", st_" #field "=%lld", \ sign_extend_unsigned_to_ll(st->st_ ## field)); \ diff --git a/trace_event.h b/trace_event.h index 7ed75ad5..53a711b8 100644 --- a/trace_event.h +++ b/trace_event.h @@ -6,7 +6,7 @@ */ #ifndef STRACE_TRACE_EVENT_H -#define STRACE_TRACE_EVENT_H +# define STRACE_TRACE_EVENT_H /* Possible trace event loop states. Returned by next_event() and dispatched by * dispatch_event(). */ diff --git a/unwind.h b/unwind.h index d3236dea..1cf4c367 100644 --- a/unwind.h +++ b/unwind.h @@ -8,9 +8,9 @@ */ #ifndef STRACE_UNWIND_H -#define STRACE_UNWIND_H +# define STRACE_UNWIND_H -#include "defs.h" +# include "defs.h" /* * Type used in stacktrace walker. diff --git a/userfaultfd.c b/userfaultfd.c index 7a60af19..c251a6bb 100644 --- a/userfaultfd.c +++ b/userfaultfd.c @@ -38,7 +38,7 @@ tprintf_uffdio_range(const struct uffdio_range *range) tprints("}"); } -#define PRINT_FIELD_UFFDIO_RANGE(prefix_, where_, field_) \ +# define PRINT_FIELD_UFFDIO_RANGE(prefix_, where_, field_) \ do { \ STRACE_PRINTF("%s%s=", (prefix_), #field_); \ tprintf_uffdio_range(&(where_).field_); \ diff --git a/util.c b/util.c index aefedeeb..bbe3fa5a 100644 --- a/util.c +++ b/util.c @@ -845,19 +845,19 @@ dumpiov_upto(struct tcb *const tcp, const int len, const kernel_ulong_t addr, struct { uint32_t base; uint32_t len; } *iov32; struct { uint64_t base; uint64_t len; } *iov64; } iovu; -#define iov iovu.iov64 -#define sizeof_iov \ +# define iov iovu.iov64 +# define sizeof_iov \ (current_wordsize == 4 ? (unsigned int) sizeof(*iovu.iov32) \ : (unsigned int) sizeof(*iovu.iov64)) -#define iov_iov_base(i) \ +# define iov_iov_base(i) \ (current_wordsize == 4 ? (uint64_t) iovu.iov32[i].base : iovu.iov64[i].base) -#define iov_iov_len(i) \ +# define iov_iov_len(i) \ (current_wordsize == 4 ? (uint64_t) iovu.iov32[i].len : iovu.iov64[i].len) #else struct iovec *iov; -#define sizeof_iov ((unsigned int) sizeof(*iov)) -#define iov_iov_base(i) ptr_to_kulong(iov[i].iov_base) -#define iov_iov_len(i) iov[i].iov_len +# define sizeof_iov ((unsigned int) sizeof(*iov)) +# define iov_iov_base(i) ptr_to_kulong(iov[i].iov_base) +# define iov_iov_len(i) iov[i].iov_len #endif int i; unsigned int size = sizeof_iov * len; diff --git a/v4l2.c b/v4l2.c index fb6df8cc..edc06f2f 100644 --- a/v4l2.c +++ b/v4l2.c @@ -314,10 +314,10 @@ print_v4l2_format_fmt(struct tcb *const tcp, const char *prefix, tprints(prefix); tprints("fmt.sdr={pixelformat="); print_pixelformat(f->fmt.sdr.pixelformat, v4l2_sdr_fmts); -#ifdef HAVE_STRUCT_V4L2_SDR_FORMAT_BUFFERSIZE +# ifdef HAVE_STRUCT_V4L2_SDR_FORMAT_BUFFERSIZE tprintf(", buffersize=%u", f->fmt.sdr.buffersize); -#endif +# endif tprints("}"); break; #endif diff --git a/wait.h b/wait.h index 529daf11..f4e626bc 100644 --- a/wait.h +++ b/wait.h @@ -6,13 +6,13 @@ */ #ifndef STRACE_WAIT_H -#define STRACE_WAIT_H +# define STRACE_WAIT_H -#include "defs.h" +# include "defs.h" -#include +# include -#include "static_assert.h" +# include "static_assert.h" /* * On Linux, the "core dumped" flag is hard-coded to 0x80: @@ -20,23 +20,23 @@ * fs/coredump.c:do_coredump() between v3.7-rc1~134^2~4 and v3.10-rc1~143^2~41, * or fs/exec.c:do_coredump() before v3.7-rc1~134^2~4 */ -#ifndef WCOREFLAG -# define WCOREFLAG 0x80 -#else +# ifndef WCOREFLAG +# define WCOREFLAG 0x80 +# else static_assert((WCOREFLAG) == 0x80, "WCOREFLAG != 0x80"); -#endif -#ifndef WCOREDUMP -# define WCOREDUMP(status) ((status) & (WCOREFLAG)) -#endif +# endif +# ifndef WCOREDUMP +# define WCOREDUMP(status) ((status) & (WCOREFLAG)) +# endif -#ifndef W_STOPCODE -# define W_STOPCODE(sig) ((sig) << 8 | 0x7f) -#endif -#ifndef W_EXITCODE -# define W_EXITCODE(ret, sig) ((ret) << 8 | (sig)) -#endif -#ifndef W_CONTINUED -# define W_CONTINUED 0xffff -#endif +# ifndef W_STOPCODE +# define W_STOPCODE(sig) ((sig) << 8 | 0x7f) +# endif +# ifndef W_EXITCODE +# define W_EXITCODE(ret, sig) ((ret) << 8 | (sig)) +# endif +# ifndef W_CONTINUED +# define W_CONTINUED 0xffff +# endif #endif /* STRACE_WAIT_H */ diff --git a/xlat.h b/xlat.h index 05778061..366678ac 100644 --- a/xlat.h +++ b/xlat.h @@ -6,7 +6,7 @@ */ #ifndef STRACE_XLAT_H -#define STRACE_XLAT_H +# define STRACE_XLAT_H # include @@ -35,17 +35,17 @@ enum xlat_style { /** Always print both raw number and xlat processing result. */ XLAT_STYLE_VERBOSE = XLAT_STYLE_RAW | XLAT_STYLE_ABBREV, -#define XLAT_STYLE_FORMAT_SHIFT 2 -#define XLAT_STYLE_VERBOSITY_MASK ((1 << XLAT_STYLE_FORMAT_SHIFT) - 1) +# define XLAT_STYLE_FORMAT_SHIFT 2 +# define XLAT_STYLE_VERBOSITY_MASK ((1 << XLAT_STYLE_FORMAT_SHIFT) - 1) XLAT_STYLE_FMT_X = 0 << XLAT_STYLE_FORMAT_SHIFT, XLAT_STYLE_FMT_U = 1 << XLAT_STYLE_FORMAT_SHIFT, XLAT_STYLE_FMT_D = 2 << XLAT_STYLE_FORMAT_SHIFT, -#define XLAT_STYLE_FORMAT_MASK (3 << XLAT_STYLE_FORMAT_SHIFT) +# define XLAT_STYLE_FORMAT_MASK (3 << XLAT_STYLE_FORMAT_SHIFT) -#define XLAT_STYLE_SPEC_BITS (XLAT_STYLE_FORMAT_SHIFT + 2) -#define XLAT_STYLE_MASK ((1 << XLAT_STYLE_SPEC_BITS) - 1) +# define XLAT_STYLE_SPEC_BITS (XLAT_STYLE_FORMAT_SHIFT + 2) +# define XLAT_STYLE_MASK ((1 << XLAT_STYLE_SPEC_BITS) - 1) }; struct xlat { diff --git a/xlat/mmap_flags.in b/xlat/mmap_flags.in index 53f28faa..5a592494 100644 --- a/xlat/mmap_flags.in +++ b/xlat/mmap_flags.in @@ -30,10 +30,10 @@ MAP_32BIT #if defined MAP_RENAME && MAP_RENAME == MAP_ANONYMOUS /* MAP_RENAME is unusual */ # ifndef STRACE_WORKAROUND_FOR_MAP_RENAME -# define STRACE_WORKAROUND_FOR_MAP_RENAME +# define STRACE_WORKAROUND_FOR_MAP_RENAME /* glibc erroneously defines MAP_RENAME to MAP_ANONYMOUS on some architectures. */ /* This is just wrong and has to be fixed. */ -# undef MAP_RENAME +# undef MAP_RENAME # endif #endif /* MAP_RENAME */ @@ -151,9 +151,9 @@ MAP_HUGETLB 0x40000 MAP_SYNC 0x80000 -# if defined MAP_UNINITIALIZED && MAP_UNINITIALIZED > 0 +#if defined MAP_UNINITIALIZED && MAP_UNINITIALIZED > 0 MAP_UNINITIALIZED -# endif +#endif #if defined __alpha__ MAP_FIXED_NOREPLACE 0x200000 diff --git a/xlat/open_mode_flags.in b/xlat/open_mode_flags.in index e35ed487..82377e2b 100644 --- a/xlat/open_mode_flags.in +++ b/xlat/open_mode_flags.in @@ -89,11 +89,11 @@ O_RSYNC #if defined O_NDELAY && O_NDELAY & O_NONBLOCK /* O_NDELAY is unusual */ # ifndef STRACE_WORKAROUND_FOR_O_NDELAY -# define STRACE_WORKAROUND_FOR_O_NDELAY +# define STRACE_WORKAROUND_FOR_O_NDELAY /* On sparc32 O_NDELAY is erroneously defined to (0x0004 | O_NONBLOCK). */ /* On many architectures O_NDELAY is defined to O_NONBLOCK. */ /* Both cases are wrong and have to be fixed. */ -# undef O_NDELAY +# undef O_NDELAY # endif #endif /* O_NDELAY & O_NONBLOCK */ diff --git a/xmalloc.h b/xmalloc.h index f2a06178..a4e7792f 100644 --- a/xmalloc.h +++ b/xmalloc.h @@ -11,13 +11,13 @@ */ #ifndef STRACE_XMALLOC_H -#define STRACE_XMALLOC_H +# define STRACE_XMALLOC_H -#include -#include "gcc_compat.h" +# include +# include "gcc_compat.h" -#define xcalloc strace_calloc -#define xmalloc strace_malloc +# define xcalloc strace_calloc +# define xmalloc strace_malloc void *xcalloc(size_t nmemb, size_t size) ATTRIBUTE_MALLOC ATTRIBUTE_ALLOC_SIZE((1, 2)); diff --git a/xstring.h b/xstring.h index 07dcaac5..affaf791 100644 --- a/xstring.h +++ b/xstring.h @@ -6,13 +6,13 @@ */ #ifndef STRACE_XSTRING_H -#define STRACE_XSTRING_H +# define STRACE_XSTRING_H -#include -#include +# include +# include -#include "error_prints.h" -#include "gcc_compat.h" +# include "error_prints.h" +# include "gcc_compat.h" /** * Print to static buffer and die on (really unexpected) errors and overflows. @@ -55,7 +55,7 @@ xsnprintf_(char *str, size_t size, const char *func, const char *argstr, * @param fmt_ Format string. * @param ... Format arguments. */ -#define xsnprintf(str_, size_, fmt_, ...) \ +# define xsnprintf(str_, size_, fmt_, ...) \ xsnprintf_((str_), (size_), __func__, #fmt_ ", " #__VA_ARGS__, \ (fmt_), __VA_ARGS__) @@ -67,7 +67,7 @@ xsnprintf_(char *str, size_t size, const char *func, const char *argstr, * @param fmt_ Format string. * @param ... Format arguments. */ -#define xsprintf(str_, fmt_, ...) \ +# define xsprintf(str_, fmt_, ...) \ xsnprintf((str_), sizeof(str_) + MUST_BE_ARRAY(str_), (fmt_), \ __VA_ARGS__) @@ -103,7 +103,7 @@ get_pos_diff_(char *str, size_t size, char *pos, const char *func, * @param ... Format arguments. * @return New position. */ -#define xappendstr(str_, pos_, fmt_, ...) \ +# define xappendstr(str_, pos_, fmt_, ...) \ (xsnprintf((pos_), sizeof(str_) + MUST_BE_ARRAY(str_) - \ get_pos_diff_((str_), sizeof(str_), (pos_), __func__, \ "xappendstr(" #str_ ", " #pos_ ", " #fmt_ ", " \ -- 2.40.0