[CRIU] [PATCH 2/4] restorer: remove always true `has_futex' arg

Dmitry Safonov dsafonov at virtuozzo.com
Wed May 3 12:40:13 PDT 2017


Check for presence of robust futex list is in the reality
(futex_rla_len != 0).

That does code on dumping, in get_task_futex_robust_list():
> ret = syscall(SYS_get_robust_list, pid, &head, &len);
> if (ret < 0 && errno == ENOSYS) {
[..]
> 	len = 0;
[..]
> }
[..]
> info->futex_rla_len	= (u32)len;

And in images: futex_rla_len == 0 means that futex is not present.

So, we don't need additional restorer's parameter `has_futex'
which is always true, remove it.

Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 criu/cr-restore.c       | 1 -
 criu/include/restorer.h | 1 -
 criu/pie/restorer.c     | 2 +-
 3 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index bcc00fa123e6..173e52a55077 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -3301,7 +3301,6 @@ static int sigreturn_restore(pid_t pid, struct task_restore_args *task_args, uns
 
 		rst_reloc_creds(&thread_args[i], &creds_pos_next);
 
-		thread_args[i].has_futex	= true;
 		thread_args[i].futex_rla	= tcore->thread_core->futex_rla;
 		thread_args[i].futex_rla_len	= tcore->thread_core->futex_rla_len;
 		thread_args[i].pdeath_sig	= tcore->thread_core->pdeath_sig;
diff --git a/criu/include/restorer.h b/criu/include/restorer.h
index 65e0eb515bc9..454181e36003 100644
--- a/criu/include/restorer.h
+++ b/criu/include/restorer.h
@@ -82,7 +82,6 @@ struct thread_restore_args {
 	UserRegsEntry			gpregs;
 	u64				clear_tid_addr;
 
-	bool				has_futex;
 	u64				futex_rla;
 	u32				futex_rla_len;
 
diff --git a/criu/pie/restorer.c b/criu/pie/restorer.c
index 030c7ff42a03..0e1fc6a6a7a0 100644
--- a/criu/pie/restorer.c
+++ b/criu/pie/restorer.c
@@ -438,7 +438,7 @@ static int restore_thread_common(struct thread_restore_args *args)
 {
 	sys_set_tid_address((int *)decode_pointer(args->clear_tid_addr));
 
-	if (args->has_futex && args->futex_rla_len) {
+	if (args->futex_rla_len) {
 		int ret;
 
 		ret = sys_set_robust_list(decode_pointer(args->futex_rla),
-- 
2.12.2



More information about the CRIU mailing list