Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d3878bb8 authored by Masami Hiramatsu's avatar Masami Hiramatsu Committed by Richard Weinberger
Browse files

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: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent f7887ee1
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -289,7 +289,7 @@ int __init linux_main(int argc, char **argv)

	diff = UML_ROUND_UP(brk_start) - UML_ROUND_UP(&_end);
	if (diff > 1024 * 1024) {
		printf("Adding %ld bytes to physical memory to account for "
		os_info("Adding %ld bytes to physical memory to account for "
			"exec-shield gap\n", diff);
		physmem_size += UML_ROUND_UP(brk_start) - UML_ROUND_UP(&_end);
	}
@@ -330,7 +330,7 @@ int __init linux_main(int argc, char **argv)
	end_vm = start_vm + virtmem_size;

	if (virtmem_size < physmem_size)
		printf("Kernel virtual memory size shrunk to %lu bytes\n",
		os_info("Kernel virtual memory size shrunk to %lu bytes\n",
			virtmem_size);

	os_flush_stdout();
+1 −2
Original line number Diff line number Diff line
@@ -184,14 +184,13 @@ int __init main(int argc, char **argv, char **envp)
	 */
	unblock_signals();

	os_info("\n");
	/* Reboot */
	if (ret) {
		printf("\n");
		execvp(new_argv[0], new_argv);
		perror("Failed to exec kernel");
		ret = 1;
	}
	printf("\n");
	return uml_exitcode;
}

+9 −9
Original line number Diff line number Diff line
@@ -25,13 +25,13 @@ static int __init check_tmpfs(const char *dir)
{
	struct statfs st;

	printf("Checking if %s is on tmpfs...", dir);
	os_info("Checking if %s is on tmpfs...", dir);
	if (statfs(dir, &st) < 0) {
		printf("%s\n", strerror(errno));
		os_info("%s\n", strerror(errno));
	} else if (st.f_type != TMPFS_MAGIC) {
		printf("no\n");
		os_info("no\n");
	} else {
		printf("OK\n");
		os_info("OK\n");
		return 0;
	}
	return -1;
@@ -61,18 +61,18 @@ static char * __init choose_tempdir(void)
	int i;
	const char *dir;

	printf("Checking environment variables for a tempdir...");
	os_info("Checking environment variables for a tempdir...");
	for (i = 0; vars[i]; i++) {
		dir = getenv(vars[i]);
		if ((dir != NULL) && (*dir != '\0')) {
			printf("%s\n", dir);
			os_info("%s\n", dir);
			if (check_tmpfs(dir) >= 0)
				goto done;
			else
				goto warn;
		}
	}
	printf("none found\n");
	os_info("none found\n");

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

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

	close(fd);
+14 −12
Original line number Diff line number Diff line
@@ -166,7 +166,7 @@ static void __init check_sysemu(void)
	unsigned long regs[MAX_REG_NR];
	int pid, n, status, count=0;

	non_fatal("Checking syscall emulation patch for ptrace...");
	os_info("Checking syscall emulation patch for ptrace...");
	sysemu_supported = 0;
	pid = start_ptraced_child();

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

	sysemu_supported = 1;
	non_fatal("OK\n");
	os_info("OK\n");
	set_using_sysemu(!force_sysemu_disabled);

	non_fatal("Checking advanced syscall emulation patch for ptrace...");
	os_info("Checking advanced syscall emulation patch for ptrace...");
	pid = start_ptraced_child();

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

	sysemu_supported = 2;
	non_fatal("OK\n");
	os_info("OK\n");

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

	non_fatal("Checking that ptrace can change system call numbers...");
	os_info("Checking that ptrace can change system call numbers...");
	pid = start_ptraced_child();

	if ((ptrace(PTRACE_OLDSETOPTIONS, pid, 0,
@@ -292,7 +292,7 @@ static void __init check_ptrace(void)
		}
	}
	stop_ptraced_child(pid, 0, 1);
	non_fatal("OK\n");
	os_info("OK\n");
	check_sysemu();
}

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

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

	printf("\thard - ");
	os_info("\thard - ");
	if (lim.rlim_max == RLIM_INFINITY)
		printf("NONE\n");
	else printf("%lu\n", lim.rlim_max);
		os_info("NONE\n");
	else
		os_info("%llu\n", (unsigned long long)lim.rlim_max);
}

void __init os_early_checks(void)