source: rtems/c/src/lib/libbsp/shared/bsppost.c @ 07a3253d

4.104.114.84.95
Last change on this file since 07a3253d was 07a3253d, checked in by Joel Sherrill <joel.sherrill@…>, on Nov 23, 1998 at 7:07:58 PM

Added base version of file system infrastructure. This includes a major
overhaul of the RTEMS system call interface. This base file system is
the "In-Memory File System" aka IMFS.

The design and implementation was done by the following people:

+ Joel Sherrill (joel@…)
+ Jennifer Averett (jennifer@…)
+ Steve "Mr Mount" Salitasc (salitasc@…)
+ Kerwin Wade (wade@…)

PROBLEMS
========

+ It is VERY likely that merging this will break the UNIX port. This

can/will be fixed.

+ There is likely some reentrancy/mutual exclusion needed.

+ Eventually, there should be a "mini-IMFS" description table to

eliminate links, symlinks, etc to save memory. All you need to
have "classic RTEMS" functionality is technically directories
and device IO. All the rest could be left out to save memory.

  • Property mode set to 100644
File size: 949 bytes
Line 
1/*
2 *  This is a basic BSP post driver hook.
3 *
4 * After drivers are setup, register some "filenames"
5 * and open stdin, stdout, stderr files
6 *
7 * Newlib will automatically associate the files with these
8 * (it hardcodes the numbers)
9 *
10 *  $Id$
11 */
12
13#include <rtems.h>
14#include <rtems/libio.h>
15#include <fcntl.h>
16
17void
18bsp_postdriver_hook(void)
19{
20  int stdin_fd, stdout_fd, stderr_fd;
21  int error_code;
22
23  error_code = 'S' << 24 | 'T' << 16;
24
25  if ((stdin_fd = open("/dev/console", O_RDONLY, 0)) == -1)
26    rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
27
28  if ((stdout_fd = open("/dev/console", O_WRONLY, 0)) == -1)
29    rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
30
31  if ((stderr_fd = open("/dev/console", O_WRONLY, 0)) == -1)
32    rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
33
34  if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
35    rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
36}
37
Note: See TracBrowser for help on using the repository browser.