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.
This commit is contained in:
Дмитрий Левин 2018-03-28 04:29:22 +00:00
parent 33c725f817
commit 6905f5d2bf
6 changed files with 42 additions and 7 deletions

View File

@ -113,6 +113,7 @@ strace_SOURCES = \
count.c \
defs.h \
delay.c \
delay.h \
desc.c \
dirent.c \
dirent64.c \

7
defs.h
View File

@ -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__)

38
delay.h Normal file
View File

@ -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 */

View File

@ -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;

View File

@ -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;

View File

@ -38,6 +38,7 @@
#include "ptrace.h"
#include "nsig.h"
#include "number_set.h"
#include "delay.h"
#include "retval.h"
#include <limits.h>