aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/os-Linux/mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/os-Linux/mem.c')
-rw-r--r--arch/um/os-Linux/mem.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c
index 4203681e508d..f1ea169db85e 100644
--- a/arch/um/os-Linux/mem.c
+++ b/arch/um/os-Linux/mem.c
@@ -20,7 +20,13 @@
20 20
21#include <sys/param.h> 21#include <sys/param.h>
22 22
23/* Modified by which_tmpdir, which is called during early boot */
23static char *default_tmpdir = "/tmp"; 24static char *default_tmpdir = "/tmp";
25
26/*
27 * Modified when creating the physical memory file and when checking
28 * the tmp filesystem for usability, both happening during early boot.
29 */
24static char *tempdir = NULL; 30static char *tempdir = NULL;
25 31
26static void __init find_tempdir(void) 32static void __init find_tempdir(void)
@@ -29,7 +35,8 @@ static void __init find_tempdir(void)
29 int i; 35 int i;
30 char *dir = NULL; 36 char *dir = NULL;
31 37
32 if(tempdir != NULL) return; /* We've already been called */ 38 if(tempdir != NULL) /* We've already been called */
39 return;
33 for(i = 0; dirs[i]; i++){ 40 for(i = 0; dirs[i]; i++){
34 dir = getenv(dirs[i]); 41 dir = getenv(dirs[i]);
35 if((dir != NULL) && (*dir != '\0')) 42 if((dir != NULL) && (*dir != '\0'))
@@ -83,6 +90,7 @@ static int next(int fd, char *buf, int size, char c)
83 return 1; 90 return 1;
84} 91}
85 92
93/* which_tmpdir is called only during early boot */
86static int checked_tmpdir = 0; 94static int checked_tmpdir = 0;
87 95
88/* Look for a tmpfs mounted at /dev/shm. I couldn't find a cleaner 96/* Look for a tmpfs mounted at /dev/shm. I couldn't find a cleaner
@@ -186,7 +194,7 @@ int make_tempfile(const char *template, char **out_tempname, int do_unlink)
186 } else { 194 } else {
187 free(tempname); 195 free(tempname);
188 } 196 }
189 return(fd); 197 return fd;
190out: 198out:
191 free(tempname); 199 free(tempname);
192 return -1; 200 return -1;
@@ -231,7 +239,7 @@ int create_tmp_file(unsigned long long len)
231 exit(1); 239 exit(1);
232 } 240 }
233 241
234 return(fd); 242 return fd;
235} 243}
236 244
237int create_mem_file(unsigned long long len) 245int create_mem_file(unsigned long long len)
@@ -245,7 +253,7 @@ int create_mem_file(unsigned long long len)
245 errno = -err; 253 errno = -err;
246 perror("exec_close"); 254 perror("exec_close");
247 } 255 }
248 return(fd); 256 return fd;
249} 257}
250 258
251 259