From 6905f5d2bf65b3158c7d09dc3f7f63773631bcbf Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Wed, 28 Mar 2018 04:29:22 +0000 Subject: [PATCH] Move delay interface from defs.h to delay.h * defs.h (alloc_delay_data, fill_delay_data, is_delay_timer_armed, delay_timer_expired, arm_delay_timer, delay_tcb): Move... * delay.h: ... to new file. * Makefile.am (strace_SOURCES): Add it. * filter_qualify.c: Include it. * strace.c: Likewise. * syscall.c: Likewise. --- Makefile.am | 1 + defs.h | 7 ------- delay.h | 38 ++++++++++++++++++++++++++++++++++++++ filter_qualify.c | 1 + strace.c | 1 + syscall.c | 1 + 6 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 delay.h diff --git a/Makefile.am b/Makefile.am index efd5b351..b961a6dd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -113,6 +113,7 @@ strace_SOURCES = \ count.c \ defs.h \ delay.c \ + delay.h \ desc.c \ dirent.c \ dirent64.c \ diff --git a/defs.h b/defs.h index a173579a..6ec13c7b 100644 --- a/defs.h +++ b/defs.h @@ -1026,13 +1026,6 @@ extern const unsigned int nsyscall_vec[SUPPORTED_PERSONALITIES]; extern const struct_sysent *const sysent_vec[SUPPORTED_PERSONALITIES]; extern struct inject_opts *inject_vec[SUPPORTED_PERSONALITIES]; -uint16_t alloc_delay_data(void); -void fill_delay_data(uint16_t delay_idx, int intval, bool isenter); -bool is_delay_timer_armed(void); -void delay_timer_expired(void); -void arm_delay_timer(const struct tcb *); -void delay_tcb(struct tcb *, uint16_t delay_idx, bool isenter); - #ifdef IN_MPERS_BOOTSTRAP /* Transform multi-line MPERS_PRINTER_DECL statements to one-liners. */ # define MPERS_PRINTER_DECL(type, name, ...) MPERS_PRINTER_DECL(type, name, __VA_ARGS__) diff --git a/delay.h b/delay.h new file mode 100644 index 00000000..f7c2773c --- /dev/null +++ b/delay.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2018 The strace developers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef STRACE_DELAY_H +#define STRACE_DELAY_H + +uint16_t alloc_delay_data(void); +void fill_delay_data(uint16_t delay_idx, int intval, bool isenter); +bool is_delay_timer_armed(void); +void delay_timer_expired(void); +void arm_delay_timer(const struct tcb *); +void delay_tcb(struct tcb *, uint16_t delay_idx, bool isenter); + +#endif /* !STRACE_DELAY_H */ diff --git a/filter_qualify.c b/filter_qualify.c index ebe28f5c..7bcd0765 100644 --- a/filter_qualify.c +++ b/filter_qualify.c @@ -30,6 +30,7 @@ #include "nsig.h" #include "number_set.h" #include "filter.h" +#include "delay.h" #include "retval.h" struct number_set *read_set; diff --git a/strace.c b/strace.c index 1493e9d9..45356459 100644 --- a/strace.c +++ b/strace.c @@ -57,6 +57,7 @@ #include "printsiginfo.h" #include "trace_event.h" #include "xstring.h" +#include "delay.h" /* In some libc, these aren't declared. Do it ourself: */ extern char **environ; diff --git a/syscall.c b/syscall.c index 989aecfe..b49bafb2 100644 --- a/syscall.c +++ b/syscall.c @@ -38,6 +38,7 @@ #include "ptrace.h" #include "nsig.h" #include "number_set.h" +#include "delay.h" #include "retval.h" #include