1 /*
2 * Copyright (c) 2016-2021 The strace developers.
3 * All rights reserved.
4 *
5 * SPDX-License-Identifier: LGPL-2.1-or-later
6 */
7
8 #ifndef PTRACE_SET_SYSCALL
9 # define PTRACE_SET_SYSCALL 23
10 #endif
11 /*
12 * PTRACE_SET_SYSCALL is supported by linux kernel
13 * starting with commit v2.6.16-rc1~107^2
14 */
15
16 static int
17 arch_set_scno(struct tcb *tcp, kernel_ulong_t scno)
18 {
19 unsigned int n = (uint16_t) scno;
20 int rc = ptrace(PTRACE_SET_SYSCALL, tcp->pid, NULL, (unsigned long) n);
21 if (rc && errno != ESRCH)
22 perror_msg("arch_set_scno: PTRACE_SET_SYSCALL pid:%d scno:%#x",
23 tcp->pid, n);
24 return rc;
25 }