[PATCH] util: check for process_vm_readv in C library

Mike Frysinger vapier at gentoo.org
Tue Feb 14 04:56:48 UTC 2012


glibc-2.15 provides process_vm_readv, so trying to provide this ourselves
with that version fails:
	util.c:797:16: error: static declaration of 'process_vm_readv'
		follows non-static declaration
	/usr/include/bits/uio.h:58:16: note: previous declaration of
		'process_vm_readv' was here

Add a configure check for the func.

Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
 configure.ac |    1 +
 util.c       |    8 +++++++-
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index 789a997..55c7682 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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 b6cdf9a..bd166d2 100644
--- 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))
-- 
1.7.8.4





More information about the Strace-devel mailing list