[CRIU] [PATCH 2/5] zdtm: transition/ptrace: use the ptrace call PTRACE_GETREGSET instead of PTRACE_GETREGS

Alexander Kartashov alekskartashov at parallels.com
Tue Feb 4 22:14:37 PST 2014


Signed-off-by: Alexander Kartashov <alekskartashov at parallels.com>
Cc: Pavel Emelianov <xemul at parallels.com>
---
 test/zdtm/live/transition/ptrace.c |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/test/zdtm/live/transition/ptrace.c b/test/zdtm/live/transition/ptrace.c
index 51d15df..e6188cf 100644
--- a/test/zdtm/live/transition/ptrace.c
+++ b/test/zdtm/live/transition/ptrace.c
@@ -9,6 +9,9 @@
 #include <sys/mman.h>
 #include <sys/types.h>
 #include <sys/syscall.h>
+/* for struct iovec */
+#include <sys/uio.h>
+#include <linux/elf.h>
 
 #include "zdtmtst.h"
 
@@ -27,6 +30,13 @@ static void *thread(void *arg)
 	return NULL;
 }
 
+
+#ifndef PTRACE_GETREGSET
+# define PTRACE_GETREGSET      0x4204
+# define PTRACE_SETREGSET      0x4205
+#endif
+
+
 int main(int argc, char **argv)
 {
 	int pid, status, i, stopped;
@@ -94,7 +104,12 @@ out_th:
 		}
 
 		if (WIFSTOPPED(status)) {
-			if (ptrace(PTRACE_GETREGS, stopped, NULL, regs)) {
+			struct iovec regv;
+
+			regv.iov_base = regs;
+			regv.iov_len = sizeof(regs);
+
+			if (ptrace(PTRACE_GETREGSET, stopped, NT_PRSTATUS, &regv)) {
 				/* FAIL */
 				fail("Ptrace won't work");
 				break;
-- 
1.7.9.5



More information about the CRIU mailing list