From 184e94ba05f7efa15ea3fae73ca41c9d3bbc0b3d Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Sat, 17 Jun 2017 22:23:09 +0000 Subject: Fix a few spacing style issues Reported by kernel's checkpatch.pl script. --- aio.c | 4 +- block.c | 26 ++++---- bpf.c | 6 +- btrfs.c | 8 +-- clone.c | 2 +- configure.ac | 126 +++++++++++++++++------------------ defs.h | 22 +++--- desc.c | 3 +- dirent.c | 2 +- dirent64.c | 2 +- dm.c | 2 +- evdev.c | 2 +- fetch_struct_statfs.c | 2 +- file_ioctl.c | 6 +- gcc_compat.h | 2 +- io.c | 7 +- ioctlsort.c | 4 +- kcmp.c | 2 +- kexec.c | 2 +- linux/aarch64/arch_regs.c | 42 ++++++------ linux/arm/get_scno.c | 2 +- linux/bfin/get_syscall_args.c | 5 +- linux/personality.h | 8 +-- linux/sh64/arch_regs.h | 20 +++--- linux/x86_64/get_scno.c | 14 ++-- linux/x86_64/set_error.c | 4 +- mem.c | 2 +- msghdr.c | 2 +- numa.c | 12 ++-- open.c | 4 +- or1k_atomic.c | 20 +++--- perf.c | 136 +++++++++++++++++++------------------- perf_event_struct.h | 56 ++++++++-------- qualify.c | 2 +- quota.c | 15 ++--- resource.c | 9 +-- signal.c | 18 ++--- socketutils.c | 4 +- statx.h | 4 +- strace.c | 47 ++++++------- syscall.c | 11 ++- sysctl.c | 2 +- test/clone.c | 2 +- test/seccomp.c | 2 +- test/threaded_execve.c | 23 ++++--- tests/add_key.c | 3 +- tests/aio.c | 26 ++++---- tests/btrfs.c | 44 ++++++------ tests/errno2name.c | 3 +- tests/futex.c | 4 +- tests/getcpu.c | 8 +-- tests/ioctl.c | 2 +- tests/ioctl_sg_io_v3.c | 44 ++++++------ tests/ioctl_sg_io_v4.c | 28 ++++---- tests/ioctl_sock_gifconf.c | 2 +- tests/ioctl_uffdio.c | 2 +- tests/ioctl_v4l2.c | 12 ++-- tests/ip_mreq.c | 2 +- tests/ipc_msgbuf.c | 2 +- tests/ipc_sem.c | 8 +-- tests/ksysent.c | 2 +- tests/mmsg_name.c | 2 +- tests/mq.c | 2 +- tests/mq_sendrecv.c | 2 +- tests/msg_control.c | 6 +- tests/net-y-unix.c | 2 +- tests/net-yy-inet.c | 4 +- tests/net-yy-unix.c | 2 +- tests/nsyscalls.c | 2 +- tests/perf_event_open.c | 84 +++++++++++------------ tests/ppoll.c | 7 +- tests/print_quoted_string.c | 2 +- tests/print_time.c | 2 - tests/process_vm_readv_writev.c | 19 +++--- tests/pselect6.c | 4 +- tests/ptrace.c | 4 +- tests/quotactl-xfs.c | 2 +- tests/readahead.c | 4 +- tests/reboot.c | 8 +-- tests/request_key.c | 3 +- tests/rt_sigqueueinfo.c | 2 +- tests/rt_tgsigqueueinfo.c | 5 +- tests/sched_get_priority_mxx.c | 2 +- tests/seccomp-filter-v.c | 2 +- tests/semop.c | 3 +- tests/sigaction.c | 2 +- tests/signal2name.c | 3 +- tests/signal_receive.c | 4 +- tests/stack-fcall.c | 2 +- tests/statx.c | 2 +- tests/times-fail.c | 2 +- tests/times.c | 2 +- tests/unix-pair-sendto-recvfrom.c | 2 +- tests/waitid.c | 3 +- tests/xselect.c | 4 +- time.c | 5 +- uid.c | 8 +-- unwind.c | 70 ++++++++++---------- util.c | 17 +++-- v4l2.c | 2 +- wait.c | 6 +- xlat.c | 2 +- xlat/nl_netfilter_subsys_ids.in | 2 +- 103 files changed, 592 insertions(+), 609 deletions(-) diff --git a/aio.c b/aio.c index 5565d0c72..7adb20df7 100644 --- a/aio.c +++ b/aio.c @@ -167,9 +167,9 @@ print_iocbp(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data) struct iocb cb; if (elem_size < sizeof(kernel_ulong_t)) { - addr = * (unsigned int *) elem_buf; + addr = *(unsigned int *) elem_buf; } else { - addr = * (kernel_ulong_t *) elem_buf; + addr = *(kernel_ulong_t *) elem_buf; } tprints("{"); diff --git a/block.c b/block.c index 4d1a965b4..c77b92ac6 100644 --- a/block.c +++ b/block.c @@ -67,7 +67,7 @@ typedef struct blk_user_trace_setup { #include MPERS_DEFS #ifndef BLKPG -# define BLKPG _IO(0x12,105) +# define BLKPG _IO(0x12, 105) #endif /* @@ -80,40 +80,40 @@ typedef struct blk_user_trace_setup { # define BLKTRACESETUP _IOWR(0x12, 115, struct_blk_user_trace_setup) #endif #ifndef BLKTRACESTART -# define BLKTRACESTART _IO(0x12,116) +# define BLKTRACESTART _IO(0x12, 116) #endif #ifndef BLKTRACESTOP -# define BLKTRACESTOP _IO(0x12,117) +# define BLKTRACESTOP _IO(0x12, 117) #endif #ifndef BLKTRACETEARDOWN -# define BLKTRACETEARDOWN _IO(0x12,118) +# define BLKTRACETEARDOWN _IO(0x12, 118) #endif #ifndef BLKDISCARD -# define BLKDISCARD _IO(0x12,119) +# define BLKDISCARD _IO(0x12, 119) #endif #ifndef BLKIOMIN -# define BLKIOMIN _IO(0x12,120) +# define BLKIOMIN _IO(0x12, 120) #endif #ifndef BLKIOOPT -# define BLKIOOPT _IO(0x12,121) +# define BLKIOOPT _IO(0x12, 121) #endif #ifndef BLKALIGNOFF -# define BLKALIGNOFF _IO(0x12,122) +# define BLKALIGNOFF _IO(0x12, 122) #endif #ifndef BLKPBSZGET -# define BLKPBSZGET _IO(0x12,123) +# define BLKPBSZGET _IO(0x12, 123) #endif #ifndef BLKDISCARDZEROES -# define BLKDISCARDZEROES _IO(0x12,124) +# define BLKDISCARDZEROES _IO(0x12, 124) #endif #ifndef BLKSECDISCARD -# define BLKSECDISCARD _IO(0x12,125) +# define BLKSECDISCARD _IO(0x12, 125) #endif #ifndef BLKROTATIONAL -# define BLKROTATIONAL _IO(0x12,126) +# define BLKROTATIONAL _IO(0x12, 126) #endif #ifndef BLKZEROOUT -# define BLKZEROOUT _IO(0x12,127) +# define BLKZEROOUT _IO(0x12, 127) #endif #include "xlat/blkpg_ops.h" diff --git a/bpf.c b/bpf.c index 2c709e174..de909d300 100644 --- a/bpf.c +++ b/bpf.c @@ -182,7 +182,7 @@ bpf_prog_load(struct tcb *const tcp, const kernel_ulong_t addr, static int bpf_obj_manage(struct tcb *const tcp, const kernel_ulong_t addr, - unsigned int size) + unsigned int size) { struct { uint64_t ATTRIBUTE_ALIGNED(8) pathname; @@ -243,14 +243,14 @@ bpf_prog_attach_detach(struct tcb *const tcp, const kernel_ulong_t addr, static int bpf_prog_attach(struct tcb *const tcp, const kernel_ulong_t addr, - unsigned int size) + unsigned int size) { return bpf_prog_attach_detach(tcp, addr, size, true); } static int bpf_prog_detach(struct tcb *const tcp, const kernel_ulong_t addr, - unsigned int size) + unsigned int size) { return bpf_prog_attach_detach(tcp, addr, size, false); } diff --git a/btrfs.c b/btrfs.c index 141cafa32..e730c7aac 100644 --- a/btrfs.c +++ b/btrfs.c @@ -367,7 +367,7 @@ btrfs_print_ino_path_container(struct tcb *tcp, static bool print_uint64(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data) { - tprintf("%" PRIu64, * (uint64_t *) elem_buf); + tprintf("%" PRIu64, *(uint64_t *) elem_buf); return true; } @@ -488,7 +488,7 @@ static bool print_objectid_callback(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data) { - btrfs_print_objectid(* (uint64_t *) elem_buf); + btrfs_print_objectid(*(uint64_t *) elem_buf); return true; } @@ -679,12 +679,12 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl, (uint64_t) args.start.srcdevid, (uint64_t) args.start.cont_reading_from_srcdev_mode); - str = (const char*) args.start.srcdev_name; + str = (const char *) args.start.srcdev_name; print_quoted_string(str, sizeof(args.start.srcdev_name), QUOTE_0_TERMINATED); tprints(", tgtdev_name="); - str = (const char*) args.start.tgtdev_name; + str = (const char *) args.start.tgtdev_name; print_quoted_string(str, sizeof(args.start.tgtdev_name), QUOTE_0_TERMINATED); diff --git a/clone.c b/clone.c index a1c799a69..a5f2b242e 100644 --- a/clone.c +++ b/clone.c @@ -109,7 +109,7 @@ SYS_FUNC(clone) tcp->u_arg[ARG_STACKSIZE]); #endif tprints("flags="); - if (!printflags64(clone_flags, flags &~ CSIGNAL, NULL)) + if (!printflags64(clone_flags, flags & ~CSIGNAL, NULL)) sep = ""; if ((flags & CSIGNAL) != 0) tprintf("%s%s", sep, signame(flags & CSIGNAL)); diff --git a/configure.ac b/configure.ac index dc49d3974..b4cf4cb2b 100644 --- a/configure.ac +++ b/configure.ac @@ -488,8 +488,8 @@ AC_CHECK_HEADERS([linux/btrfs.h], [ struct btrfs_ioctl_search_args_v2.buf_size ]),,, [ #include #include ]) - AC_CHECK_DECLS(m4_normalize([BTRFS_COMPRESS_NONE, BTRFS_COMPRESS_ZLIB, - BTRFS_COMPRESS_LZO]),,,[ #include + AC_CHECK_DECLS(m4_normalize([BTRFS_COMPRESS_NONE, BTRFS_COMPRESS_ZLIB, + BTRFS_COMPRESS_LZO]),,,[ #include #include ])]) AC_CHECK_DECLS([sys_errlist]) @@ -683,7 +683,7 @@ AC_CACHE_CHECK([for SIGRTMIN], [st_cv_SIGRTMIN], [[st_cv_SIGRTMIN="$(echo SIGRTMIN | $CPP $CPPFLAGS -P -imacros asm/signal.h - | grep '^[0-9]')" - test -n "$st_cv_SIGRTMIN" || st_cv_SIGRTMIN=no]]) + test -n "$st_cv_SIGRTMIN" || st_cv_SIGRTMIN=no]]) if test "x$st_cv_SIGRTMIN" != xno; then AC_DEFINE_UNQUOTED([ASM_SIGRTMIN], [$st_cv_SIGRTMIN], [SIGRTMIN defined in ]) @@ -692,7 +692,7 @@ AC_CACHE_CHECK([for SA_RESTORER], [st_cv_SA_RESTORER], [st_cv_SA_RESTORER="$(echo SA_RESTORER | $CPP $CPPFLAGS -P -imacros asm/signal.h - | grep ^0x)" - test -n "$st_cv_SA_RESTORER" || st_cv_SA_RESTORER=no]) + test -n "$st_cv_SA_RESTORER" || st_cv_SA_RESTORER=no]) if test "x$st_cv_SA_RESTORER" != xno; then AC_DEFINE_UNQUOTED([ASM_SA_RESTORER], [$st_cv_SA_RESTORER], [SA_RESTORER defined in ]) @@ -720,15 +720,15 @@ libunwind_CPPFLAGS= libunwind_LDFLAGS= libunwind_LIBS= AC_ARG_WITH([libunwind], - [AS_HELP_STRING([--with-libunwind], - [use libunwind to implement stack tracing support])], - [case "${withval}" in - yes|no|check) ;; - *) with_libunwind=yes - libunwind_CPPFLAGS="-I${withval}/include" - libunwind_LDFLAGS="-L${withval}/lib" ;; - esac], - [with_libunwind=check] + [AS_HELP_STRING([--with-libunwind], + [use libunwind to implement stack tracing support])], + [case "${withval}" in + yes|no|check) ;; + *) with_libunwind=yes + libunwind_CPPFLAGS="-I${withval}/include" + libunwind_LDFLAGS="-L${withval}/lib" ;; + esac], + [with_libunwind=check] ) use_libunwind=no @@ -737,56 +737,56 @@ AS_IF([test "x$with_libunwind" != xno], CPPFLAGS="$CPPFLAGS $libunwind_CPPFLAGS" AC_CHECK_HEADERS([libunwind-ptrace.h], - [saved_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $libunwind_LDFLAGS" - - AC_CHECK_LIB([unwind], [backtrace], - [libunwind_LIBS="-lunwind $libunwind_LIBS" - - AC_MSG_CHECKING([for unw_create_addr_space in libunwind-generic]) - saved_LIBS="$LIBS" - LIBS="-lunwind-generic $libunwind_LIBS $LIBS" - - AC_LINK_IFELSE( - [AC_LANG_PROGRAM([[#include ]], - [[return !unw_create_addr_space(0, 0)]]) - ], - [AC_MSG_RESULT([yes]) - libunwind_LIBS="-lunwind-generic $libunwind_LIBS" - - AC_CHECK_LIB([unwind-ptrace], [_UPT_create], - [libunwind_LIBS="-lunwind-ptrace $libunwind_LIBS" - use_libunwind=yes - ], - [if test "x$with_libunwind" != xcheck; then - AC_MSG_FAILURE([failed to find _UPT_create in libunwind-ptrace]) - fi - ], - [$libunwind_LIBS] - ) - ], - [AC_MSG_RESULT([no]) - if test "x$with_libunwind" != xcheck; then - AC_MSG_FAILURE([failed to find unw_create_addr_space in libunwind-generic]) - fi - ] - ) - - LIBS="$saved_LIBS" - ], - [if test "x$with_libunwind" != xcheck; then - AC_MSG_FAILURE([failed to find libunwind]) - fi - ], - [$libunwind_LIBS] - ) - - LDFLAGS="$saved_LDFLAGS" - ], - [if test "x$with_libunwind" != xcheck; then - AC_MSG_FAILURE([failed to find libunwind-ptrace.h]) - fi - ] + [saved_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $libunwind_LDFLAGS" + + AC_CHECK_LIB([unwind], [backtrace], + [libunwind_LIBS="-lunwind $libunwind_LIBS" + + AC_MSG_CHECKING([for unw_create_addr_space in libunwind-generic]) + saved_LIBS="$LIBS" + LIBS="-lunwind-generic $libunwind_LIBS $LIBS" + + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[return !unw_create_addr_space(0, 0)]]) + ], + [AC_MSG_RESULT([yes]) + libunwind_LIBS="-lunwind-generic $libunwind_LIBS" + + AC_CHECK_LIB([unwind-ptrace], [_UPT_create], + [libunwind_LIBS="-lunwind-ptrace $libunwind_LIBS" + use_libunwind=yes + ], + [if test "x$with_libunwind" != xcheck; then + AC_MSG_FAILURE([failed to find _UPT_create in libunwind-ptrace]) + fi + ], + [$libunwind_LIBS] + ) + ], + [AC_MSG_RESULT([no]) + if test "x$with_libunwind" != xcheck; then + AC_MSG_FAILURE([failed to find unw_create_addr_space in libunwind-generic]) + fi + ] + ) + + LIBS="$saved_LIBS" + ], + [if test "x$with_libunwind" != xcheck; then + AC_MSG_FAILURE([failed to find libunwind]) + fi + ], + [$libunwind_LIBS] + ) + + LDFLAGS="$saved_LDFLAGS" + ], + [if test "x$with_libunwind" != xcheck; then + AC_MSG_FAILURE([failed to find libunwind-ptrace.h]) + fi + ] ) CPPFLAGS="$saved_CPPFLAGS" diff --git a/defs.h b/defs.h index 487e51bd2..d32e5cafe 100644 --- a/defs.h +++ b/defs.h @@ -106,7 +106,7 @@ extern char *stpcpy(char *dst, const char *src); * * Make sure that all entries in all syscallent.h files have nargs <= MAX_ARGS! * linux//syscallent*.h: - * all have nargs <= 6 except mips o32 which has nargs <= 7. + * all have nargs <= 6 except mips o32 which has nargs <= 7. */ #ifndef MAX_ARGS # ifdef LINUX_MIPSO32 @@ -234,11 +234,11 @@ struct tcb { struct timeval etime; /* Syscall entry time */ #ifdef USE_LIBUNWIND - struct UPT_info* libunwind_ui; - struct mmap_cache_t* mmap_cache; + struct UPT_info *libunwind_ui; + struct mmap_cache_t *mmap_cache; unsigned int mmap_cache_size; unsigned int mmap_cache_generation; - struct queue_t* queue; + struct queue_t *queue; #endif }; @@ -383,7 +383,7 @@ 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)) +#define KERNEL_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c)) void error_msg(const char *fmt, ...) ATTRIBUTE_FORMAT((printf, 1, 2)); void perror_msg(const char *fmt, ...) ATTRIBUTE_FORMAT((printf, 1, 2)); @@ -533,10 +533,10 @@ str_strip_prefix_len(const char *str, const char *prefix, size_t prefix_len) #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_0_TERMINATED 0x01 +#define QUOTE_OMIT_LEADING_TRAILING_QUOTES 0x02 +#define QUOTE_OMIT_TRAILING_0 0x08 +#define QUOTE_FORCE_HEX 0x10 extern int string_quote(const char *, char *, unsigned int, unsigned int); extern int print_quoted_string(const char *, unsigned int, unsigned int); @@ -545,10 +545,10 @@ extern int print_quoted_string(const char *, unsigned int, unsigned int); * b refers to the higher numbered u_arg */ #ifdef WORDS_BIGENDIAN -# define ULONG_LONG(a,b) \ +# define ULONG_LONG(a, b) \ ((unsigned long long)(unsigned)(b) | ((unsigned long long)(a)<<32)) #else -# define ULONG_LONG(a,b) \ +# define ULONG_LONG(a, b) \ ((unsigned long long)(unsigned)(a) | ((unsigned long long)(b)<<32)) #endif extern int getllval(struct tcb *, unsigned long long *, int); diff --git a/desc.c b/desc.c index d52afc43d..52e58c86e 100644 --- a/desc.c +++ b/desc.c @@ -164,8 +164,7 @@ decode_select(struct tcb *const tcp, const kernel_ulong_t *const args, ); first = 0; sep = ", "; - } - else { + } else { outptr += sprintf(outptr, " %u", j); } } diff --git a/dirent.c b/dirent.c index d413ed62b..71963ec3e 100644 --- a/dirent.c +++ b/dirent.c @@ -133,7 +133,7 @@ SYS_FUNC(getdents) d->d_reclen); if (print_quoted_string(d->d_name, d_name_len, - QUOTE_0_TERMINATED) > 0) { + QUOTE_0_TERMINATED) > 0) { tprints("..."); } diff --git a/dirent64.c b/dirent64.c index e2a425369..d54cb9e7b 100644 --- a/dirent64.c +++ b/dirent64.c @@ -106,7 +106,7 @@ SYS_FUNC(getdents64) tprints(", d_name="); if (print_quoted_string(d->d_name, d_name_len, - QUOTE_0_TERMINATED) > 0) { + QUOTE_0_TERMINATED) > 0) { tprints("..."); } diff --git a/dm.c b/dm.c index 26dcb2260..241362646 100644 --- a/dm.c +++ b/dm.c @@ -374,7 +374,7 @@ misplaced: static void dm_decode_dm_target_msg(struct tcb *const tcp, const kernel_ulong_t addr, - const struct dm_ioctl *const ioc) + const struct dm_ioctl *const ioc) { if (ioc->data_start == ioc->data_size) return; diff --git a/evdev.c b/evdev.c index 687455157..983bf1488 100644 --- a/evdev.c +++ b/evdev.c @@ -517,7 +517,7 @@ evdev_write_ioctl(struct tcb *const tcp, const unsigned int code, MPERS_PRINTER_DECL(int, evdev_ioctl, struct tcb *const tcp, const unsigned int code, const kernel_ulong_t arg) { - switch(_IOC_DIR(code)) { + switch (_IOC_DIR(code)) { case _IOC_READ: if (entering(tcp)) return 0; diff --git a/fetch_struct_statfs.c b/fetch_struct_statfs.c index 454e5b4ec..4fba0f75d 100644 --- a/fetch_struct_statfs.c +++ b/fetch_struct_statfs.c @@ -84,7 +84,7 @@ MPERS_PRINTER_DECL(bool, fetch_struct_statfs64, { struct_statfs64 b; - if (sizeof(b) != size + if (sizeof(b) != size #ifdef COMPAT_STATFS64_PADDED_SIZE && sizeof(b) != COMPAT_STATFS64_PADDED_SIZE #endif diff --git a/file_ioctl.c b/file_ioctl.c index fec2f69b0..cc2378f63 100644 --- a/file_ioctl.c +++ b/file_ioctl.c @@ -36,11 +36,11 @@ #endif #ifndef FICLONE -# define FICLONE _IOW(0x94, 9, int) +# define FICLONE _IOW(0x94, 9, int) #endif #ifndef FICLONERANGE -# define FICLONERANGE _IOW(0x94, 13, struct file_clone_range) +# define FICLONERANGE _IOW(0x94, 13, struct file_clone_range) struct file_clone_range { int64_t src_fd; uint64_t src_offset; @@ -50,7 +50,7 @@ struct file_clone_range { #endif #ifndef FIDEDUPERANGE -# define FIDEDUPERANGE _IOWR(0x94, 54, struct file_dedupe_range) +# 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 */ diff --git a/gcc_compat.h b/gcc_compat.h index 08e811734..956aff176 100644 --- a/gcc_compat.h +++ b/gcc_compat.h @@ -84,7 +84,7 @@ #if GNUC_PREREQ(4, 1) # define ALIGNOF(t_) __alignof__(t_) #else -# define ALIGNOF(t_) (sizeof(struct {char x_; t_ y_;}) - sizeof(t_)) +# define ALIGNOF(t_) (sizeof(struct { char x_; t_ y_; }) - sizeof(t_)) #endif #if GNUC_PREREQ(4, 3) diff --git a/io.c b/io.c index ba3ed4d5b..9ce1cf554 100644 --- a/io.c +++ b/io.c @@ -70,7 +70,7 @@ print_iovec(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data) kernel_ulong_t iov_buf[2], len; struct print_iovec_config *c = data; - if (elem_size < sizeof(iov_buf)) { + if (elem_size < sizeof(iov_buf)) { iov_buf[0] = ((unsigned int *) elem_buf)[0]; iov_buf[1] = ((unsigned int *) elem_buf)[1]; iov = iov_buf; @@ -118,8 +118,9 @@ tprint_iov_upto(struct tcb *const tcp, const kernel_ulong_t len, const kernel_ulong_t data_size) { kernel_ulong_t iov[2]; - struct print_iovec_config config = - { .decode_iov = decode_iov, .data_size = data_size }; + struct print_iovec_config config = { + .decode_iov = decode_iov, .data_size = data_size + }; print_array(tcp, addr, len, iov, current_wordsize * 2, umoven_or_printaddr_ignore_syserror, print_iovec, &config); diff --git a/ioctlsort.c b/ioctlsort.c index 9bab978da..932c66713 100644 --- a/ioctlsort.c +++ b/ioctlsort.c @@ -56,7 +56,7 @@ is_prefix(const char *s1, const char *s2) } static int -compare_name_info(const void* a, const void* b) +compare_name_info(const void *a, const void *b) { int rc; @@ -93,7 +93,7 @@ code(const struct ioctlent *e) } static int -compare_code_name(const void* a, const void* b) +compare_code_name(const void *a, const void *b) { unsigned int code1 = code((struct ioctlent *) a); unsigned int code2 = code((struct ioctlent *) b); diff --git a/kcmp.c b/kcmp.c index 8c0994bc7..962952bd9 100644 --- a/kcmp.c +++ b/kcmp.c @@ -40,7 +40,7 @@ SYS_FUNC(kcmp) tprintf("%d, %d, ", pid1, pid2); printxval(kcmp_types, type, "KCMP_???"); - switch(type) { + switch (type) { case KCMP_FILE: tprintf(", %u, %u", (unsigned) idx1, (unsigned) idx2); break; diff --git a/kexec.c b/kexec.c index c11113d1f..8157cc904 100644 --- a/kexec.c +++ b/kexec.c @@ -44,7 +44,7 @@ print_seg(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data) const kernel_ulong_t *seg; kernel_ulong_t seg_buf[4]; - if (elem_size < sizeof(seg_buf)) { + if (elem_size < sizeof(seg_buf)) { unsigned int i; for (i = 0; i < ARRAY_SIZE(seg_buf); ++i) diff --git a/linux/aarch64/arch_regs.c b/linux/aarch64/arch_regs.c index 4ccb1f5bf..5d805fb39 100644 --- a/linux/aarch64/arch_regs.c +++ b/linux/aarch64/arch_regs.c @@ -1,31 +1,31 @@ struct arm_pt_regs { - uint32_t uregs[18]; + uint32_t uregs[18]; }; -#define ARM_cpsr uregs[16] -#define ARM_pc uregs[15] -#define ARM_lr uregs[14] -#define ARM_sp uregs[13] -#define ARM_ip uregs[12] -#define ARM_fp uregs[11] -#define ARM_r10 uregs[10] -#define ARM_r9 uregs[9] -#define ARM_r8 uregs[8] -#define ARM_r7 uregs[7] -#define ARM_r6 uregs[6] -#define ARM_r5 uregs[5] -#define ARM_r4 uregs[4] -#define ARM_r3 uregs[3] -#define ARM_r2 uregs[2] -#define ARM_r1 uregs[1] -#define ARM_r0 uregs[0] -#define ARM_ORIG_r0 uregs[17] +#define ARM_cpsr uregs[16] +#define ARM_pc uregs[15] +#define ARM_lr uregs[14] +#define ARM_sp uregs[13] +#define ARM_ip uregs[12] +#define ARM_fp uregs[11] +#define ARM_r10 uregs[10] +#define ARM_r9 uregs[9] +#define ARM_r8 uregs[8] +#define ARM_r7 uregs[7] +#define ARM_r6 uregs[6] +#define ARM_r5 uregs[5] +#define ARM_r4 uregs[4] +#define ARM_r3 uregs[3] +#define ARM_r2 uregs[2] +#define ARM_r1 uregs[1] +#define ARM_r0 uregs[0] +#define ARM_ORIG_r0 uregs[17] static union { struct user_pt_regs aarch64_r; struct arm_pt_regs arm_r; } arm_regs_union; -#define aarch64_regs arm_regs_union.aarch64_r -#define arm_regs arm_regs_union.arm_r +#define aarch64_regs arm_regs_union.aarch64_r +#define arm_regs arm_regs_union.arm_r uint64_t *const aarch64_sp_ptr = (uint64_t *) &aarch64_regs.sp; uint32_t *const arm_sp_ptr = &arm_regs.ARM_sp; diff --git a/linux/arm/get_scno.c b/linux/arm/get_scno.c index 344078231..5f6806923 100644 --- a/linux/arm/get_scno.c +++ b/linux/arm/get_scno.c @@ -58,7 +58,7 @@ arch_get_scno(struct tcb *tcp) /* Fixup the syscall number */ scno &= 0x000fffff; } else { - scno_in_r7: +scno_in_r7: scno = arm_regs.ARM_r7; } #else /* __ARM_EABI__ || !ENABLE_ARM_OABI */ diff --git a/linux/bfin/get_syscall_args.c b/linux/bfin/get_syscall_args.c index 13d58bd7e..69613d4e7 100644 --- a/linux/bfin/get_syscall_args.c +++ b/linux/bfin/get_syscall_args.c @@ -2,8 +2,9 @@ static int get_syscall_args(struct tcb *tcp) { - static const int argreg[MAX_ARGS] = - { PT_R0, PT_R1, PT_R2, PT_R3, PT_R4, PT_R5 }; + static const int argreg[MAX_ARGS] = { + PT_R0, PT_R1, PT_R2, PT_R3, PT_R4, PT_R5 + }; unsigned int i; for (i = 0; i < tcp->s_ent->nargs; ++i) diff --git a/linux/personality.h b/linux/personality.h index 9971703ff..09b35c650 100644 --- a/linux/personality.h +++ b/linux/personality.h @@ -8,8 +8,8 @@ * These occupy the top three bytes. */ enum { - UNAME26 = 0x0020000, - ADDR_NO_RANDOMIZE = 0x0040000, /* disable randomization of VA space */ + UNAME26 = 0x0020000, + ADDR_NO_RANDOMIZE = 0x0040000, /* disable randomization of VA space */ FDPIC_FUNCPTRS = 0x0080000, /* userspace function ptrs point to descriptors * (signal handling) */ @@ -19,8 +19,8 @@ enum { ADDR_LIMIT_32BIT = 0x0800000, SHORT_INODE = 0x1000000, WHOLE_SECONDS = 0x2000000, - STICKY_TIMEOUTS = 0x4000000, - ADDR_LIMIT_3GB = 0x8000000, + STICKY_TIMEOUTS = 0x4000000, + ADDR_LIMIT_3GB = 0x8000000, }; /* diff --git a/linux/sh64/arch_regs.h b/linux/sh64/arch_regs.h index 7f64b4970..670cdb669 100644 --- a/linux/sh64/arch_regs.h +++ b/linux/sh64/arch_regs.h @@ -1,15 +1,15 @@ /* SH64 Linux - this code assumes the following kernel API for system calls: - PC Offset 0 - System Call Offset 16 (actually, (syscall no.) | (0x1n << 16), - where n = no. of parameters. - Other regs Offset 24+ + PC Offset 0 + System Call Offset 16 (actually, (syscall no.) | (0x1n << 16), + where n = no. of parameters. + Other regs Offset 24+ - On entry: R2-7 = parameters 1-6 (as many as necessary) - On return: R9 = result. + On entry: R2-7 = parameters 1-6 (as many as necessary) + On return: R9 = result. */ /* Offset for peeks of registers */ -#define REG_OFFSET (24) -#define REG_GENERAL(x) (8*(x)+REG_OFFSET) -#define REG_PC (0*8) -#define REG_SYSCALL (2*8) +#define REG_OFFSET (24) +#define REG_GENERAL(x) (8*(x)+REG_OFFSET) +#define REG_PC (0*8) +#define REG_SYSCALL (2*8) diff --git a/linux/x86_64/get_scno.c b/linux/x86_64/get_scno.c index 2354fb200..687f8435c 100644 --- a/linux/x86_64/get_scno.c +++ b/linux/x86_64/get_scno.c @@ -57,7 +57,7 @@ arch_get_scno(struct tcb *tcp) * solely by looking at __X32_SYSCALL_BIT: * arch/x86/include/asm/compat.h::is_x32_task(): * if (task_pt_regs(current)->orig_ax & __X32_SYSCALL_BIT) - * return true; + * return true; */ if (x86_io.iov_len == sizeof(i386_regs)) { scno = i386_regs.orig_eax; @@ -93,7 +93,9 @@ arch_get_scno(struct tcb *tcp) */ scno = x86_64_regs.orig_rax; switch (x86_64_regs.cs) { - case 0x23: currpers = 1; break; + case 0x23: + currpers = 1; + break; case 0x33: if (x86_64_regs.ds == 0x2b) { currpers = 2; @@ -123,9 +125,13 @@ arch_get_scno(struct tcb *tcp) perror_msg("ptrace_peektext failed"); switch (call & 0xffff) { /* x86-64: syscall = 0x0f 0x05 */ - case 0x050f: currpers = 0; break; + case 0x050f: + currpers = 0; + break; /* i386: int 0x80 = 0xcd 0x80 */ - case 0x80cd: currpers = 1; break; + case 0x80cd: + currpers = 1; + break; default: currpers = current_personality; error_msg("Unknown syscall opcode (0x%04X) while " diff --git a/linux/x86_64/set_error.c b/linux/x86_64/set_error.c index 123c89517..6c31bd86f 100644 --- a/linux/x86_64/set_error.c +++ b/linux/x86_64/set_error.c @@ -10,13 +10,13 @@ static int arch_set_error(struct tcb *tcp) { #ifdef HAVE_GETREGS_OLD - x86_64_regs.rax = - (long long) tcp->u_error; + x86_64_regs.rax = -(long long) tcp->u_error; return upoke(tcp->pid, 8 * RAX, x86_64_regs.rax); #else if (x86_io.iov_len == sizeof(i386_regs)) return i386_set_error(tcp); - x86_64_regs.rax = - (long long) tcp->u_error; + x86_64_regs.rax = -(long long) tcp->u_error; return set_regs(tcp->pid); #endif } diff --git a/mem.c b/mem.c index fb29ec146..00f5610d1 100644 --- a/mem.c +++ b/mem.c @@ -331,7 +331,7 @@ SYS_FUNC(remap_file_pages) static bool print_protmap_entry(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data) { - tprintf("%#08x", * (unsigned int *) elem_buf); + tprintf("%#08x", *(unsigned int *) elem_buf); return true; } diff --git a/msghdr.c b/msghdr.c index b699f26b0..d26386659 100644 --- a/msghdr.c +++ b/msghdr.c @@ -329,7 +329,7 @@ decode_msg_control(struct tcb *const tcp, const kernel_ulong_t addr, print_cmsg_type_data(tcp, cmsg_level, cmsg_type, (const void *) (u.ptr + cmsg_size), - len > cmsg_size ? len - cmsg_size: 0); + len > cmsg_size ? len - cmsg_size : 0); tprints("}"); if (len < cmsg_size) { diff --git a/numa.c b/numa.c index a4b28f4ad..7564d8733 100644 --- a/numa.c +++ b/numa.c @@ -34,10 +34,10 @@ print_node(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data) { if (elem_size < sizeof(kernel_ulong_t)) { tprintf("%#0*x", (int) elem_size * 2 + 2, - * (unsigned int *) elem_buf); + *(unsigned int *) elem_buf); } else { tprintf("%#0*" PRI_klx, (int) elem_size * 2 + 2, - * (kernel_ulong_t *) elem_buf); + *(kernel_ulong_t *) elem_buf); } return true; @@ -127,9 +127,9 @@ print_addr(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data) kernel_ulong_t addr; if (elem_size < sizeof(addr)) { - addr = * (unsigned int *) elem_buf; + addr = *(unsigned int *) elem_buf; } else { - addr = * (kernel_ulong_t *) elem_buf; + addr = *(kernel_ulong_t *) elem_buf; } printaddr(addr); @@ -140,7 +140,7 @@ print_addr(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data) static bool print_status(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data) { - const int status = * (int *) elem_buf; + const int status = *(int *) elem_buf; if (status < 0 && (unsigned) -status < nerrnos) tprintf("-%s", errnoent[-status]); @@ -153,7 +153,7 @@ print_status(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data) static bool print_int(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data) { - tprintf("%d", * (int *) elem_buf); + tprintf("%d", *(int *) elem_buf); return true; } diff --git a/open.c b/open.c index 222965b84..28222666d 100644 --- a/open.c +++ b/open.c @@ -42,7 +42,7 @@ #define O_ACCMODE 03 #ifdef O_LARGEFILE -# if O_LARGEFILE == 0 /* biarch platforms in 64-bit mode */ +# if O_LARGEFILE == 0 /* biarch platforms in 64-bit mode */ # undef O_LARGEFILE # ifdef SPARC64 # define O_LARGEFILE 0x40000 @@ -56,7 +56,7 @@ #include "xlat/open_mode_flags.h" #ifndef AT_FDCWD -# define AT_FDCWD -100 +# define AT_FDCWD -100 #endif /* The fd is an "int", so when decoding x86 on x86_64, we need to force sign diff --git a/or1k_atomic.c b/or1k_atomic.c index fb6aff3d3..738cc2eb7 100644 --- a/or1k_atomic.c +++ b/or1k_atomic.c @@ -31,22 +31,22 @@ #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 +#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) { printxval64(atomic_ops, tcp->u_arg[0], "???"); - switch(tcp->u_arg[0]) { + switch (tcp->u_arg[0]) { case OR1K_ATOMIC_SWAP: tprintf(", 0x%lx, 0x%lx", tcp->u_arg[1], tcp->u_arg[2]); break; diff --git a/perf.c b/perf.c index 98f2ae1a7..6af0f42a1 100644 --- a/perf.c +++ b/perf.c @@ -168,7 +168,7 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr) if (use_new_size > 0) printxval(perf_attr_size, new_size, - "PERF_ATTR_SIZE_???"); + "PERF_ATTR_SIZE_???"); else tprints("???"); } @@ -176,17 +176,17 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr) switch (attr->type) { case PERF_TYPE_HARDWARE: PRINT_XLAT(", config=", perf_hw_id, attr->config, - "PERF_COUNT_HW_???"); + "PERF_COUNT_HW_???"); break; case PERF_TYPE_SOFTWARE: PRINT_XLAT(", config=", perf_sw_ids, attr->config, - "PERF_COUNT_SW_???"); + "PERF_COUNT_SW_???"); break; case PERF_TYPE_TRACEPOINT: /* * "The value to use in config can be obtained from under - * debugfs tracing/events/../../id if ftrace is enabled in the - * kernel." + * debugfs tracing/events/../../id if ftrace is enabled + * in the kernel." */ tprintf(", config=%" PRIu64, attr->config); break; @@ -196,9 +196,9 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr) * (perf_hw_cache_op_result_id << 16) */ PRINT_XLAT(", config=", perf_hw_cache_id, attr->config & 0xFF, - "PERF_COUNT_HW_CACHE_???"); + "PERF_COUNT_HW_CACHE_???"); PRINT_XLAT("|", perf_hw_cache_op_id, (attr->config >> 8) & 0xFF, - "PERF_COUNT_HW_CACHE_OP_???"); + "PERF_COUNT_HW_CACHE_OP_???"); /* * Current code (see set_ext_hw_attr in arch/x86/events/core.c, * tile_map_cache_event in arch/tile/kernel/perf_event.c, @@ -215,8 +215,8 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr) * that cache result is 8 bits in size. */ PRINT_XLAT("<<8|", perf_hw_cache_op_result_id, - (attr->config >> 16) & 0xFF, - "PERF_COUNT_HW_CACHE_RESULT_???"); + (attr->config >> 16) & 0xFF, + "PERF_COUNT_HW_CACHE_RESULT_???"); tprints("<<16"); if (attr->config >> 24) { tprintf("|%#" PRIx64 "<<24", attr->config >> 24); @@ -262,60 +262,60 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr) "PERF_FORMAT_???"); tprintf(", disabled=%u" - ", inherit=%u" - ", pinned=%u" - ", exclusive=%u" - ", exclusive_user=%u" - ", exclude_kernel=%u" - ", exclude_hv=%u" - ", exclude_idle=%u" - ", mmap=%u" - ", comm=%u" - ", freq=%u" - ", inherit_stat=%u" - ", enable_on_exec=%u" - ", task=%u" - ", watermark=%u" - ", precise_ip=%u", - attr->disabled, - attr->inherit, - attr->pinned, - attr->exclusive, - attr->exclude_user, - attr->exclude_kernel, - attr->exclude_hv, - attr->exclude_idle, - attr->mmap, - attr->comm, - attr->freq, - attr->inherit_stat, - attr->enable_on_exec, - attr->task, - attr->watermark, - attr->precise_ip); + ", inherit=%u" + ", pinned=%u" + ", exclusive=%u" + ", exclusive_user=%u" + ", exclude_kernel=%u" + ", exclude_hv=%u" + ", exclude_idle=%u" + ", mmap=%u" + ", comm=%u" + ", freq=%u" + ", inherit_stat=%u" + ", enable_on_exec=%u" + ", task=%u" + ", watermark=%u" + ", precise_ip=%u", + attr->disabled, + attr->inherit, + attr->pinned, + attr->exclusive, + attr->exclude_user, + attr->exclude_kernel, + attr->exclude_hv, + attr->exclude_idle, + attr->mmap, + attr->comm, + attr->freq, + attr->inherit_stat, + attr->enable_on_exec, + attr->task, + attr->watermark, + attr->precise_ip); tprints_comment(precise_ip_desc[attr->precise_ip]); tprintf(", mmap_data=%u" - ", sample_id_all=%u" - ", exclude_host=%u" - ", exclude_guest=%u" - ", exclude_callchain_kernel=%u" - ", exclude_callchain_user=%u" - ", mmap2=%u" - ", comm_exec=%u" - ", use_clockid=%u" - ", context_switch=%u" - ", write_backward=%u", - attr->mmap_data, - attr->sample_id_all, - attr->exclude_host, - attr->exclude_guest, - attr->exclude_callchain_kernel, - attr->exclude_callchain_user, - attr->mmap2, - attr->comm_exec, - attr->use_clockid, - attr->context_switch, - attr->write_backward); + ", sample_id_all=%u" + ", exclude_host=%u" + ", exclude_guest=%u" + ", exclude_callchain_kernel=%u" + ", exclude_callchain_user=%u" + ", mmap2=%u" + ", comm_exec=%u" + ", use_clockid=%u" + ", context_switch=%u" + ", write_backward=%u", + attr->mmap_data, + attr->sample_id_all, + attr->exclude_host, + attr->exclude_guest, + attr->exclude_callchain_kernel, + attr->exclude_callchain_user, + attr->mmap2, + attr->comm_exec, + attr->use_clockid, + attr->context_switch, + attr->write_backward); /* * Print it only in case it is non-zero, since it may contain flags we @@ -323,7 +323,7 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr) */ if (attr->__reserved_1) { tprintf(", __reserved_1=%#" PRIx64, - (uint64_t) attr->__reserved_1); + (uint64_t) attr->__reserved_1); tprints_comment("Bits 63..28"); } @@ -335,10 +335,10 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr) if (attr->type == PERF_TYPE_BREAKPOINT) /* Any combination of R/W with X is deemed invalid */ PRINT_XLAT(", bp_type=", hw_breakpoint_type, attr->bp_type, - (attr->bp_type <= - (HW_BREAKPOINT_X | HW_BREAKPOINT_RW)) ? - "HW_BREAKPOINT_INVALID" : - "HW_BREAKPOINT_???"); + (attr->bp_type <= + (HW_BREAKPOINT_X | HW_BREAKPOINT_RW)) ? + "HW_BREAKPOINT_INVALID" : + "HW_BREAKPOINT_???"); if (attr->type == PERF_TYPE_BREAKPOINT) tprintf(", bp_addr=%#" PRIx64, attr->bp_addr); @@ -360,7 +360,7 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr) if (attr->sample_type & PERF_SAMPLE_BRANCH_STACK) { tprints(", branch_sample_type="); printflags64(perf_branch_sample_type, attr->branch_sample_type, - "PERF_SAMPLE_BRANCH_???"); + "PERF_SAMPLE_BRANCH_???"); } _PERF_CHECK_FIELD(sample_regs_user); @@ -379,7 +379,7 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr) */ if (attr->sample_type & PERF_SAMPLE_STACK_USER) tprintf(", sample_stack_user=%#" PRIx32, - attr->sample_stack_user); + attr->sample_stack_user); if (attr->use_clockid) { _PERF_CHECK_FIELD(clockid); diff --git a/perf_event_struct.h b/perf_event_struct.h index 161f6383b..b5a15bb5b 100644 --- a/perf_event_struct.h +++ b/perf_event_struct.h @@ -13,34 +13,34 @@ struct perf_event_attr { }; uint64_t sample_type; uint64_t read_format; - uint64_t disabled :1, - inherit :1, - pinned :1, - exclusive :1, - exclude_user :1, - exclude_kernel :1, - exclude_hv :1, - exclude_idle :1, - mmap :1, - comm :1, - freq :1, - inherit_stat :1, - enable_on_exec :1, - task :1, - watermark :1, - precise_ip :2, - mmap_data :1, - sample_id_all :1, - exclude_host :1, - exclude_guest :1, - exclude_callchain_kernel :1, - exclude_callchain_user :1, - mmap2 :1, - comm_exec :1, - use_clockid :1, - context_switch :1, - write_backward :1, - __reserved_1 :36; + uint64_t disabled :1, + inherit :1, + pinned :1, + exclusive :1, + exclude_user :1, + exclude_kernel :1, + exclude_hv :1, + exclude_idle :1, + mmap :1, + comm :1, + freq :1, + inherit_stat :1, + enable_on_exec :1, + task :1, + watermark :1, + precise_ip :2, + mmap_data :1, + sample_id_all :1, + exclude_host :1, + exclude_guest :1, + exclude_callchain_kernel :1, + exclude_callchain_user :1, + mmap2 :1, + comm_exec :1, + use_clockid :1, + context_switch :1, + write_backward :1, + __reserved_1 :36; union { uint32_t wakeup_events; uint32_t wakeup_watermark; diff --git a/qualify.c b/qualify.c index de1141d66..3df4805a4 100644 --- a/qualify.c +++ b/qualify.c @@ -436,7 +436,7 @@ parse_inject_token(const char *const token, struct inject_opts *const fopts, if ((val = STR_STRIP_PREFIX(token, "when=")) != token) { /* - * == 1+1 + * == 1+1 * F == F+0 * F+ == F+1 * F+S diff --git a/quota.c b/quota.c index 19f391f76..ef151662a 100644 --- a/quota.c +++ b/quota.c @@ -55,8 +55,7 @@ * leads to problems when it is used on 32-bit tracee which does not have such * padding. */ -struct if_dqblk -{ +struct if_dqblk { uint64_t dqb_bhardlimit; uint64_t dqb_bsoftlimit; uint64_t dqb_curspace; @@ -81,8 +80,7 @@ struct if_nextdqblk { uint32_t dqb_id; }; -struct xfs_dqblk -{ +struct xfs_dqblk { int8_t d_version; /* version of this structure */ int8_t d_flags; /* XFS_{USER,PROJ,GROUP}_QUOTA */ uint16_t d_fieldmask; /* field specifier */ @@ -107,23 +105,20 @@ struct xfs_dqblk char d_padding4[8]; /* yet more padding */ }; -struct if_dqinfo -{ +struct if_dqinfo { uint64_t dqi_bgrace; uint64_t dqi_igrace; uint32_t dqi_flags; uint32_t dqi_valid; }; -typedef struct fs_qfilestat -{ +typedef struct fs_qfilestat { uint64_t qfs_ino; /* inode number */ uint64_t qfs_nblks; /* number of BBs 512-byte-blks */ uint32_t qfs_nextents; /* number of extents */ } fs_qfilestat_t; -struct xfs_dqstats -{ +struct xfs_dqstats { int8_t qs_version; /* version number for future changes */ uint16_t qs_flags; /* XFS_QUOTA_{U,P,G}DQ_{ACCT,ENFD} */ int8_t qs_pad; /* unused */ diff --git a/resource.c b/resource.c index ab3675287..27d653e69 100644 --- a/resource.c +++ b/resource.c @@ -120,8 +120,7 @@ SYS_FUNC(getrlimit) if (entering(tcp)) { printxval(resources, tcp->u_arg[0], "RLIMIT_???"); tprints(", "); - } - else { + } else { decode_rlimit(tcp, tcp->u_arg[1]); } return 0; @@ -157,8 +156,7 @@ SYS_FUNC(getrusage) if (entering(tcp)) { printxval(usagewho, tcp->u_arg[0], "RUSAGE_???"); tprints(", "); - } - else + } else printrusage(tcp, tcp->u_arg[1]); return 0; } @@ -169,8 +167,7 @@ SYS_FUNC(osf_getrusage) if (entering(tcp)) { printxval(usagewho, tcp->u_arg[0], "RUSAGE_???"); tprints(", "); - } - else + } else printrusage32(tcp, tcp->u_arg[1]); return 0; } diff --git a/signal.c b/signal.c index 79054c709..b14124e98 100644 --- a/signal.c +++ b/signal.c @@ -289,8 +289,7 @@ SYS_FUNC(ssetmask) { if (entering(tcp)) { tprint_old_sigmask_val("", (unsigned) tcp->u_arg[0]); - } - else if (!syserror(tcp)) { + } else if (!syserror(tcp)) { tcp->auxstr = sprint_old_sigmask_val("old mask ", (unsigned) tcp->u_rval); return RVAL_HEX | RVAL_STR; @@ -433,8 +432,7 @@ SYS_FUNC(osf_sigprocmask) if (entering(tcp)) { printxval(sigprocmaskcmds, tcp->u_arg[0], "SIG_???"); tprintsigmask_val(", ", tcp->u_arg[1]); - } - else if (!syserror(tcp)) { + } else if (!syserror(tcp)) { tcp->auxstr = sprintsigmask_val("old mask ", tcp->u_rval); return RVAL_HEX | RVAL_STR; } @@ -451,8 +449,7 @@ SYS_FUNC(sigprocmask) tprints(", "); print_sigset_addr_len(tcp, tcp->u_arg[1], current_wordsize); tprints(", "); - } - else { + } else { print_sigset_addr_len(tcp, tcp->u_arg[2], current_wordsize); } return 0; @@ -493,8 +490,7 @@ SYS_FUNC(rt_sigprocmask) tprints(", "); print_sigset_addr_len(tcp, tcp->u_arg[1], tcp->u_arg[3]); tprints(", "); - } - else { + } else { print_sigset_addr_len(tcp, tcp->u_arg[2], tcp->u_arg[3]); tprintf(", %" PRI_klu, tcp->u_arg[3]); } @@ -502,8 +498,7 @@ SYS_FUNC(rt_sigprocmask) } /* Structure describing the action to be taken when a signal arrives. */ -struct new_sigaction -{ +struct new_sigaction { /* sa_handler may be a libc #define, need to use other name: */ #ifdef MIPS unsigned int sa_flags; @@ -519,8 +514,7 @@ struct new_sigaction unsigned long sa_mask[NSIG / sizeof(long)]; }; /* Same for i386-on-x86_64 and similar cases */ -struct new_sigaction32 -{ +struct new_sigaction32 { uint32_t sa_handler__; uint32_t sa_flags; #if HAVE_SA_RESTORER diff --git a/socketutils.c b/socketutils.c index 6486e2757..b93c98feb 100644 --- a/socketutils.c +++ b/socketutils.c @@ -147,7 +147,7 @@ inet_parse_response(const void *const data, const int data_len, if (diag_msg->idiag_inode != inode) return 0; - switch(diag_msg->idiag_family) { + switch (diag_msg->idiag_family) { case AF_INET: addr_size = sizeof(struct in_addr); text_size = INET_ADDRSTRLEN; @@ -536,7 +536,7 @@ get_sockaddr_by_inode(struct tcb *const tcp, const int fd, /* Given an inode number of a socket, print out its protocol details. */ bool print_sockaddr_by_inode(struct tcb *const tcp, const int fd, - const unsigned long inode) + const unsigned long inode) { return print_sockaddr_by_inode_cached(inode) ? true : print_sockaddr_by_inode_uncached(inode, getfdproto(tcp, fd)); diff --git a/statx.h b/statx.h index 203728704..bd5b04779 100644 --- a/statx.h +++ b/statx.h @@ -40,7 +40,7 @@ typedef struct { uint32_t stx_mask; /* What results were written [uncond] */ uint32_t stx_blksize; /* Preferred general I/O size [uncond] */ uint64_t stx_attributes; /* Flags conveying information about the file - [uncond] */ + [uncond] */ uint32_t stx_nlink; /* Number of hard links */ uint32_t stx_uid; /* User ID of owner */ @@ -52,7 +52,7 @@ typedef struct { uint64_t stx_size; /* File size */ uint64_t stx_blocks; /* Number of 512-byte blocks allocated */ uint64_t stx_attributes_mask; /* Mask to show what's supported in - stx_attributes */ + stx_attributes */ struct_statx_timestamp stx_atime; /* Last access time */ struct_statx_timestamp stx_btime; /* File creation time */ diff --git a/strace.c b/strace.c index 916d66b36..614ab9ec4 100644 --- a/strace.c +++ b/strace.c @@ -89,12 +89,12 @@ static bool print_pid_pfx; /* -I n */ enum { - INTR_NOT_SET = 0, - INTR_ANYWHERE = 1, /* don't block/ignore any signals */ - INTR_WHILE_WAIT = 2, /* block fatal signals while decoding syscall. default */ - INTR_NEVER = 3, /* block fatal signals. default if '-o FILE PROG' */ - INTR_BLOCK_TSTP_TOO = 4, /* block fatal signals and SIGTSTP (^Z) */ - NUM_INTR_OPTS + INTR_NOT_SET = 0, + INTR_ANYWHERE = 1, /* don't block/ignore any signals */ + INTR_WHILE_WAIT = 2, /* block fatal signals while decoding syscall. default */ + INTR_NEVER = 3, /* block fatal signals. default if '-o FILE PROG' */ + INTR_BLOCK_TSTP_TOO = 4, /* block fatal signals and SIGTSTP (^Z) */ + NUM_INTR_OPTS }; static int opt_intr; /* We play with signal mask only if this mode is active: */ @@ -690,12 +690,10 @@ printleader(struct tcb *tcp) tprintf("%6ld.%06ld ", (long) dtv.tv_sec, (long) dtv.tv_usec); otv = tv; - } - else if (tflag > 2) { + } else if (tflag > 2) { tprintf("%ld.%06ld ", (long) tv.tv_sec, (long) tv.tv_usec); - } - else { + } else { time_t local = tv.tv_sec; strftime(str, sizeof(str), "%T", localtime(&local)); if (tflag > 1) @@ -919,8 +917,7 @@ detach(struct tcb *tcp) goto wait_loop; if (errno != ESRCH) perror_msg("detach: ptrace(PTRACE_INTERRUPT,%u)", tcp->pid); - } - else { + } else { error = my_tkill(tcp->pid, SIGSTOP); if (!error) goto wait_loop; @@ -1032,7 +1029,7 @@ process_opt_p_list(char *opt) * pidof uses space as delim, pgrep uses newline. :( */ int pid; - char *delim = opt + strcspn(opt, ", \n\t"); + char *delim = opt + strcspn(opt, "\n\t ,"); char c = *delim; *delim = '\0'; @@ -1231,8 +1228,7 @@ exec_or_die(void) if (setreuid(run_uid, params->run_euid) < 0) { perror_msg_and_die("setreuid"); } - } - else if (geteuid() != 0) + } else if (geteuid() != 0) if (setreuid(run_uid, run_uid) < 0) { perror_msg_and_die("setreuid"); } @@ -1364,15 +1360,13 @@ startup_child(char **argv) if (colon) { n = colon - path; m = n + 1; - } - else + } else m = n = strlen(path); if (n == 0) { if (!getcwd(pathname, PATH_MAX)) continue; len = strlen(pathname); - } - else if (n > sizeof(pathname) - 1) + } else if (n > sizeof(pathname) - 1) continue; else { strncpy(pathname, path, n); @@ -1466,8 +1460,7 @@ startup_child(char **argv) | TCB_SKIP_DETACH_ON_FIRST_EXEC | (NOMMU_SYSTEM ? 0 : (TCB_HIDE_LOG | post_attach_sigstop)); newoutf(tcp); - } - else { + } else { /* With -D, we are *child* here, the tracee is our parent. */ strace_child = strace_tracer_pid; strace_tracer_pid = getpid(); @@ -1582,12 +1575,12 @@ get_os_release(void) error_msg_and_die("Bad OS release string: '%s'", u.release); /* Note: this open-codes KERNEL_VERSION(): */ rel = (rel << 8) | atoi(p); - if (rel >= KERNEL_VERSION(1,0,0)) + if (rel >= KERNEL_VERSION(1, 0, 0)) break; while (*p >= '0' && *p <= '9') p++; if (*p != '.') { - if (rel >= KERNEL_VERSION(0,1,0)) { + if (rel >= KERNEL_VERSION(0, 1, 0)) { /* "X.Y-something" means "X.Y.0" */ rel <<= 8; break; @@ -1847,8 +1840,7 @@ init(int argc, char *argv[]) } run_uid = pent->pw_uid; run_gid = pent->pw_gid; - } - else { + } else { run_uid = getuid(); run_gid = getgid(); } @@ -1885,8 +1877,7 @@ init(int argc, char *argv[]) if (followfork >= 2) error_msg_and_help("piping the output and -ff are mutually exclusive"); shared_log = strace_popen(outfname + 1); - } - else if (followfork < 2) + } else if (followfork < 2) shared_log = strace_fopen(outfname); } else { /* -ff without -o FILE is the same as single -f */ @@ -2563,7 +2554,7 @@ dispatch_event(enum trace_event ret, int *pstatus, siginfo_t *si) * PTRACE_GETEVENTMSG returns old pid starting from Linux 3.0. * On 2.6 and earlier, it can return garbage. */ - if (os_release >= KERNEL_VERSION(3,0,0)) + if (os_release >= KERNEL_VERSION(3, 0, 0)) current_tcp = maybe_switch_tcbs(current_tcp, current_tcp->pid); if (detach_on_execve) { diff --git a/syscall.c b/syscall.c index c78436b95..02626c73e 100644 --- a/syscall.c +++ b/syscall.c @@ -872,8 +872,7 @@ syscall_exiting_trace(struct tcb *tcp, struct timeval tv, int res) } if (syscall_tampered(tcp)) tprints(" (INJECTED)"); - } - else if (!(sys_res & RVAL_NONE) && u_error) { + } else if (!(sys_res & RVAL_NONE) && u_error) { const char *u_error_str; switch (u_error) { @@ -944,8 +943,7 @@ syscall_exiting_trace(struct tcb *tcp, struct timeval tv, int res) tprints(" (INJECTED)"); if ((sys_res & RVAL_STR) && tcp->auxstr) tprintf(" (%s)", tcp->auxstr); - } - else { + } else { if (sys_res & RVAL_NONE) tprints("= ?"); else { @@ -983,8 +981,7 @@ syscall_exiting_trace(struct tcb *tcp, struct timeval tv, int res) if (show_fd_path) { tprints("= "); printfd(tcp, tcp->u_rval); - } - else + } else tprintf("= %" PRI_kld, tcp->u_rval); break; default: @@ -1325,5 +1322,5 @@ syscall_name(kernel_ulong_t scno) if (current_personality == X32_PERSONALITY_NUMBER) scno &= ~__X32_SYSCALL_BIT; #endif - return scno_is_valid(scno) ? sysent[scno].sys_name: NULL; + return scno_is_valid(scno) ? sysent[scno].sys_name : NULL; } diff --git a/sysctl.c b/sysctl.c index 645941559..176973a3c 100644 --- a/sysctl.c +++ b/sysctl.c @@ -155,7 +155,7 @@ SYS_FUNC(sysctl) default: goto out; } - out: +out: max_cnt = info.nlen; if (abbrev(tcp) && max_cnt > max_strlen) max_cnt = max_strlen; diff --git a/test/clone.c b/test/clone.c index bdce8b19b..dd898a059 100644 --- a/test/clone.c +++ b/test/clone.c @@ -6,7 +6,7 @@ #include #include -int child(void* arg) +int child(void *arg) { write(1, "clone\n", 6); return 0; diff --git a/test/seccomp.c b/test/seccomp.c index fac43b15f..cc4f3ee97 100644 --- a/test/seccomp.c +++ b/test/seccomp.c @@ -32,7 +32,7 @@ static const struct sock_filter filter[] = { /* load architecture */ - BPF_STMT(BPF_LD | BPF_W | BPF_ABS, (offsetof (struct seccomp_data, arch))), + BPF_STMT(BPF_LD | BPF_W | BPF_ABS, offsetof(struct seccomp_data, arch)), /* jump forward 1 instruction if architecture matches */ BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, SECCOMP_ARCH, 1, 0), /* kill process */ diff --git a/test/threaded_execve.c b/test/threaded_execve.c index ca601735f..f2b2bce4c 100644 --- a/test/threaded_execve.c +++ b/test/threaded_execve.c @@ -56,10 +56,10 @@ extern int __clone2(int (*fn) (void *), void *child_stack_base, #define clone2 __clone2 #elif defined(__metag__) #define clone2(func, stack_base, size, flags, arg...) \ - clone(func, stack_base, flags, arg) + clone(func, stack_base, flags, arg) #else #define clone2(func, stack_base, size, flags, arg...) \ - clone(func, (stack_base) + (size), flags, arg) + clone(func, (stack_base) + (size), flags, arg) #endif /* Direct calls to syscalls, avoiding libc wrappers */ #define syscall_tgkill(pid, tid, sig) syscall(__NR_tgkill, (pid), (tid), (sig)) @@ -74,7 +74,8 @@ static int thread1(void *unused) { write(1, "1", 1); - for(;;) pause(); + for (;;) + pause(); return 0; } @@ -89,7 +90,8 @@ thread2(void *unused) execl("/proc/self/exe", "exe", "exe", buf, NULL); /* So fall back to resolved name */ execl(my_name, "exe", "exe", buf, NULL); - for(;;) pause(); + for (;;) + pause(); return 0; } @@ -119,9 +121,14 @@ thread_leader(void) /* Various states leader can be while other thread execve's: */ switch (leader_final_action % 3) { - case 0: syscall_exit(42); /* leader is dead */ - case 1: for(;;) pause(); /* leader is in syscall */ - default: for(;;) continue; /* leader is in userspace */ + case 0: + syscall_exit(42); /* leader is dead */ + case 1: + for (;;) + pause(); /* leader is in syscall */ + default: + for (;;) + continue; /* leader is in userspace */ } } @@ -143,5 +150,5 @@ main(int argc, char **argv) alarm(argv[1] ? atoi(argv[1]) : 1); thread_leader(); - return 0; + return 0; } diff --git a/tests/add_key.c b/tests/add_key.c index d2696f9bc..1de0cc3b5 100644 --- a/tests/add_key.c +++ b/tests/add_key.c @@ -70,8 +70,7 @@ main(void) { static const char unterminated1[] = { '\1', '\2', '\3', '\4', '\5' }; static const char unterminated2[] = { '\6', '\7', '\10', '\11', '\12' }; - static const char unterminated3[] = - { '\16', '\17', '\20', '\21', '\22' }; + static const char unterminated3[] = { '\16', '\17', '\20', '\21', '\22' }; char *bogus_type = tail_memdup(unterminated1, sizeof(unterminated1)); char *bogus_desc = tail_memdup(unterminated2, sizeof(unterminated2)); diff --git a/tests/aio.c b/tests/aio.c index 677a02b53..77b6c05d9 100644 --- a/tests/aio.c +++ b/tests/aio.c @@ -240,9 +240,9 @@ main(void) perror_msg_and_skip("io_submit"); printf("io_submit(%#lx, %u, [" "{data=%#" PRI__x64 ", pread, reqprio=11, fildes=0, " - "buf=%p, nbytes=%u, offset=%" PRI__d64 "}, " + "buf=%p, nbytes=%u, offset=%" PRI__d64 "}, " "{data=%#" PRI__x64 ", pread, reqprio=22, fildes=0, " - "buf=%p, nbytes=%u, offset=%" PRI__d64 "}" + "buf=%p, nbytes=%u, offset=%" PRI__d64 "}" "]) = %s\n", *ctx, nr, cb[0].aio_data, data0, sizeof_data0, cb[0].aio_offset, @@ -317,18 +317,18 @@ main(void) printf("io_submit(%#lx, %ld, [" "{data=%#" PRI__x64 ", key=%u, %hu /* SUB_??? */, fildes=%d}, " "{key=%u, pwrite, reqprio=%hd, fildes=%d, str=NULL" - ", nbytes=%" PRI__u64 ", offset=%" PRI__d64 + ", nbytes=%" PRI__u64 ", offset=%" PRI__d64 # ifdef IOCB_FLAG_RESFD - ", resfd=%d, flags=%#x" + ", resfd=%d, flags=%#x" # endif - "}, " + "}, " "{key=%u, pwrite, reqprio=%hd, fildes=%d, buf=%#" PRI__x64 - ", nbytes=%" PRI__u64 ", offset=%" PRI__d64 "}, " + ", nbytes=%" PRI__u64 ", offset=%" PRI__d64 "}, " "{key=%u, pwrite, reqprio=%hd, fildes=%d" - ", str=\"\\0\\1\\2\\3%.28s\"..." - ", nbytes=%" PRI__u64 ", offset=%" PRI__d64 "}, " + ", str=\"\\0\\1\\2\\3%.28s\"..." + ", nbytes=%" PRI__u64 ", offset=%" PRI__d64 "}, " "{key=%u, pwritev, reqprio=%hd, fildes=%d, buf=%#" PRI__x64 - ", nbytes=%" PRI__u64 ", offset=%" PRI__d64 "}" + ", nbytes=%" PRI__u64 ", offset=%" PRI__d64 "}" ", {NULL}, {%#lx}, %p]) = %s\n", *ctx, 1057L, cbv2[0].aio_data, cbv2[0].aio_key, @@ -351,11 +351,11 @@ main(void) perror_msg_and_skip("io_submit"); printf("io_submit(%#lx, %u, [" "{data=%#" PRI__x64 ", preadv, reqprio=%hd, fildes=0, " - "iovec=[{iov_base=%p, iov_len=%u}" - ", {iov_base=%p, iov_len=%u}], offset=%" PRI__d64 "}, " + "iovec=[{iov_base=%p, iov_len=%u}" + ", {iov_base=%p, iov_len=%u}], offset=%" PRI__d64 "}, " "{data=%#" PRI__x64 ", preadv, reqprio=%hd, fildes=0, " - "iovec=[{iov_base=%p, iov_len=%u}" - ", {iov_base=%p, iov_len=%u}], offset=%" PRI__d64 "}" + "iovec=[{iov_base=%p, iov_len=%u}" + ", {iov_base=%p, iov_len=%u}], offset=%" PRI__d64 "}" "]) = %s\n", *ctx, nr, cbv[0].aio_data, cbv[0].aio_reqprio, diff --git a/tests/btrfs.c b/tests/btrfs.c index ff5feaad8..710d76307 100644 --- a/tests/btrfs.c +++ b/tests/btrfs.c @@ -75,10 +75,10 @@ const char uuid_reference_string[] = "01234567-89ab-cdef-fedc-ba9876543210"; struct btrfs_ioctl_quota_rescan_args { uint64_t flags, progress, reserved[6]; }; -# 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, \ - struct btrfs_ioctl_quota_rescan_args) +# 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, struct btrfs_ioctl_quota_rescan_args) #endif #ifndef BTRFS_IOC_QUOTA_RESCAN_WAIT @@ -86,30 +86,30 @@ struct btrfs_ioctl_quota_rescan_args { #endif #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, \ - struct btrfs_ioctl_feature_flags[2]) -# define BTRFS_IOC_GET_SUPPORTED_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \ - struct btrfs_ioctl_feature_flags[3]) +# 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, struct btrfs_ioctl_feature_flags[2]) +# define BTRFS_IOC_GET_SUPPORTED_FEATURES \ + _IOR(BTRFS_IOCTL_MAGIC, 57, struct btrfs_ioctl_feature_flags[3]) #endif #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; + uint64_t compat_flags; + uint64_t compat_ro_flags; + uint64_t incompat_flags; }; #endif #ifndef HAVE_STRUCT_BTRFS_IOCTL_DEFRAG_RANGE_ARGS_START struct btrfs_ioctl_defrag_range_args { - uint64_t start; - uint64_t len; - uint64_t flags; - uint32_t extent_thresh; - uint32_t compress_type; - uint32_t unused[4]; + uint64_t start; + uint64_t len; + uint64_t flags; + uint32_t extent_thresh; + uint32_t compress_type; + uint32_t unused[4]; }; #endif @@ -140,14 +140,14 @@ struct file_dedupe_range { #endif #ifndef BTRFS_IOC_TREE_SEARCH_V2 -# define BTRFS_IOC_TREE_SEARCH_V2 _IOWR(BTRFS_IOCTL_MAGIC, 17, \ - struct btrfs_ioctl_search_args_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 */ uint64_t buf_size; /* in - size of buffer * out - on EOVERFLOW: needed size * to store item */ - uint64_t buf[0]; /* out - found items */ + uint64_t buf[0]; /* out - found items */ }; #endif diff --git a/tests/errno2name.c b/tests/errno2name.c index 4a176993b..d481e2e8b 100644 --- a/tests/errno2name.c +++ b/tests/errno2name.c @@ -476,6 +476,7 @@ errno2name(void) #ifdef EXFULL CASE(EXFULL); #endif - default: perror_msg_and_fail("unknown errno %d", errno); + default: + perror_msg_and_fail("unknown errno %d", errno); } } diff --git a/tests/futex.c b/tests/futex.c index 9a9ab6645..b75ab3398 100644 --- a/tests/futex.c +++ b/tests/futex.c @@ -254,7 +254,7 @@ main(int argc, char *argv[]) zero_extend_signed_to_ull(tmout->tv_nsec), sprintrc(rc)); CHECK_FUTEX_ENOSYS(uaddr, - FUTEX_CLOCK_REALTIME | FUTEX_PRIVATE_FLAG | FUTEX_WAIT , + FUTEX_CLOCK_REALTIME | FUTEX_PRIVATE_FLAG | FUTEX_WAIT, VAL, tmout, uaddr2, 0, (rc == -1) && (errno == EAGAIN)); printf("futex(%p, FUTEX_WAIT_PRIVATE|FUTEX_CLOCK_REALTIME, %u" ", {tv_sec=%lld, tv_nsec=%llu}) = %s\n", @@ -612,7 +612,7 @@ main(int argc, char *argv[]) CHECK_FUTEX_ENOSYS(uaddr + 1, FUTEX_PRIVATE_FLAG | FUTEX_UNLOCK_PI, VAL, tmout, uaddr2 + 1, VAL3, (rc == -1) && (errno == EFAULT)); - printf("futex(%p, FUTEX_UNLOCK_PI_PRIVATE) = %s\n", uaddr +1, + printf("futex(%p, FUTEX_UNLOCK_PI_PRIVATE) = %s\n", uaddr + 1, sprintrc(rc)); CHECK_INVALID_CLOCKRT(FUTEX_UNLOCK_PI, 0); diff --git a/tests/getcpu.c b/tests/getcpu.c index 3cb49cb29..2b1575353 100644 --- a/tests/getcpu.c +++ b/tests/getcpu.c @@ -41,16 +41,16 @@ int main(void) { unsigned *bogus_cpu = - (unsigned *) tail_alloc(sizeof(* bogus_cpu)) + 1; + (unsigned *) tail_alloc(sizeof(*bogus_cpu)) + 1; unsigned *bogus_node = - (unsigned *) tail_alloc(sizeof(* bogus_node)) + 1; + (unsigned *) tail_alloc(sizeof(*bogus_node)) + 1; unsigned *bogus_tcache = - (unsigned *) tail_alloc(sizeof(* bogus_tcache)) + 1; + (unsigned *) tail_alloc(sizeof(*bogus_tcache)) + 1; long res; TAIL_ALLOC_OBJECT_CONST_PTR(unsigned, cpu); TAIL_ALLOC_OBJECT_CONST_PTR(unsigned, node); - long * tcache = tail_alloc(128); + long *tcache = tail_alloc(128); res = syscall(__NR_getcpu, NULL, NULL, NULL); printf("getcpu(NULL, NULL, NULL) = %s\n", sprintrc(res)); diff --git a/tests/ioctl.c b/tests/ioctl.c index 5dc0864fd..3c666b0d6 100644 --- a/tests/ioctl.c +++ b/tests/ioctl.c @@ -54,7 +54,7 @@ && defined EV_KEY int -main(void ) +main(void) { uint64_t data = 0; diff --git a/tests/ioctl_sg_io_v3.c b/tests/ioctl_sg_io_v3.c index 3808b2099..3385bca91 100644 --- a/tests/ioctl_sg_io_v3.c +++ b/tests/ioctl_sg_io_v3.c @@ -198,12 +198,12 @@ main(void) sg_io->iovec_count, sg_io->dxfer_len, sg_io->timeout, - * (unsigned char *) (iov[0].iov_base + 0), - * (unsigned char *) (iov[0].iov_base + 1), + *(unsigned char *) (iov[0].iov_base + 0), + *(unsigned char *) (iov[0].iov_base + 1), (unsigned int) iov[0].iov_len, - * (unsigned char *) (iov[1].iov_base + 0), - * (unsigned char *) (iov[1].iov_base + 1), - * (unsigned char *) (iov[1].iov_base + 2), + *(unsigned char *) (iov[1].iov_base + 0), + *(unsigned char *) (iov[1].iov_base + 1), + *(unsigned char *) (iov[1].iov_base + 2), (unsigned int) iov[1].iov_len, sg_io->status, sg_io->masked_status, @@ -248,12 +248,12 @@ main(void) sg_io->iovec_count, sg_io->dxfer_len, sg_io->timeout, - * (unsigned char *) (iov[0].iov_base + 0), - * (unsigned char *) (iov[0].iov_base + 1), + *(unsigned char *) (iov[0].iov_base + 0), + *(unsigned char *) (iov[0].iov_base + 1), (unsigned int) iov[0].iov_len, - * (unsigned char *) (iov[1].iov_base + 0), - * (unsigned char *) (iov[1].iov_base + 1), - * (unsigned char *) (iov[1].iov_base + 2), + *(unsigned char *) (iov[1].iov_base + 0), + *(unsigned char *) (iov[1].iov_base + 1), + *(unsigned char *) (iov[1].iov_base + 2), (unsigned int) iov[1].iov_len, sg_io->status, sg_io->masked_status, @@ -300,10 +300,10 @@ main(void) sg_io->iovec_count, sg_io->dxfer_len, sg_io->timeout, - * (unsigned char *) (sg_io->dxferp + 0), - * (unsigned char *) (sg_io->dxferp + 1), - * (unsigned char *) (sg_io->dxferp + 2), - * (unsigned char *) (sg_io->dxferp + 3), + *(unsigned char *) (sg_io->dxferp + 0), + *(unsigned char *) (sg_io->dxferp + 1), + *(unsigned char *) (sg_io->dxferp + 2), + *(unsigned char *) (sg_io->dxferp + 3), sg_io->status, sg_io->masked_status, sg_io->msg_status, @@ -348,11 +348,11 @@ main(void) sg_io->iovec_count, sg_io->dxfer_len, sg_io->timeout, - * (unsigned char *) (sg_io->dxferp + 0), - * (unsigned char *) (sg_io->dxferp + 1), - * (unsigned char *) (sg_io->dxferp + 2), - * (unsigned char *) (sg_io->dxferp + 0), - * (unsigned char *) (sg_io->dxferp + 1), + *(unsigned char *) (sg_io->dxferp + 0), + *(unsigned char *) (sg_io->dxferp + 1), + *(unsigned char *) (sg_io->dxferp + 2), + *(unsigned char *) (sg_io->dxferp + 0), + *(unsigned char *) (sg_io->dxferp + 1), sg_io->status, sg_io->masked_status, sg_io->msg_status, @@ -394,9 +394,9 @@ main(void) sg_io->iovec_count, sg_io->dxfer_len, sg_io->timeout, - * (unsigned char *) (sg_io->dxferp + 0), - * (unsigned char *) (sg_io->dxferp + 1), - * (unsigned char *) (sg_io->dxferp + 2), + *(unsigned char *) (sg_io->dxferp + 0), + *(unsigned char *) (sg_io->dxferp + 1), + *(unsigned char *) (sg_io->dxferp + 2), sg_io->status, sg_io->masked_status, sg_io->msg_status, diff --git a/tests/ioctl_sg_io_v4.c b/tests/ioctl_sg_io_v4.c index 9c1e9fa06..d2f7b72c5 100644 --- a/tests/ioctl_sg_io_v4.c +++ b/tests/ioctl_sg_io_v4.c @@ -189,9 +189,9 @@ main(void) ", dout_resid=%d" ", generated_tag=%#" PRI__x64 "}) = -1 EBADF (%m)\n", sg_io->request_len, - * (unsigned char *) ((unsigned long) sg_io->request + 0), - * (unsigned char *) ((unsigned long) sg_io->request + 1), - * (unsigned char *) ((unsigned long) sg_io->request + 2), + *(unsigned char *) ((unsigned long) sg_io->request + 0), + *(unsigned char *) ((unsigned long) sg_io->request + 1), + *(unsigned char *) ((unsigned long) sg_io->request + 2), sg_io->request_tag, sg_io->request_attr, sg_io->request_priority, @@ -201,22 +201,22 @@ main(void) sg_io->dout_xfer_len, sg_io->din_iovec_count, sg_io->din_xfer_len, - * (unsigned char *) (iov[0].iov_base + 0), - * (unsigned char *) (iov[0].iov_base + 1), + *(unsigned char *) (iov[0].iov_base + 0), + *(unsigned char *) (iov[0].iov_base + 1), (unsigned int) iov[0].iov_len, - * (unsigned char *) (iov[1].iov_base + 0), - * (unsigned char *) (iov[1].iov_base + 1), - * (unsigned char *) (iov[1].iov_base + 2), + *(unsigned char *) (iov[1].iov_base + 0), + *(unsigned char *) (iov[1].iov_base + 1), + *(unsigned char *) (iov[1].iov_base + 2), (unsigned int) iov[1].iov_len, sg_io->timeout, sg_io->usr_ptr, sg_io->response_len, - * (unsigned char *) ((unsigned long) sg_io->response + 0), - * (unsigned char *) ((unsigned long) sg_io->response + 1), - * (unsigned char *) ((unsigned long) sg_io->din_xferp + 0), - * (unsigned char *) ((unsigned long) sg_io->din_xferp + 1), - * (unsigned char *) ((unsigned long) sg_io->din_xferp + 2), - * (unsigned char *) ((unsigned long) sg_io->din_xferp + 3), + *(unsigned char *) ((unsigned long) sg_io->response + 0), + *(unsigned char *) ((unsigned long) sg_io->response + 1), + *(unsigned char *) ((unsigned long) sg_io->din_xferp + 0), + *(unsigned char *) ((unsigned long) sg_io->din_xferp + 1), + *(unsigned char *) ((unsigned long) sg_io->din_xferp + 2), + *(unsigned char *) ((unsigned long) sg_io->din_xferp + 3), sg_io->driver_status, sg_io->transport_status, sg_io->device_status, diff --git a/tests/ioctl_sock_gifconf.c b/tests/ioctl_sock_gifconf.c index f81faef46..efa55a3a1 100644 --- a/tests/ioctl_sock_gifconf.c +++ b/tests/ioctl_sock_gifconf.c @@ -105,7 +105,7 @@ print_ifconf(struct ifconf *ifc, int in_len, char *in_buf, long rc) static void gifconf_ioctl(int fd, struct ifconf *ifc, bool ifc_valid) { - const char * errstr; + const char *errstr; int in_len; char *in_buf; long rc; diff --git a/tests/ioctl_uffdio.c b/tests/ioctl_uffdio.c index c98e4a0f0..817e3c72c 100644 --- a/tests/ioctl_uffdio.c +++ b/tests/ioctl_uffdio.c @@ -71,7 +71,7 @@ main(void) api_struct->features = 0; rc = ioctl(fd, UFFDIO_API, api_struct); printf("ioctl(%d, UFFDIO_API, {api=0xaa, features=0, " - "features.out=%#" PRIx64 ", " "ioctls=1<<_UFFDIO_REGISTER|" + "features.out=%#" PRIx64 ", ioctls=1<<_UFFDIO_REGISTER|" "1<<_UFFDIO_UNREGISTER|1<<_UFFDIO_API", fd, (uint64_t)api_struct->features); api_struct->ioctls &= ~(1ull<<_UFFDIO_REGISTER| diff --git a/tests/ioctl_v4l2.c b/tests/ioctl_v4l2.c index f4ab65090..cc5dee6ac 100644 --- a/tests/ioctl_v4l2.c +++ b/tests/ioctl_v4l2.c @@ -85,7 +85,7 @@ init_v4l2_format(struct v4l2_format *const f, f->fmt.pix_mp.pixelformat = magic; f->fmt.pix_mp.field = V4L2_FIELD_NONE; f->fmt.pix_mp.colorspace = V4L2_COLORSPACE_JPEG; - struct v4l2_plane_pix_format* cur_pix = + struct v4l2_plane_pix_format *cur_pix = f->fmt.pix_mp.plane_fmt; for (i = 0; i < ARRAY_SIZE(f->fmt.pix_mp.plane_fmt); @@ -119,7 +119,7 @@ init_v4l2_format(struct v4l2_format *const f, f->fmt.win.clips[1].c.width = 0x9e3a6fb3; f->fmt.win.clips[1].c.height = 0x05617b76; - f->fmt.win.bitmap = (void*) -2UL; + f->fmt.win.bitmap = (void *) -2UL; #ifdef HAVE_STRUCT_V4L2_WINDOW_GLOBAL_ALPHA f->fmt.win.global_alpha = 0xce; #endif @@ -168,8 +168,8 @@ init_v4l2_format(struct v4l2_format *const f, static void dprint_ioctl_v4l2(struct v4l2_format *const f, - const char* request, const unsigned int buf_type, - const char* buf_type_string) + const char *request, const unsigned int buf_type, + const char *buf_type_string) { switch (buf_type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: @@ -323,7 +323,7 @@ dprint_ioctl_v4l2(struct v4l2_format *const f, dprint_ioctl_v4l2((v4l2_format), (request), (buf_type), #buf_type) int -main(void ) +main(void) { const unsigned int size = get_page_size(); void *const page = tail_alloc(size); @@ -688,7 +688,7 @@ main(void ) TAIL_ALLOC_OBJECT_CONST_PTR(struct v4l2_tuner, p_tuner); p_tuner->index = 0x4fb6df39; - strcpy((char*)p_tuner->name, "cum tacent clamant"); + strcpy((char *) p_tuner->name, "cum tacent clamant"); p_tuner->type = V4L2_TUNER_RADIO; p_tuner->capability = V4L2_TUNER_CAP_LOW; p_tuner->rangelow = 0xa673bc29; diff --git a/tests/ip_mreq.c b/tests/ip_mreq.c index e437ec435..4bfe00f3c 100644 --- a/tests/ip_mreq.c +++ b/tests/ip_mreq.c @@ -101,7 +101,7 @@ main(void) short_any[i].optval, 1); printf("setsockopt(0, %s, %s, \"\\%hho\", 1) = %s\n", short_any[i].str_level, short_any[i].str_optname, - * (unsigned char *) short_any[i].optval, + *(unsigned char *) short_any[i].optval, sprintrc(rc)); rc = setsockopt(0, short_any[i].level, short_any[i].optname, diff --git a/tests/ipc_msgbuf.c b/tests/ipc_msgbuf.c index 1c34494d8..9d149fa56 100644 --- a/tests/ipc_msgbuf.c +++ b/tests/ipc_msgbuf.c @@ -45,7 +45,7 @@ cleanup(void) } int -main (void) +main(void) { const long mtype = 0xdefaced; struct { diff --git a/tests/ipc_sem.c b/tests/ipc_sem.c index 0b730c110..c88327265 100644 --- a/tests/ipc_sem.c +++ b/tests/ipc_sem.c @@ -37,10 +37,10 @@ #include "xlat/resource_flags.h" union semun { - int val; /* Value for SETVAL */ - struct semid_ds *buf; /* Buffer for IPC_STAT, IPC_SET */ - unsigned short *array; /* Array for GETALL, SETALL */ - struct seminfo *__buf; /* Buffer for IPC_INFO + int val; /* Value for SETVAL */ + struct semid_ds *buf; /* Buffer for IPC_STAT, IPC_SET */ + unsigned short *array; /* Array for GETALL, SETALL */ + struct seminfo *__buf; /* Buffer for IPC_INFO (Linux-specific) */ }; diff --git a/tests/ksysent.c b/tests/ksysent.c index f5986643b..860e21e41 100644 --- a/tests/ksysent.c +++ b/tests/ksysent.c @@ -53,7 +53,7 @@ #define SI 0 #define SE 0 #define CST 0 -#define SEN(arg) 0,0 +#define SEN(arg) 0, 0 static const struct_sysent syscallent[] = { #include "syscallent.h" diff --git a/tests/mmsg_name.c b/tests/mmsg_name.c index a7a55c55a..ac8dcde7e 100644 --- a/tests/mmsg_name.c +++ b/tests/mmsg_name.c @@ -77,7 +77,7 @@ print_msghdr(const struct msghdr *const msg, const int user_msg_namelen) } printf("%d, msg_iov=[{iov_base=\"%c\", iov_len=1}]" ", msg_iovlen=1, msg_controllen=0, msg_flags=0}", - (int) msg->msg_namelen, * (char *) msg->msg_iov[0].iov_base); + (int) msg->msg_namelen, *(char *) msg->msg_iov[0].iov_base); } static void diff --git a/tests/mq.c b/tests/mq.c index ee2d059db..cf1b7308f 100644 --- a/tests/mq.c +++ b/tests/mq.c @@ -39,7 +39,7 @@ # include int -main (void) +main(void) { struct mq_attr attr; (void) close(0); diff --git a/tests/mq_sendrecv.c b/tests/mq_sendrecv.c index f4f9e67d8..f6f6bd299 100644 --- a/tests/mq_sendrecv.c +++ b/tests/mq_sendrecv.c @@ -437,7 +437,7 @@ main(void) bogus_attrs[1] = 2; bogus_attrs[2] = MSG_SIZE; fd = rc = syscall(__NR_mq_open, mq_name, - O_CREAT|O_RDWR|O_NONBLOCK, S_IRWXU, bogus_attrs); + O_CREAT|O_RDWR|O_NONBLOCK, S_IRWXU, bogus_attrs); errstr = sprintrc(rc); if (rc < 0) perror_msg_and_skip("mq_open"); diff --git a/tests/msg_control.c b/tests/msg_control.c index fab519a8d..5b6b25a5d 100644 --- a/tests/msg_control.c +++ b/tests/msg_control.c @@ -536,7 +536,7 @@ test_sol_socket(struct msghdr *const mh, void *const page) static void test_ip_pktinfo(struct msghdr *const mh, void *const page, - const int cmsg_type, const char *const cmsg_type_str) + const int cmsg_type, const char *const cmsg_type_str) { const unsigned int len = CMSG_SPACE(sizeof(struct in_pktinfo)); struct cmsghdr *const cmsg = get_cmsghdr(page, len); @@ -601,7 +601,7 @@ test_ip_uint(struct msghdr *const mh, void *const page, static void test_ip_uint8_t(struct msghdr *const mh, void *const page, - const int cmsg_type, const char *const cmsg_type_str) + const int cmsg_type, const char *const cmsg_type_str) { const unsigned int len = CMSG_SPACE(1); struct cmsghdr *const cmsg = get_cmsghdr(page, len); @@ -683,7 +683,7 @@ struct sock_ee { static void test_ip_recverr(struct msghdr *const mh, void *const page, - const int cmsg_type, const char *const cmsg_type_str) + const int cmsg_type, const char *const cmsg_type_str) { const unsigned int len = CMSG_SPACE(sizeof(struct sock_ee)); struct cmsghdr *const cmsg = get_cmsghdr(page, len); diff --git a/tests/net-y-unix.c b/tests/net-y-unix.c index df56ad640..fbdf59006 100644 --- a/tests/net-y-unix.c +++ b/tests/net-y-unix.c @@ -182,7 +182,7 @@ main(void) perror_msg_and_fail("accept"); accept_inode = inode_of_sockfd(accept_fd); const char * const sun_path1 = - ((struct sockaddr_un *) accept_sa) -> sun_path + 1; + ((struct sockaddr_un *) accept_sa)->sun_path + 1; printf("accept(%d, {sa_family=AF_UNIX" ", sun_path=@\"%s\"}, [%d->%d]) = %d\n", listen_fd, listen_inode, sun_path1, diff --git a/tests/net-yy-inet.c b/tests/net-yy-inet.c index af1262eec..c043920d1 100644 --- a/tests/net-yy-inet.c +++ b/tests/net-yy-inet.c @@ -74,7 +74,7 @@ main(void) if (getsockname(listen_fd, listen_sa, len)) perror_msg_and_fail("getsockname"); const unsigned int listen_port = - ntohs(((struct sockaddr_in *) listen_sa) -> sin_port); + ntohs(((struct sockaddr_in *) listen_sa)->sin_port); printf("getsockname(%d, {sa_family=AF_INET" ", sin_port=htons(%u), sin_addr=inet_addr(\"127.0.0.1\")}" ", [%u]) = 0\n", @@ -109,7 +109,7 @@ main(void) if (accept_fd < 0) perror_msg_and_fail("accept"); const unsigned int connect_port = - ntohs(((struct sockaddr_in *) accept_sa) -> sin_port); + ntohs(((struct sockaddr_in *) accept_sa)->sin_port); printf("accept(%d, {sa_family=AF_INET" ", sin_port=htons(%u), sin_addr=inet_addr(\"127.0.0.1\")}" ", [%u]) = %d127.0.0.1:%u]>\n", diff --git a/tests/net-yy-unix.c b/tests/net-yy-unix.c index f27cdc079..21822db9f 100644 --- a/tests/net-yy-unix.c +++ b/tests/net-yy-unix.c @@ -185,7 +185,7 @@ main(void) perror_msg_and_fail("accept"); accept_inode = inode_of_sockfd(accept_fd); const char * const sun_path1 = - ((struct sockaddr_un *) accept_sa) -> sun_path + 1; + ((struct sockaddr_un *) accept_sa)->sun_path + 1; printf("accept(%d, {sa_family=AF_UNIX" ", sun_path=@\"%s\"}, [%d->%d]) = %d%lu,\"%s\"]>\n", listen_fd, listen_inode, TEST_SOCKET, sun_path1, diff --git a/tests/nsyscalls.c b/tests/nsyscalls.c index 7fda5ba1b..d6b989c48 100644 --- a/tests/nsyscalls.c +++ b/tests/nsyscalls.c @@ -54,7 +54,7 @@ #define SI 0 #define SE 0 #define CST 0 -#define SEN(arg) 0,0 +#define SEN(arg) 0, 0 static const struct_sysent syscallent[] = { #include "syscallent.h" diff --git a/tests/perf_event_open.c b/tests/perf_event_open.c index b57c9cf36..74ff9527e 100644 --- a/tests/perf_event_open.c +++ b/tests/perf_event_open.c @@ -75,34 +75,34 @@ struct u64_val_str { /* In order to avoid endianness-specific hackery. */ struct pea_flags { - uint64_t disabled :1, - inherit :1, - pinned :1, - exclusive :1, - exclude_user :1, - exclude_kernel :1, - exclude_hv :1, - exclude_idle :1, - mmap :1, - comm :1, - freq :1, - inherit_stat :1, - enable_on_exec :1, - task :1, - watermark :1, - precise_ip :2, - mmap_data :1, - sample_id_all :1, - exclude_host :1, - exclude_guest :1, - exclude_callchain_kernel :1, - exclude_callchain_user :1, - mmap2 :1, - comm_exec :1, - use_clockid :1, - context_switch :1, - write_backward :1, - __reserved_1 :36; + uint64_t disabled :1, + inherit :1, + pinned :1, + exclusive :1, + exclude_user :1, + exclude_kernel :1, + exclude_hv :1, + exclude_idle :1, + mmap :1, + comm :1, + freq :1, + inherit_stat :1, + enable_on_exec :1, + task :1, + watermark :1, + precise_ip :2, + mmap_data :1, + sample_id_all :1, + exclude_host :1, + exclude_guest :1, + exclude_callchain_kernel :1, + exclude_callchain_user :1, + mmap2 :1, + comm_exec :1, + use_clockid :1, + context_switch :1, + write_backward :1, + __reserved_1 :36; }; static const char * @@ -458,7 +458,7 @@ print_event_attr(struct perf_event_attr *attr_ptr, size_t size, /* End of version 4 of the structure */ if (size <= 104) { - cutoff =104; + cutoff = 104; goto end; } @@ -471,7 +471,7 @@ print_event_attr(struct perf_event_attr *attr_ptr, size_t size, printf(", aux_watermark=%" PRIu32, (uint32_t) val); if (size <= 108) { - cutoff =108; + cutoff = 108; goto end; } @@ -484,7 +484,7 @@ print_event_attr(struct perf_event_attr *attr_ptr, size_t size, printf(", sample_max_stack=%" PRIu16, (uint16_t) val); if (size <= 110) { - cutoff =110; + cutoff = 110; goto end; } @@ -718,7 +718,7 @@ main(void) for (i = 0; i < ARRAY_SIZE(args); i++) { rc = syscall(__NR_perf_event_open, args[i].attr, args[i].pid, - args[i].cpu, args[i].group_fd, args[i].flags); + args[i].cpu, args[i].group_fd, args[i].flags); printf("perf_event_open(%s, %d, %d, %d, %s) = %s\n", printaddr(args[i].attr), args[i].pid, args[i].cpu, args[i].group_fd, args[i].flags_str, sprintrc(rc)); @@ -793,19 +793,19 @@ main(void) attr->size = 0; rc = syscall(__NR_perf_event_open, attr, args[args_idx].pid, - args[args_idx].cpu, args[args_idx].group_fd, - args[args_idx].flags); + args[args_idx].cpu, args[args_idx].group_fd, + args[args_idx].flags); printf("perf_event_open("); print_event_attr(attr, i ? ((i == 1) ? 0 : size) : size + 8, - attr_types[type_idx].str, - attr_configs[type_idx][config_idx].str, - sample_types[sample_type_idx].str, - read_formats[read_format_idx].str, - ip_desc_str, - bp_types[bp_type_idx].str, - branch_sample_types[branch_sample_type_idx].str, - clockids[clockid_idx].str, size); + attr_types[type_idx].str, + attr_configs[type_idx][config_idx].str, + sample_types[sample_type_idx].str, + read_formats[read_format_idx].str, + ip_desc_str, + bp_types[bp_type_idx].str, + branch_sample_types[branch_sample_type_idx].str, + clockids[clockid_idx].str, size); printf(", %d, %d, %d, %s) = %s\n", args[args_idx].pid, args[args_idx].cpu, args[args_idx].group_fd, args[args_idx].flags_str, sprintrc(rc)); diff --git a/tests/ppoll.c b/tests/ppoll.c index 85a7e0c00..622418392 100644 --- a/tests/ppoll.c +++ b/tests/ppoll.c @@ -138,9 +138,10 @@ main(void) #if VERBOSE pipe_fd[2], pipe_fd[3], #endif - (unsigned) ARRAY_SIZE(fds1), USR2_CHLD_str, - (unsigned) sigset_size, rc, pipe_fd[1], POLLWRNORM_str, - pipe_fd[3], (unsigned ) ts->tv_sec, (unsigned) ts->tv_nsec); + (unsigned int) ARRAY_SIZE(fds1), USR2_CHLD_str, + (unsigned int) sigset_size, rc, pipe_fd[1], POLLWRNORM_str, + pipe_fd[3], (unsigned int) ts->tv_sec, + (unsigned int) ts->tv_nsec); ts->tv_sec = 0; ts->tv_nsec = 999; diff --git a/tests/print_quoted_string.c b/tests/print_quoted_string.c index 3ad86024c..732fe3deb 100644 --- a/tests/print_quoted_string.c +++ b/tests/print_quoted_string.c @@ -18,7 +18,7 @@ print_quoted_string(const char *instr) void print_quoted_memory(const char *instr, const size_t len) { - const unsigned char *str = (const unsigned char*) instr; + const unsigned char *str = (const unsigned char *) instr; size_t i; for (i = 0; i < len; ++i) { diff --git a/tests/print_time.c b/tests/print_time.c index 429232960..e25924283 100644 --- a/tests/print_time.c +++ b/tests/print_time.c @@ -58,8 +58,6 @@ print_time_t_ex(const time_t t, const unsigned long long part_sec, if (comment) fputs(" */", stdout); - - return; } void diff --git a/tests/process_vm_readv_writev.c b/tests/process_vm_readv_writev.c index 2a089395a..c0f9c312c 100644 --- a/tests/process_vm_readv_writev.c +++ b/tests/process_vm_readv_writev.c @@ -51,7 +51,7 @@ enum { MAX_SEGM_COUNT = 2, MAX_STR_LEN = 5 }; struct print_iov_arg { uint32_t count; uint32_t valid :1, - string :1, + string :1, addr_term:1, check_rc :1; uint32_t str_segms; @@ -247,14 +247,15 @@ main(void) 2, {SEGM1_BASE, SEGM2_BASE}, {SIZE_1, SIZE_2} }; struct print_iov_arg rmt_arg = { ARRAY_SIZE(rmt_iovec), 1 }; - struct print_iov_arg bogus_arg_cut = - { ARRAY_SIZE(bogus_iovec) - 2, 1, 0, 1 }; - struct print_iov_arg lcl_arg_cut = - { ARRAY_SIZE(lcl_iovec) - 2, 1, 1, 1, 0, 2, - {SEGM1_BASE + SIZE_11 + SIZE_12, SEGM2_BASE}, - {SIZE_13, SIZE_2} }; - struct print_iov_arg rmt_arg_cut = - { ARRAY_SIZE(rmt_iovec) - 2, 1 }; + struct print_iov_arg bogus_arg_cut = { + ARRAY_SIZE(bogus_iovec) - 2, 1, 0, 1 + }; + struct print_iov_arg lcl_arg_cut = { + ARRAY_SIZE(lcl_iovec) - 2, 1, 1, 1, 0, 2, + { SEGM1_BASE + SIZE_11 + SIZE_12, SEGM2_BASE }, + {SIZE_13, SIZE_2} + }; + struct print_iov_arg rmt_arg_cut = { ARRAY_SIZE(rmt_iovec) - 2, 1 }; fill_memory_ex(data1_out, SIZE_1, SEGM1_BASE, SIZE_1); diff --git a/tests/pselect6.c b/tests/pselect6.c index f5939f3bb..072980818 100644 --- a/tests/pselect6.c +++ b/tests/pselect6.c @@ -109,7 +109,7 @@ int main(int ac, char **av) * but with a pointer to a large chunk of valid memory. */ FD_ZERO(set[0]); - FD_SET(fds[1],set[0]); + FD_SET(fds[1], set[0]); assert(pselect(-1, NULL, set[0], NULL, NULL, &mask) == -1); printf("pselect6(-1, NULL, %p, NULL, NULL, {[HUP CHLD], %u}) " "= -1 EINVAL (%m)\n", set[0], NSIG_BYTES); @@ -118,7 +118,7 @@ int main(int ac, char **av) * Another variant, with nfds exceeding FD_SETSIZE limit. */ FD_ZERO(set[0]); - FD_SET(fds[0],set[0]); + FD_SET(fds[0], set[0]); FD_ZERO(set[1]); tm.ts.tv_sec = 0; tm.ts.tv_nsec = 123; diff --git a/tests/ptrace.c b/tests/ptrace.c index 9e0ffdc61..d776dcdd2 100644 --- a/tests/ptrace.c +++ b/tests/ptrace.c @@ -114,7 +114,7 @@ test_peeksiginfo(unsigned long pid, const unsigned long bad_request) if (errno == EINTR) continue; saved = errno; - kill (pid, SIGKILL); + kill(pid, SIGKILL); errno = saved; perror_msg_and_fail("wait"); } @@ -159,7 +159,7 @@ test_peeksiginfo(unsigned long pid, const unsigned long bad_request) if (do_ptrace(PTRACE_CONT, pid, 0, 0)) { saved = errno; - kill (pid, SIGKILL); + kill(pid, SIGKILL); errno = saved; perror_msg_and_fail("ptrace"); } diff --git a/tests/quotactl-xfs.c b/tests/quotactl-xfs.c index b2a884b6f..1c7d07e36 100644 --- a/tests/quotactl-xfs.c +++ b/tests/quotactl-xfs.c @@ -71,7 +71,7 @@ struct fs_quota_statv { struct fs_qfilestatv qs_pquota; /* project quota information */ int32_t qs_btimelimit; /* limit for blks timer */ int32_t qs_itimelimit; /* limit for inodes timer */ - int32_t qs_rtbtimelimit; /* limit for rt blks timer */ + int32_t qs_rtbtimelimit; /* limit for rt blks timer */ uint16_t qs_bwarnlimit; /* limit for num warnings */ uint16_t qs_iwarnlimit; /* limit for num warnings */ uint64_t qs_pad2[8]; /* for future proofing */ diff --git a/tests/readahead.c b/tests/readahead.c index c243ae40b..a3e5cb8d8 100644 --- a/tests/readahead.c +++ b/tests/readahead.c @@ -37,7 +37,7 @@ * see https://sourceware.org/bugzilla/show_bug.cgi?id=5208 */ # if !(defined __GLIBC_MINOR__ && \ - (__GLIBC__ << 16) + __GLIBC_MINOR__ >= (2 << 16) + 8) + (__GLIBC__ << 16) + __GLIBC_MINOR__ >= (2 << 16) + 8) # undef HAVE_READAHEAD # endif /* glibc < 2.8 */ /* @@ -45,7 +45,7 @@ * see https://sourceware.org/bugzilla/show_bug.cgi?id=21026 */ # if defined LINUX_MIPSN64 && !(defined __GLIBC_MINOR__ && \ - (__GLIBC__ << 16) + __GLIBC_MINOR__ >= (2 << 16) + 25) + (__GLIBC__ << 16) + __GLIBC_MINOR__ >= (2 << 16) + 25) # undef HAVE_READAHEAD # endif /* LINUX_MIPSN64 && glibc < 2.25 */ # endif /* __GLIBC__ */ diff --git a/tests/reboot.c b/tests/reboot.c index 9b09e647e..ce651dc7a 100644 --- a/tests/reboot.c +++ b/tests/reboot.c @@ -14,14 +14,14 @@ int main(void) { static const char buf[] = "reboot"; - long rc = syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, \ - INVALID_MAGIC, LINUX_REBOOT_CMD_RESTART2, buf); + long rc = syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, + INVALID_MAGIC, LINUX_REBOOT_CMD_RESTART2, buf); printf("reboot(LINUX_REBOOT_MAGIC1, %#x /* LINUX_REBOOT_MAGIC_??? */," " LINUX_REBOOT_CMD_RESTART2, \"%s\") = %ld %s (%m)\n", INVALID_MAGIC, buf, rc, errno2name()); - rc = syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, \ - LINUX_REBOOT_MAGIC2, INVALID_CMD); + rc = syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, + LINUX_REBOOT_MAGIC2, INVALID_CMD); printf("reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2," " %#x /* LINUX_REBOOT_CMD_??? */) = %ld %s (%m)\n", INVALID_CMD, rc, errno2name()); diff --git a/tests/request_key.c b/tests/request_key.c index fea977b2d..03c7a4294 100644 --- a/tests/request_key.c +++ b/tests/request_key.c @@ -69,8 +69,7 @@ main(void) { static const char unterminated1[] = { '\1', '\2', '\3', '\4', '\5' }; static const char unterminated2[] = { '\6', '\7', '\10', '\11', '\12' }; - static const char unterminated3[] = - { '\16', '\17', '\20', '\21', '\22' }; + static const char unterminated3[] = { '\16', '\17', '\20', '\21', '\22' }; char *bogus_type = tail_memdup(unterminated1, sizeof(unterminated1)); char *bogus_desc = tail_memdup(unterminated2, sizeof(unterminated2)); diff --git a/tests/rt_sigqueueinfo.c b/tests/rt_sigqueueinfo.c index f803d91cb..9681281b9 100644 --- a/tests/rt_sigqueueinfo.c +++ b/tests/rt_sigqueueinfo.c @@ -33,7 +33,7 @@ #include int -main (void) +main(void) { struct sigaction sa = { .sa_handler = SIG_IGN diff --git a/tests/rt_tgsigqueueinfo.c b/tests/rt_tgsigqueueinfo.c index 3b2da2aec..3cff35a6a 100644 --- a/tests/rt_tgsigqueueinfo.c +++ b/tests/rt_tgsigqueueinfo.c @@ -50,7 +50,7 @@ k_tgsigqueueinfo(const pid_t pid, const int sig, const void *const info) } int -main (void) +main(void) { const struct sigaction sa = { .sa_handler = SIG_IGN @@ -65,7 +65,8 @@ main (void) info->si_code = SI_QUEUE; info->si_pid = getpid(); info->si_uid = getuid(); - info->si_value.sival_ptr = (void *) (unsigned long) 0xdeadbeeffacefeedULL; + info->si_value.sival_ptr = + (void *) (unsigned long) 0xdeadbeeffacefeedULL; if (k_tgsigqueueinfo(info->si_pid, SIGUSR1, info)) (errno == ENOSYS ? perror_msg_and_skip : perror_msg_and_fail)( diff --git a/tests/sched_get_priority_mxx.c b/tests/sched_get_priority_mxx.c index fc14b27c6..5224ff130 100644 --- a/tests/sched_get_priority_mxx.c +++ b/tests/sched_get_priority_mxx.c @@ -24,6 +24,6 @@ main(void) #else SKIP_MAIN_UNDEFINED("__NR_sched_get_priority_min" - " && defined __NR_sched_get_priority_max"); + " && defined __NR_sched_get_priority_max"); #endif diff --git a/tests/seccomp-filter-v.c b/tests/seccomp-filter-v.c index fe88ac7b2..f65be7d81 100644 --- a/tests/seccomp-filter-v.c +++ b/tests/seccomp-filter-v.c @@ -146,7 +146,7 @@ main(void) for (i = 0; i < BPF_MAXINSNS; ++i) { if (i) tprintf(", "); - switch(BPF_CLASS(i)) { + switch (BPF_CLASS(i)) { case BPF_LD: tprintf("BPF_STMT(BPF_LD|BPF_W|BPF_IMM, %#x)", i << 16); break; diff --git a/tests/semop.c b/tests/semop.c index 3d1f38462..2366d3859 100644 --- a/tests/semop.c +++ b/tests/semop.c @@ -9,8 +9,7 @@ #include "xlat.h" #include "xlat/semop_flags.h" -union semun -{ +union semun { int val; struct semid_ds *buf; unsigned short *array; diff --git a/tests/sigaction.c b/tests/sigaction.c index 644df794d..7b4694453 100644 --- a/tests/sigaction.c +++ b/tests/sigaction.c @@ -174,7 +174,7 @@ main(void) 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 +# define SA_RESTORER_ARGS , new_act->restorer #else new_act->flags = SA_NODEFER; # define SA_RESTORER_FMT ", sa_flags=SA_NODEFER" diff --git a/tests/signal2name.c b/tests/signal2name.c index e301f4ee4..73e93b20c 100644 --- a/tests/signal2name.c +++ b/tests/signal2name.c @@ -50,6 +50,7 @@ signal2name(int sig) CASE(SIGPWR); CASE(SIGSTKFLT); #endif - default: perror_msg_and_fail("unknown signal number %d", sig); + default: + perror_msg_and_fail("unknown signal number %d", sig); } } diff --git a/tests/signal_receive.c b/tests/signal_receive.c index 1c4293e5f..01c52e8c6 100644 --- a/tests/signal_receive.c +++ b/tests/signal_receive.c @@ -25,7 +25,7 @@ main(void) sigemptyset(&mask); for (sig = 1; sig <= 31; sig++) { - if( sig != SIGKILL && sig != SIGSTOP) { + if (sig != SIGKILL && sig != SIGSTOP) { sigaction(sig, &act, NULL); sigaddset(&mask, sig); } @@ -33,7 +33,7 @@ main(void) sigprocmask(SIG_UNBLOCK, &mask, NULL); for (sig = 1; sig <= 31; sig++) { - if(sig != SIGKILL && sig != SIGSTOP) { + if (sig != SIGKILL && sig != SIGSTOP) { if (kill(pid, sig) != 0) perror_msg_and_fail("kill: %d", sig); sig_print(signal2name(sig), pid, uid); diff --git a/tests/stack-fcall.c b/tests/stack-fcall.c index 134d54f61..fc9ee5f9d 100644 --- a/tests/stack-fcall.c +++ b/tests/stack-fcall.c @@ -1,6 +1,6 @@ int f0(int i); -int main(int argc, char** argv) +int main(int argc, char **argv) { f0(argc); return 0; diff --git a/tests/statx.c b/tests/statx.c index f36fb0e1e..816b7eb1e 100644 --- a/tests/statx.c +++ b/tests/statx.c @@ -49,7 +49,7 @@ static const char *TEST_SYSCALL_STATX_MASK_STR = "STATX_ALL"; # define TEST_SYSCALL_INVOKE(sample, pst) \ syscall(__NR_statx, AT_FDCWD, sample, TEST_SYSCALL_STATX_FLAGS, \ - TEST_SYSCALL_STATX_MASK, pst) + TEST_SYSCALL_STATX_MASK, pst) # define PRINT_SYSCALL_HEADER(sample) \ do { \ int saved_errno = errno; \ diff --git a/tests/times-fail.c b/tests/times-fail.c index cb69bd431..bc8b45950 100644 --- a/tests/times-fail.c +++ b/tests/times-fail.c @@ -5,7 +5,7 @@ #include int -main (void) +main(void) { assert(syscall(__NR_times, 0x42) == -1); printf("times(0x42) = -1 EFAULT (%m)\n"); diff --git a/tests/times.c b/tests/times.c index 2c7b95e58..c4cce0e8b 100644 --- a/tests/times.c +++ b/tests/times.c @@ -49,7 +49,7 @@ enum { }; int -main (void) +main(void) { struct timespec ts; volatile int dummy = 0; diff --git a/tests/unix-pair-sendto-recvfrom.c b/tests/unix-pair-sendto-recvfrom.c index cea382c9e..a0c710ac9 100644 --- a/tests/unix-pair-sendto-recvfrom.c +++ b/tests/unix-pair-sendto-recvfrom.c @@ -71,7 +71,7 @@ main(int ac, char **av) assert(recvfrom(0, av[1], len, MSG_WAITALL, NULL, NULL) == len); assert(close(0) == 0); - int status; + int status; assert(waitpid(pid, &status, 0) == pid); assert(status == 0); } else { diff --git a/tests/waitid.c b/tests/waitid.c index b56feea42..26f5b8692 100644 --- a/tests/waitid.c +++ b/tests/waitid.c @@ -111,7 +111,8 @@ si_code_2_name(const int code) #ifdef CLD_CONTINUED CASE(CLD_CONTINUED); #endif - default: perror_msg_and_fail("unknown si_code %d", code); + default: + perror_msg_and_fail("unknown si_code %d", code); } } diff --git a/tests/xselect.c b/tests/xselect.c index e1638c8c1..6c8cd81ea 100644 --- a/tests/xselect.c +++ b/tests/xselect.c @@ -136,7 +136,7 @@ int main(void) * but with a pointer to a large chunk of valid memory. */ FD_ZERO(set); - FD_SET(fds[1],set); + FD_SET(fds[1], set); assert(syscall(TEST_SYSCALL_NR, -1, NULL, set, NULL, NULL) == -1); printf("%s(-1, NULL, %p, NULL, NULL) = -1 EINVAL (%m)\n", TEST_SYSCALL_STR, set); @@ -145,7 +145,7 @@ int main(void) * Another variant, with nfds exceeding FD_SETSIZE limit. */ FD_ZERO(set); - FD_SET(fds[0],set); + FD_SET(fds[0], set); tv->tv_sec = 0; tv->tv_usec = 123; assert(syscall(TEST_SYSCALL_NR, FD_SETSIZE + 1, set, set + 1, NULL, tv) == 0); diff --git a/time.c b/time.c index 6cba48c83..31f44fc65 100644 --- a/time.c +++ b/time.c @@ -198,15 +198,14 @@ printclockname(int clockid) if ((clockid & CLOCKFD_MASK) == CLOCKFD) tprintf("FD_TO_CLOCKID(%d)", CLOCKID_TO_FD(clockid)); else { - if(CPUCLOCK_PERTHREAD(clockid)) + if (CPUCLOCK_PERTHREAD(clockid)) tprintf("MAKE_THREAD_CPUCLOCK(%d,", CPUCLOCK_PID(clockid)); else tprintf("MAKE_PROCESS_CPUCLOCK(%d,", CPUCLOCK_PID(clockid)); printxval(cpuclocknames, clockid & CLOCKFD_MASK, "CPUCLOCK_???"); tprints(")"); } - } - else + } else #endif printxval(clocknames, clockid, "CLOCK_???"); } diff --git a/uid.c b/uid.c index 80d81ce44..0fb810c8b 100644 --- a/uid.c +++ b/uid.c @@ -34,9 +34,9 @@ # error invalid STRACE_UID_SIZE # endif -# define SIZEIFY(x) SIZEIFY_(x,STRACE_UID_SIZE) -# define SIZEIFY_(x,size) SIZEIFY__(x,size) -# define SIZEIFY__(x,size) x ## size +# define SIZEIFY(x) SIZEIFY_(x, STRACE_UID_SIZE) +# define SIZEIFY_(x, size) SIZEIFY__(x, size) +# define SIZEIFY__(x, size) x ## size # define printuid SIZEIFY(printuid) # define sys_chown SIZEIFY(sys_chown) @@ -159,7 +159,7 @@ printuid(const char *text, const unsigned int uid) static bool print_gid(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data) { - printuid("", (* (uid_t *) elem_buf)); + printuid("", (*(uid_t *) elem_buf)); return true; } diff --git a/unwind.c b/unwind.c index 5b51930c6..5279e6dce 100644 --- a/unwind.c +++ b/unwind.c @@ -81,13 +81,13 @@ typedef void (*error_action_fn)(void *data, * Type used in stacktrace capturing */ struct call_t { - struct call_t* next; - char *output_line; + struct call_t *next; + char *output_line; }; struct queue_t { - struct call_t *tail; - struct call_t *head; + struct call_t *tail; + struct call_t *head; }; static void queue_print(struct queue_t *queue); @@ -140,7 +140,7 @@ unwind_tcb_fin(struct tcb *tcp) * e.g. mmap, mprotect, munmap, execve. */ static void -build_mmap_cache(struct tcb* tcp) +build_mmap_cache(struct tcb *tcp) { FILE *fp; struct mmap_cache_t *cache_head; @@ -261,7 +261,7 @@ rebuild_cache_if_invalid(struct tcb *tcp, const char *caller) } void -unwind_cache_invalidate(struct tcb* tcp) +unwind_cache_invalidate(struct tcb *tcp) { #if SUPPORTED_PERSONALITIES > 1 if (tcp->currpers != DEFAULT_PERSONALITY) { @@ -334,8 +334,7 @@ print_stack_frame(struct tcb *tcp, function_offset, true_offset); return 0; - } - else if (ip < cur_mmap_cache->start_addr) + } else if (ip < cur_mmap_cache->start_addr) upper = mid - 1; else lower = mid + 1; @@ -346,7 +345,7 @@ print_stack_frame(struct tcb *tcp, * after a set_tid_address syscall * unw_get_reg returns IP == 0 */ - if(ip) + if (ip) error_action(data, "unexpected_backtracing_error", ip); return -1; } @@ -453,24 +452,24 @@ sprint_call_or_error(const char *binary_filename, unsigned long true_offset, const char *error) { - char *output_line = NULL; - int n; - - if (symbol_name) - n = asprintf(&output_line, STACK_ENTRY_SYMBOL_FMT); - else if (binary_filename) - n = asprintf(&output_line, STACK_ENTRY_NOSYMBOL_FMT); - else if (error) - n = true_offset - ? asprintf(&output_line, STACK_ENTRY_ERROR_WITH_OFFSET_FMT) - : asprintf(&output_line, STACK_ENTRY_ERROR_FMT); - else - n = asprintf(&output_line, STACK_ENTRY_BUG_FMT, __func__); - - if (n < 0) - error_msg_and_die("error in asprintf"); - - return output_line; + char *output_line = NULL; + int n; + + if (symbol_name) + n = asprintf(&output_line, STACK_ENTRY_SYMBOL_FMT); + else if (binary_filename) + n = asprintf(&output_line, STACK_ENTRY_NOSYMBOL_FMT); + else if (error) + n = true_offset + ? asprintf(&output_line, STACK_ENTRY_ERROR_WITH_OFFSET_FMT) + : asprintf(&output_line, STACK_ENTRY_ERROR_FMT); + else + n = asprintf(&output_line, STACK_ENTRY_BUG_FMT, __func__); + + if (n < 0) + error_msg_and_die("error in asprintf"); + + return output_line; } /* @@ -552,7 +551,7 @@ queue_print(struct queue_t *queue) * printing stack */ void -unwind_print_stacktrace(struct tcb* tcp) +unwind_print_stacktrace(struct tcb *tcp) { #if SUPPORTED_PERSONALITIES > 1 if (tcp->currpers != DEFAULT_PERSONALITY) { @@ -560,14 +559,13 @@ unwind_print_stacktrace(struct tcb* tcp) return; } #endif - if (tcp->queue->head) { - DPRINTF("tcp=%p, queue=%p", "queueprint", tcp, tcp->queue->head); - queue_print(tcp->queue); - } - else if (rebuild_cache_if_invalid(tcp, __func__)) { - DPRINTF("tcp=%p, queue=%p", "stackprint", tcp, tcp->queue->head); - stacktrace_walk(tcp, print_call_cb, print_error_cb, NULL); - } + if (tcp->queue->head) { + DPRINTF("tcp=%p, queue=%p", "queueprint", tcp, tcp->queue->head); + queue_print(tcp->queue); + } else if (rebuild_cache_if_invalid(tcp, __func__)) { + DPRINTF("tcp=%p, queue=%p", "stackprint", tcp, tcp->queue->head); + stacktrace_walk(tcp, print_call_cb, print_error_cb, NULL); + } } /* diff --git a/util.c b/util.c index 5aea68b2e..0167e8819 100644 --- a/util.c +++ b/util.c @@ -164,7 +164,7 @@ int next_set_bit(const void *bit_array, unsigned cur_bit, unsigned size_bits) { const unsigned endian = 1; - int little_endian = * (char *) (void *) &endian; + int little_endian = *(char *) (void *) &endian; const uint8_t *array = bit_array; unsigned pos = cur_bit / 8; @@ -221,10 +221,10 @@ getllval(struct tcb *tcp, unsigned long long *val, int arg_no) arg_no++; } #else /* SIZEOF_KERNEL_LONG_T == 4 */ -# if defined __ARM_EABI__ || \ - defined LINUX_MIPSO32 || \ - defined POWERPC || \ - defined XTENSA +# if defined __ARM_EABI__ \ + || defined LINUX_MIPSO32 \ + || defined POWERPC \ + || defined XTENSA /* Align arg_no to the next even number. */ arg_no = (arg_no + 1) & 0xe; # elif defined SH @@ -899,8 +899,7 @@ dumpstr(struct tcb *const tcp, const kernel_ulong_t addr, const int len) if (i < len) { *dst++ = "0123456789abcdef"[*src >> 4]; *dst++ = "0123456789abcdef"[*src & 0xf]; - } - else { + } else { *dst++ = ' '; *dst++ = ' '; } @@ -987,7 +986,7 @@ umoven(struct tcb *const tcp, kernel_ulong_t addr, unsigned int len, #if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG if (current_wordsize < sizeof(addr) - && (addr & (~ (kernel_ulong_t) -1U))) { + && (addr & (~(kernel_ulong_t) -1U))) { return -1; } #endif @@ -1135,7 +1134,7 @@ umovestr(struct tcb *const tcp, kernel_ulong_t addr, unsigned int len, char *lad #if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG if (current_wordsize < sizeof(addr) - && (addr & (~ (kernel_ulong_t) -1U))) { + && (addr & (~(kernel_ulong_t) -1U))) { return -1; } #endif diff --git a/v4l2.c b/v4l2.c index ad904426f..12750a66b 100644 --- a/v4l2.c +++ b/v4l2.c @@ -207,7 +207,7 @@ print_v4l2_fmtdesc(struct tcb *const tcp, const kernel_ulong_t arg) #include "xlat/v4l2_sliced_flags.h" static bool -print_v4l2_clip(struct tcb *tcp, void *elem_buf, size_t elem_size, void* data) +print_v4l2_clip(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data) { const struct_v4l2_clip *p = elem_buf; tprintf(FMT_RECT, ARGS_RECT(p->c)); diff --git a/wait.c b/wait.c index fc519353b..0f1aa0013 100644 --- a/wait.c +++ b/wait.c @@ -77,14 +77,12 @@ printstatus(int status) signame(sig & 0x7f), sig & 0x80 ? " | 0x80" : ""); status &= ~W_STOPCODE(sig); - } - else if (WIFSIGNALED(status)) { + } else if (WIFSIGNALED(status)) { tprintf("[{WIFSIGNALED(s) && WTERMSIG(s) == %s%s}", signame(WTERMSIG(status)), WCOREDUMP(status) ? " && WCOREDUMP(s)" : ""); status &= ~(W_EXITCODE(0, WTERMSIG(status)) | WCOREFLAG); - } - else if (WIFEXITED(status)) { + } else if (WIFEXITED(status)) { tprintf("[{WIFEXITED(s) && WEXITSTATUS(s) == %d}", WEXITSTATUS(status)); exited = 1; diff --git a/xlat.c b/xlat.c index 95ba1b0be..ad49720dc 100644 --- a/xlat.c +++ b/xlat.c @@ -53,7 +53,7 @@ const char * xlat_search(const struct xlat *xlat, const size_t nmemb, const uint64_t val) { const struct xlat *e = - bsearch((const void*) &val, + bsearch((const void *) &val, xlat, nmemb, sizeof(*xlat), xlat_bsearch_compare); return e ? e->str : NULL; diff --git a/xlat/nl_netfilter_subsys_ids.in b/xlat/nl_netfilter_subsys_ids.in index 50d757e34..3c66eb504 100644 --- a/xlat/nl_netfilter_subsys_ids.in +++ b/xlat/nl_netfilter_subsys_ids.in @@ -1,4 +1,4 @@ -NFNL_SUBSYS_NONE 0 +NFNL_SUBSYS_NONE 0 NFNL_SUBSYS_CTNETLINK 1 NFNL_SUBSYS_CTNETLINK_EXP 2 NFNL_SUBSYS_QUEUE 3 -- cgit v1.2.1