* [Patch] arch/um/os-Linux/sys-i386/task_size.c: improve a bit
@ 2008-04-12 9:17 ` WANG Cong
0 siblings, 0 replies; 4+ messages in thread
From: WANG Cong @ 2008-04-12 9:17 UTC (permalink / raw
To: linux-kernel; +Cc: akpm, jdike, user-mode-linux-devel
Improve this code a bit: check sigaction's return value and remove a useless
fflush().
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: WANG Cong <wangcong@zeuux.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;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [uml-devel] [Patch] arch/um/os-Linux/sys-i386/task_size.c: improve a bit
@ 2008-04-12 9:17 ` WANG Cong
0 siblings, 0 replies; 4+ messages in thread
From: WANG Cong @ 2008-04-12 9:17 UTC (permalink / raw
To: linux-kernel; +Cc: akpm, jdike, user-mode-linux-devel
Improve this code a bit: check sigaction's return value and remove a useless
fflush().
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: WANG Cong <wangcong@zeuux.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;
}
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Patch] arch/um/os-Linux/sys-i386/task_size.c: improve a bit
2008-04-12 9:17 ` [uml-devel] " WANG Cong
@ 2008-04-14 14:59 ` Jeff Dike
-1 siblings, 0 replies; 4+ messages in thread
From: Jeff Dike @ 2008-04-14 14:59 UTC (permalink / raw
To: WANG Cong; +Cc: linux-kernel, akpm, user-mode-linux-devel
On Sat, Apr 12, 2008 at 05:17:47PM +0800, WANG Cong wrote:
> Improve this code a bit: check sigaction's return value and remove a useless
> fflush().
This looks fine. BTW, some of the fflushing is on purpose, although
the one you removed does indeed look useless. I want all output from
early boot to hit the screen as soon as possible, even in the absence
(so far) of a newline. So, if there's any doubt about whether a
printf has a newline in it, it's flushed.
Jeff
--
Work email - jdike at linux dot intel dot com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [uml-devel] [Patch] arch/um/os-Linux/sys-i386/task_size.c: improve a bit
@ 2008-04-14 14:59 ` Jeff Dike
0 siblings, 0 replies; 4+ messages in thread
From: Jeff Dike @ 2008-04-14 14:59 UTC (permalink / raw
To: WANG Cong; +Cc: akpm, linux-kernel, user-mode-linux-devel
On Sat, Apr 12, 2008 at 05:17:47PM +0800, WANG Cong wrote:
> Improve this code a bit: check sigaction's return value and remove a useless
> fflush().
This looks fine. BTW, some of the fflushing is on purpose, although
the one you removed does indeed look useless. I want all output from
early boot to hit the screen as soon as possible, even in the absence
(so far) of a newline. So, if there's any doubt about whether a
printf has a newline in it, it's flushed.
Jeff
--
Work email - jdike at linux dot intel dot com
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-04-14 15:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-12 9:17 [Patch] arch/um/os-Linux/sys-i386/task_size.c: improve a bit WANG Cong
2008-04-12 9:17 ` [uml-devel] " WANG Cong
2008-04-14 14:59 ` Jeff Dike
2008-04-14 14:59 ` [uml-devel] " Jeff Dike
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.