Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1633290
| From | Masami Hiramatsu <mhiramat@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC PATCH 5/7] um: Print out fatal error in stderr |
| Date | 2017-04-29 13:30 +0200 |
| Message-ID | <tByJz-5CJ-1@gated-at.bofh.it> (permalink) |
| References | <tBbjX-614-7@gated-at.bofh.it> <tBbjY-614-27@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, 28 Apr 2017 19:25:39 +0900
Masami Hiramatsu <mhiramat@kernel.org> wrote:
> Print out fatal error in stderr as same as fatal() does.
>
> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> ---
> arch/um/kernel/physmem.c | 8 ++++----
> arch/um/kernel/um_arch.c | 2 +-
> arch/um/os-Linux/main.c | 4 ++--
> 3 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c
> index 4c9861b..7f95329 100644
> --- a/arch/um/kernel/physmem.c
> +++ b/arch/um/kernel/physmem.c
> @@ -89,8 +89,8 @@ void __init setup_physmem(unsigned long start, unsigned long reserve_end,
> offset = uml_reserved - uml_physmem;
> map_size = len - offset;
> if(map_size <= 0) {
> - printf("Too few physical memory! Needed=%d, given=%d\n",
> - offset, len);
> + fprintf(stderr, "Too few physical memory! Needed=%d, "
> + "given=%d\n", offset, len);
Oops, I've missed to include something for using fprintf here.
Anyway, I think we need something like um_fatal() for handling
these errors.
I'll resend v2.
Thanks,
> exit(1);
> }
>
> @@ -99,8 +99,8 @@ void __init setup_physmem(unsigned long start, unsigned long reserve_end,
> err = os_map_memory((void *) uml_reserved, physmem_fd, offset,
> map_size, 1, 1, 1);
> if (err < 0) {
> - printf("setup_physmem - mapping %ld bytes of memory at 0x%p "
> - "failed - errno = %d\n", map_size,
> + fprintf(stderr, "setup_physmem - mapping %ld bytes of memory "
> + "at 0x%p failed - errno = %d\n", map_size,
> (void *) uml_reserved, err);
> exit(1);
> }
> diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
> index b3b28db..01817d6 100644
> --- a/arch/um/kernel/um_arch.c
> +++ b/arch/um/kernel/um_arch.c
> @@ -34,7 +34,7 @@ static char __initdata command_line[COMMAND_LINE_SIZE] = { 0 };
> static void __init add_arg(char *arg)
> {
> if (strlen(command_line) + strlen(arg) + 1 > COMMAND_LINE_SIZE) {
> - printf("add_arg: Too many command line arguments!\n");
> + fprintf(stderr, "add_arg: Too many command line arguments!\n");
> exit(1);
> }
> if (strlen(command_line) > 0)
> diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c
> index 659fee3..09b44f1 100644
> --- a/arch/um/os-Linux/main.c
> +++ b/arch/um/os-Linux/main.c
> @@ -74,8 +74,8 @@ static void install_fatal_handler(int sig)
> action.sa_restorer = NULL;
> action.sa_handler = last_ditch_exit;
> if (sigaction(sig, &action, NULL) < 0) {
> - printf("failed to install handler for signal %d - errno = %d\n",
> - sig, errno);
> + fprintf(stderr, "failed to install handler for signal %d "
> + "- errno = %d\n", sig, errno);
> exit(1);
> }
> }
>
--
Masami Hiramatsu <mhiramat@kernel.org>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC PATCH 0/7] um: Fix printf usage and support quiet option Masami Hiramatsu <mhiramat@kernel.org> - 2017-04-28 12:30 +0200
[RFC PATCH 3/7] um: Make non_fatal non-static for other files Masami Hiramatsu <mhiramat@kernel.org> - 2017-04-28 12:30 +0200
[RFC PATCH 2/7] um: Use non_fatal() in check_coredump_limit Masami Hiramatsu <mhiramat@kernel.org> - 2017-04-28 12:30 +0200
[RFC PATCH 5/7] um: Print out fatal error in stderr Masami Hiramatsu <mhiramat@kernel.org> - 2017-04-28 12:30 +0200
Re: [RFC PATCH 5/7] um: Print out fatal error in stderr Masami Hiramatsu <mhiramat@kernel.org> - 2017-04-29 13:30 +0200
[RFC PATCH 1/7] um: Use printk instead of printf in make_uml_dir Masami Hiramatsu <mhiramat@kernel.org> - 2017-04-28 12:30 +0200
[RFC PATCH 4/7] um: Use non_fatal() for non-fatal information/warning messages Masami Hiramatsu <mhiramat@kernel.org> - 2017-04-28 12:30 +0200
csiph-web