source: rtems/cpukit/libcsupport/src/open_dev_console.c @ 5fa0e5c5

4.115
Last change on this file since 5fa0e5c5 was 5fa0e5c5, checked in by Sebastian Huber <sebastian.huber@…>, on 04/24/13 at 12:37:50

libcsupport: Rename open_dev_console()

Rename open_dev_console() to rtems_libio_post_driver(). Rename
rtems_libio_supp_helper to rtems_libio_post_driver_helper.

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/*
2 *  open_dev_console - open /dev/console
3 *
4 *  COPYRIGHT (c) 1989-2009.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 */
11
12#if HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <rtems.h>
17#include <rtems/libio.h>
18#include <fcntl.h>
19
20/*
21 *  This is a replaceable stub which opens the console, if present.
22 */
23void rtems_libio_post_driver(void)
24{
25  int      stdin_fd;
26  int      stdout_fd;
27  int      stderr_fd;
28
29  /*
30   * Attempt to open /dev/console.
31   */
32  if ((stdin_fd = open("/dev/console", O_RDONLY, 0)) == -1) {
33    /*
34     * There may not be a console driver so this is OK.
35     */
36    return;
37  }
38
39  /*
40   *  But if we find /dev/console once, we better find it twice more
41   *  or something is REALLY wrong.
42   */
43  if ((stdout_fd = open("/dev/console", O_WRONLY, 0)) == -1)
44    rtems_fatal_error_occurred( 0x55544431 );  /* error STD1 */
45
46  if ((stderr_fd = open("/dev/console", O_WRONLY, 0)) == -1)
47    rtems_fatal_error_occurred( 0x55544432 );  /* error STD2 */
48}
49
Note: See TracBrowser for help on using the repository browser.