Android: change tmpdir to /data/tmp

Submitted by Zhang, Ning A on April 16, 2019, 2:43 a.m.

Details

Message ID 20190416024359.6718-1-ning.a.zhang@intel.com
State New
Series "Android: change tmpdir to /data/tmp"
Headers show

Commit Message

Zhang, Ning A April 16, 2019, 2:43 a.m.
From: Zhang Ning <ning.a.zhang@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@intel.com>
Signed-off-by: Zhang Ning <ning.a.zhang@intel.com>
---
 criu/cr-check.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

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();

Comments

Zhang, Ning A April 18, 2019, 9 a.m.
there may be some other issue when choose /data/tmp/ as Android tmpdir.

please on hold for this patch.


在 2019-04-16二的 10:43 +0800,ning.a.zhang@intel.com写道:
> From: Zhang Ning <ning.a.zhang@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@intel.com>
> Signed-off-by: Zhang Ning <ning.a.zhang@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();