Skip to content

Commit d3878bb

Browse files
mhiramatrichardweinberger
authored andcommitted
um: Use os_info for the messages on normal path
Use os_info() for printing out the messages on the normal execution path. Signed-off-by: Masami Hiramatsu <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
1 parent f7887ee commit d3878bb

File tree

4 files changed

+28
-27
lines changed

4 files changed

+28
-27
lines changed

arch/um/kernel/um_arch.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,8 @@ int __init linux_main(int argc, char **argv)
289289

290290
diff = UML_ROUND_UP(brk_start) - UML_ROUND_UP(&_end);
291291
if (diff > 1024 * 1024) {
292-
printf("Adding %ld bytes to physical memory to account for "
293-
"exec-shield gap\n", diff);
292+
os_info("Adding %ld bytes to physical memory to account for "
293+
"exec-shield gap\n", diff);
294294
physmem_size += UML_ROUND_UP(brk_start) - UML_ROUND_UP(&_end);
295295
}
296296

@@ -330,8 +330,8 @@ int __init linux_main(int argc, char **argv)
330330
end_vm = start_vm + virtmem_size;
331331

332332
if (virtmem_size < physmem_size)
333-
printf("Kernel virtual memory size shrunk to %lu bytes\n",
334-
virtmem_size);
333+
os_info("Kernel virtual memory size shrunk to %lu bytes\n",
334+
virtmem_size);
335335

336336
os_flush_stdout();
337337

arch/um/os-Linux/main.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,14 +184,13 @@ int __init main(int argc, char **argv, char **envp)
184184
*/
185185
unblock_signals();
186186

187+
os_info("\n");
187188
/* Reboot */
188189
if (ret) {
189-
printf("\n");
190190
execvp(new_argv[0], new_argv);
191191
perror("Failed to exec kernel");
192192
ret = 1;
193193
}
194-
printf("\n");
195194
return uml_exitcode;
196195
}
197196

arch/um/os-Linux/mem.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ static int __init check_tmpfs(const char *dir)
2525
{
2626
struct statfs st;
2727

28-
printf("Checking if %s is on tmpfs...", dir);
28+
os_info("Checking if %s is on tmpfs...", dir);
2929
if (statfs(dir, &st) < 0) {
30-
printf("%s\n", strerror(errno));
30+
os_info("%s\n", strerror(errno));
3131
} else if (st.f_type != TMPFS_MAGIC) {
32-
printf("no\n");
32+
os_info("no\n");
3333
} else {
34-
printf("OK\n");
34+
os_info("OK\n");
3535
return 0;
3636
}
3737
return -1;
@@ -61,18 +61,18 @@ static char * __init choose_tempdir(void)
6161
int i;
6262
const char *dir;
6363

64-
printf("Checking environment variables for a tempdir...");
64+
os_info("Checking environment variables for a tempdir...");
6565
for (i = 0; vars[i]; i++) {
6666
dir = getenv(vars[i]);
6767
if ((dir != NULL) && (*dir != '\0')) {
68-
printf("%s\n", dir);
68+
os_info("%s\n", dir);
6969
if (check_tmpfs(dir) >= 0)
7070
goto done;
7171
else
7272
goto warn;
7373
}
7474
}
75-
printf("none found\n");
75+
os_info("none found\n");
7676

7777
for (i = 0; tmpfs_dirs[i]; i++) {
7878
dir = tmpfs_dirs[i];
@@ -194,7 +194,7 @@ void __init check_tmpexec(void)
194194

195195
addr = mmap(NULL, UM_KERN_PAGE_SIZE,
196196
PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, fd, 0);
197-
printf("Checking PROT_EXEC mmap in %s...", tempdir);
197+
os_info("Checking PROT_EXEC mmap in %s...", tempdir);
198198
if (addr == MAP_FAILED) {
199199
err = errno;
200200
printf("%s\n", strerror(err));
@@ -203,7 +203,7 @@ void __init check_tmpexec(void)
203203
printf("%s must be not mounted noexec\n", tempdir);
204204
exit(1);
205205
}
206-
printf("OK\n");
206+
os_info("OK\n");
207207
munmap(addr, UM_KERN_PAGE_SIZE);
208208

209209
close(fd);

arch/um/os-Linux/start_up.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ static void __init check_sysemu(void)
166166
unsigned long regs[MAX_REG_NR];
167167
int pid, n, status, count=0;
168168

169-
non_fatal("Checking syscall emulation patch for ptrace...");
169+
os_info("Checking syscall emulation patch for ptrace...");
170170
sysemu_supported = 0;
171171
pid = start_ptraced_child();
172172

@@ -199,10 +199,10 @@ static void __init check_sysemu(void)
199199
goto fail_stopped;
200200

201201
sysemu_supported = 1;
202-
non_fatal("OK\n");
202+
os_info("OK\n");
203203
set_using_sysemu(!force_sysemu_disabled);
204204

205-
non_fatal("Checking advanced syscall emulation patch for ptrace...");
205+
os_info("Checking advanced syscall emulation patch for ptrace...");
206206
pid = start_ptraced_child();
207207

208208
if ((ptrace(PTRACE_OLDSETOPTIONS, pid, 0,
@@ -244,7 +244,7 @@ static void __init check_sysemu(void)
244244
goto fail_stopped;
245245

246246
sysemu_supported = 2;
247-
non_fatal("OK\n");
247+
os_info("OK\n");
248248

249249
if (!force_sysemu_disabled)
250250
set_using_sysemu(sysemu_supported);
@@ -260,7 +260,7 @@ static void __init check_ptrace(void)
260260
{
261261
int pid, syscall, n, status;
262262

263-
non_fatal("Checking that ptrace can change system call numbers...");
263+
os_info("Checking that ptrace can change system call numbers...");
264264
pid = start_ptraced_child();
265265

266266
if ((ptrace(PTRACE_OLDSETOPTIONS, pid, 0,
@@ -292,7 +292,7 @@ static void __init check_ptrace(void)
292292
}
293293
}
294294
stop_ptraced_child(pid, 0, 1);
295-
non_fatal("OK\n");
295+
os_info("OK\n");
296296
check_sysemu();
297297
}
298298

@@ -308,15 +308,17 @@ static void __init check_coredump_limit(void)
308308
return;
309309
}
310310

311-
printf("Core dump limits :\n\tsoft - ");
311+
os_info("Core dump limits :\n\tsoft - ");
312312
if (lim.rlim_cur == RLIM_INFINITY)
313-
printf("NONE\n");
314-
else printf("%lu\n", lim.rlim_cur);
313+
os_info("NONE\n");
314+
else
315+
os_info("%llu\n", (unsigned long long)lim.rlim_cur);
315316

316-
printf("\thard - ");
317+
os_info("\thard - ");
317318
if (lim.rlim_max == RLIM_INFINITY)
318-
printf("NONE\n");
319-
else printf("%lu\n", lim.rlim_max);
319+
os_info("NONE\n");
320+
else
321+
os_info("%llu\n", (unsigned long long)lim.rlim_max);
320322
}
321323

322324
void __init os_early_checks(void)

0 commit comments

Comments
 (0)