projects
/
pintos-anon
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
634487e
)
Eliminate race condition in console_print_stats() found by Sorav's
author
Ben Pfaff
<blp@cs.stanford.edu>
Wed, 20 Jul 2005 04:44:55 +0000
(
04:44
+0000)
committer
Ben Pfaff
<blp@cs.stanford.edu>
Wed, 20 Jul 2005 04:44:55 +0000
(
04:44
+0000)
Checkbochs tool.
src/lib/kernel/console.c
patch
|
blob
|
history
diff --git
a/src/lib/kernel/console.c
b/src/lib/kernel/console.c
index 53e08a0532acca1fd745136d29b217a501665204..176dd0688dc5717919b06e59d4a784f0d24c1f64 100644
(file)
--- a/
src/lib/kernel/console.c
+++ b/
src/lib/kernel/console.c
@@
-52,13
+52,6
@@
console_init (void)
lock_init (&console_lock);
}
lock_init (&console_lock);
}
-/* Prints console statistics. */
-void
-console_print_stats (void)
-{
- printf ("Console: %lld characters output\n", write_cnt);
-}
-
/* Acquires the console lock. */
static void
acquire_console (void)
/* Acquires the console lock. */
static void
acquire_console (void)
@@
-93,6
+86,15
@@
console_locked_by_current_thread (void)
return intr_context () || lock_held_by_current_thread (&console_lock);
}
return intr_context () || lock_held_by_current_thread (&console_lock);
}
+/* Prints console statistics. */
+void
+console_print_stats (void)
+{
+ acquire_console ();
+ printf ("Console: %lld characters output\n", write_cnt);
+ release_console ();
+}
+
/* The standard vprintf() function,
which is like printf() but uses a va_list.
Writes its output to both vga display and serial port. */
/* The standard vprintf() function,
which is like printf() but uses a va_list.
Writes its output to both vga display and serial port. */