From 8b8e1ee5073b9085901ade5280efa8c7cda4c5d1 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 20 Jun 2007 22:21:05 +0000 Subject: [PATCH] 2007-06-20 Joel Sherrill * bsppost.c: Split open of the console from the standard BSP code so it is easier to stub out. --- c/src/lib/libbsp/shared/ChangeLog | 5 +++++ c/src/lib/libbsp/shared/bsppost.c | 23 ++--------------------- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/c/src/lib/libbsp/shared/ChangeLog b/c/src/lib/libbsp/shared/ChangeLog index 37510d3596..d4c23d1e62 100644 --- a/c/src/lib/libbsp/shared/ChangeLog +++ b/c/src/lib/libbsp/shared/ChangeLog @@ -1,3 +1,8 @@ +2007-06-20 Joel Sherrill + + * bsppost.c: Split open of the console from the standard BSP code so it + is easier to stub out. + 2007-05-10 Till Straumann * vmeUniverse/vmeUniverse.c: Changed types to silence diff --git a/c/src/lib/libbsp/shared/bsppost.c b/c/src/lib/libbsp/shared/bsppost.c index e86420ebb7..936c2969ca 100644 --- a/c/src/lib/libbsp/shared/bsppost.c +++ b/c/src/lib/libbsp/shared/bsppost.c @@ -20,26 +20,7 @@ void bsp_postdriver_hook(void) { - int stdin_fd, stdout_fd, stderr_fd; - int error_code = 'S' << 24 | 'T' << 16 | 'D' << 8; + extern void open_dev_console(void); - /* - * Attempt to open /dev/console. - */ - if ((stdin_fd = open("/dev/console", O_RDONLY, 0)) == -1) { - /* - * There may not be a console driver so this is OK. - */ - return; - } - - /* - * But if we find /dev/console once, we better find it twice more - * or something is REALLY wrong. - */ - if ((stdout_fd = open("/dev/console", O_WRONLY, 0)) == -1) - rtems_fatal_error_occurred( error_code | '1' ); - - if ((stderr_fd = open("/dev/console", O_WRONLY, 0)) == -1) - rtems_fatal_error_occurred( error_code | '2' ); + open_dev_console(); }