From: Dmitry V. Levin Date: Thu, 15 Aug 2019 20:23:19 +0000 (+0000) Subject: Use perror_func_msg instead of perror_msg where appropriate X-Git-Tag: v5.3~43 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a8dc094bd432a28df6b0418b7140b2467bc078bf;p=strace Use perror_func_msg instead of perror_msg where appropriate * linux/aarch64/set_scno.c (arch_set_scno): Use perror_func_msg instead of perror_msg. * ucopy.c (umoven_peekdata, umoven, umovestr_peekdata, umovestr): Likewise. * upeek.c (upeek): Likewise. * upoke.c (upoke): Likewise. --- diff --git a/linux/aarch64/set_scno.c b/linux/aarch64/set_scno.c index e2b5d8a2..9dbf3275 100644 --- a/linux/aarch64/set_scno.c +++ b/linux/aarch64/set_scno.c @@ -23,7 +23,7 @@ arch_set_scno(struct tcb *tcp, kernel_ulong_t scno) }; int rc = ptrace(PTRACE_SETREGSET, tcp->pid, NT_ARM_SYSTEM_CALL, &io); if (rc && errno != ESRCH) - perror_msg("arch_set_scno: NT_ARM_SYSTEM_CALL pid:%d scno:%#x", - tcp->pid, n); + perror_func_msg("NT_ARM_SYSTEM_CALL pid:%d scno:%#x", + tcp->pid, n); return rc; } diff --git a/ucopy.c b/ucopy.c index b335c229..fa1bcd49 100644 --- a/ucopy.c +++ b/ucopy.c @@ -106,14 +106,16 @@ umoven_peekdata(const int pid, kernel_ulong_t addr, unsigned int len, case EFAULT: case EIO: case EPERM: /* address space is inaccessible */ if (nread) { - perror_msg("umoven: short read (%u < %u) @0x%" PRI_klx, - nread, nread + len, addr - nread); + perror_func_msg("short read (%u < %u)" + " @0x%" PRI_klx, + nread, nread + len, + addr - nread); } return -1; default: /* all the rest is strange and should be reported */ - perror_msg("umoven: PTRACE_PEEKDATA pid:%d @0x%" PRI_klx, - pid, addr); + perror_func_msg("pid:%d @0x%" PRI_klx, + pid, addr); return -1; } @@ -166,8 +168,7 @@ umoven(struct tcb *const tcp, kernel_ulong_t addr, unsigned int len, return -1; default: /* all the rest is strange and should be reported */ - perror_msg("process_vm_readv: pid:%d @0x%" PRI_klx, - pid, addr); + perror_func_msg("pid:%d @0x%" PRI_klx, pid, addr); return -1; } } @@ -202,14 +203,16 @@ umovestr_peekdata(const int pid, kernel_ulong_t addr, unsigned int len, case EFAULT: case EIO: case EPERM: /* address space is inaccessible */ if (nread) { - perror_msg("umovestr: short read (%d < %d) @0x%" PRI_klx, - nread, nread + len, addr - nread); + perror_func_msg("short read (%d < %d)" + " @0x%" PRI_klx, + nread, nread + len, + addr - nread); } return -1; default: /* all the rest is strange and should be reported */ - perror_msg("umovestr: PTRACE_PEEKDATA pid:%d @0x%" PRI_klx, - pid, addr); + perror_func_msg("pid:%d @0x%" PRI_klx, + pid, addr); return -1; } @@ -289,16 +292,17 @@ umovestr(struct tcb *const tcp, kernel_ulong_t addr, unsigned int len, case EFAULT: case EIO: /* address space is inaccessible */ if (nread) - perror_msg("umovestr: short read (%d < %d) @0x%" PRI_klx, - nread, nread + len, addr - nread); + perror_func_msg("short read (%d < %d)" + " @0x%" PRI_klx, + nread, nread + len, + addr - nread); return -1; case ESRCH: /* the process is gone */ return -1; default: /* all the rest is strange and should be reported */ - perror_msg("process_vm_readv: pid:%d @0x%" PRI_klx, - pid, addr); + perror_func_msg("pid:%d @0x%" PRI_klx, pid, addr); return -1; } } diff --git a/upeek.c b/upeek.c index 0618f270..147006cd 100644 --- a/upeek.c +++ b/upeek.c @@ -23,10 +23,9 @@ upeek(struct tcb *tcp, unsigned long off, kernel_ulong_t *res) errno = 0; val = ptrace(PTRACE_PEEKUSER, (pid_t) tcp->pid, (void *) off, 0); if (val == -1 && errno) { - if (errno != ESRCH) { - perror_msg("upeek: PTRACE_PEEKUSER pid:%d @0x%lx)", - tcp->pid, off); - } + if (errno != ESRCH) + perror_func_msg("PTRACE_PEEKUSER pid:%d @0x%lx)", + tcp->pid, off); return -1; } *res = (unsigned long) val; diff --git a/upoke.c b/upoke.c index ae532e48..0c2d2903 100644 --- a/upoke.c +++ b/upoke.c @@ -15,8 +15,8 @@ upoke(struct tcb *tcp, unsigned long off, kernel_ulong_t val) { if (ptrace_pokeuser(tcp->pid, off, val) < 0) { if (errno != ESRCH) - perror_msg("upoke: PTRACE_POKEUSER pid:%d @%#lx)", - tcp->pid, off); + perror_func_msg("PTRACE_POKEUSER pid:%d @%#lx)", + tcp->pid, off); return -1; } return 0;