]> granicus.if.org Git - strace/commitdiff
util: check for process_vm_readv in C library
authorMike Frysinger <vapier@gentoo.org>
Tue, 14 Feb 2012 13:38:28 +0000 (14:38 +0100)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 14 Feb 2012 13:38:28 +0000 (13:38 +0000)
glibc-2.15 provides process_vm_readv, so trying to provide it ourselves
with that version fails.

* configure.ac (AC_CHECK_FUNCS): Add process_vm_readv.
* util.c: Handle HAVE_PROCESS_VM_READV.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
configure.ac
util.c

index 789a997dde4ceff621101c922df00abe21be6b16..55c7682ef8d1973187feace6ef4f0c69dde455e2 100644 (file)
@@ -236,6 +236,7 @@ AC_CHECK_FUNCS([ \
        sys_siglist \
        _sys_siglist \
        stpcpy \
+       process_vm_readv \
 ])
 AC_CHECK_HEADERS([ \
        inttypes.h \
diff --git a/util.c b/util.c
index b6cdf9a5d211965ace2b9a7772b0c368d050fd05..bd166d2dd07c39aa4608a64689d393e7ebe71890 100644 (file)
--- a/util.c
+++ b/util.c
@@ -776,6 +776,11 @@ dumpstr(struct tcb *tcp, long addr, int len)
 }
 
 
+#ifdef HAVE_PROCESS_VM_READV
+/* C library supports this, but the kernel might not. */
+static bool process_vm_readv_not_supported = 0;
+#else
+
 /* Need to do this since process_vm_readv() is not yet available in libc.
  * When libc is be updated, only "static bool process_vm_readv_not_supported"
  * line should remain.
@@ -805,7 +810,8 @@ static ssize_t process_vm_readv(pid_t pid,
 static bool process_vm_readv_not_supported = 1;
 # define process_vm_readv(...) (errno = ENOSYS, -1)
 #endif
-/* end of hack */
+
+#endif /* end of hack */
 
 
 #define PAGMASK        (~(PAGSIZ - 1))