[CRIU] [PATCH] Android: change tmpdir to /data/tmp

ning.a.zhang at intel.com ning.a.zhang at intel.com
Tue Apr 16 05:43:59 MSK 2019


From: Zhang Ning <ning.a.zhang at intel.com>

due to Android OS doesn't have /tmp, and its
rootfs is readonly, so change tmpdir to /data/tmp

Cc: Chen Hu <hu1.chen at intel.com>
Signed-off-by: Zhang Ning <ning.a.zhang at intel.com>
---
 criu/cr-check.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/criu/cr-check.c b/criu/cr-check.c
index 7addb9fb..bf3ec306 100644
--- a/criu/cr-check.c
+++ b/criu/cr-check.c
@@ -828,10 +828,20 @@ static int check_autofs_pipe_ino(void)
 	fclose(f);
 	return ret;
 }
+/*
+for Android, there is no /tmp, and rootfs is readonly,
+so in order to run in Android, has to find another place for tmpdir.
+data partition is a good place.
+*/
+#ifdef __ANDROID__
+#define CR_TMPDIR "/data/tmp"
+#else
+#define CR_TMPDIR "/tmp"
+#endif
 
 static int check_autofs(void)
 {
-	char *dir, *options, template[] = "/tmp/.criu.mnt.XXXXXX";
+	char *dir, *options, template[] = CR_TMPDIR"/.criu.mnt.XXXXXX";
 	int ret, pfd[2];
 
 	ret = check_autofs_pipe_ino();
-- 
2.20.1



More information about the CRIU mailing list