* defs.h: Remove ptrace_restart() declaration.
* strace.c (ptrace_restart): Move its definition here.
* util.c (ptrace_restart): Remove its definition.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
extern void set_sortby(const char *);
extern void set_overhead(int);
extern void qualify(const char *);
-extern int ptrace_restart(int request, struct tcb *tcp, int sig);
extern int trace_syscall(struct tcb *);
extern void count_syscall(struct tcb *, struct timeval *);
extern void printxval(const struct xlat *, int, const char *);
# define ptrace_attach_or_seize(pid) ptrace(PTRACE_ATTACH, (pid), 0, 0)
#endif
+/*
+ * Used when we want to unblock stopped traced process.
+ * Should be only used with PTRACE_CONT, PTRACE_DETACH and PTRACE_SYSCALL.
+ * Returns 0 on success or if error was ESRCH
+ * (presumably process was killed while we talk to it).
+ * Otherwise prints error message and returns -1.
+ */
+static int
+ptrace_restart(int op, struct tcb *tcp, int sig)
+{
+ int err;
+ const char *msg;
+
+ errno = 0;
+ ptrace(op, tcp->pid, (void *) 0, (long) sig);
+ err = errno;
+ if (!err || err == ESRCH)
+ return 0;
+
+ tcp->ptrace_errno = err;
+ msg = "SYSCALL";
+ if (op == PTRACE_CONT)
+ msg = "CONT";
+ if (op == PTRACE_DETACH)
+ msg = "DETACH";
+#ifdef PTRACE_LISTEN
+ if (op == PTRACE_LISTEN)
+ msg = "LISTEN";
+#endif
+ perror_msg("ptrace(PTRACE_%s,pid:%d,sig:%d)", msg, tcp->pid, sig);
+ return -1;
+}
+
static void
set_cloexec_flag(int fd)
{
}
#endif
-/*
- * Used when we want to unblock stopped traced process.
- * Should be only used with PTRACE_CONT, PTRACE_DETACH and PTRACE_SYSCALL.
- * Returns 0 on success or if error was ESRCH
- * (presumably process was killed while we talk to it).
- * Otherwise prints error message and returns -1.
- */
-int
-ptrace_restart(int op, struct tcb *tcp, int sig)
-{
- int err;
- const char *msg;
-
- errno = 0;
- ptrace(op, tcp->pid, (void *) 0, (long) sig);
- err = errno;
- if (!err || err == ESRCH)
- return 0;
-
- tcp->ptrace_errno = err;
- msg = "SYSCALL";
- if (op == PTRACE_CONT)
- msg = "CONT";
- if (op == PTRACE_DETACH)
- msg = "DETACH";
-#ifdef PTRACE_LISTEN
- if (op == PTRACE_LISTEN)
- msg = "LISTEN";
-#endif
- perror_msg("ptrace(PTRACE_%s,pid:%d,sig:%d)", msg, tcp->pid, sig);
- return -1;
-}
-
/*
* Print entry in struct xlat table, if there.
*/