[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080412.171747.26924099.xiyou.wangcong@gmail.com>
Date: Sat, 12 Apr 2008 17:17:47 +0800 (CST)
From: WANG Cong <xiyou.wangcong@...il.com>
To: linux-kernel@...r.kernel.org
Cc: akpm@...l.org, jdike@...toit.com,
user-mode-linux-devel@...ts.sourceforge.net
Subject: [Patch] arch/um/os-Linux/sys-i386/task_size.c: improve a bit
Improve this code a bit: check sigaction's return value and remove a useless
fflush().
Cc: Jeff Dike <jdike@...toit.com>
Signed-off-by: WANG Cong <wangcong@...ux.org>
---
diff --git a/arch/um/os-Linux/sys-i386/task_size.c b/arch/um/os-Linux/sys-i386/task_size.c
index 48d211b..2b5bba5 100644
--- a/arch/um/os-Linux/sys-i386/task_size.c
+++ b/arch/um/os-Linux/sys-i386/task_size.c
@@ -88,7 +88,10 @@ unsigned long os_get_task_size(void)
sa.sa_handler = segfault;
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_NODEFER;
- sigaction(SIGSEGV, &sa, &old);
+ if (sigaction(SIGSEGV, &sa, &old)) {
+ perror("os_get_task_size");
+ exit(1);
+ }
if (!page_ok(bottom)) {
fprintf(stderr, "Address 0x%x no good?\n",
@@ -110,11 +113,12 @@ unsigned long os_get_task_size(void)
out:
/* Restore the old SIGSEGV handling */
- sigaction(SIGSEGV, &old, NULL);
-
+ if (sigaction(SIGSEGV, &old, NULL)) {
+ perror("os_get_task_size");
+ exit(1);
+ }
top <<= UM_KERN_PAGE_SHIFT;
printf("0x%x\n", top);
- fflush(stdout);
return top;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists