From 76d5722b4a1adba2aa52043a83c7fa0fcff2a0d4 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 21 May 2021 16:30:20 -0500 Subject: sysinit: Do not open console when just referencing reentrancy structure. This change eliminates a system initialization dependentcy which resulted in an application without a file system or console referencing errno being forced to include the code to open(/dev/console), close(), atexit(), and the unmount infrastructure. Closes #4439. --- cpukit/include/rtems/confdefs/iodrivers.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'cpukit/include') diff --git a/cpukit/include/rtems/confdefs/iodrivers.h b/cpukit/include/rtems/confdefs/iodrivers.h index e12640624d..a7de77a8c3 100644 --- a/cpukit/include/rtems/confdefs/iodrivers.h +++ b/cpukit/include/rtems/confdefs/iodrivers.h @@ -189,6 +189,27 @@ RTEMS_SYSINIT_ITEM( || CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER || CONFIGURE_MAXIMUM_DRIVERS */ + +/* + * If any flavor of console driver is configured, then configure the post + * driver hook which opens /dev/console as stdin, stdout, and stderr. + * + * NOTE: This also results in an atexit() handler being registered to close + * /dev/console. + */ +#if defined(CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER) || \ + defined(CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER) || \ + defined(CONFIGURE_APPLICATION_NEEDS_SIMPLE_TASK_CONSOLE_DRIVER) + + #include + + RTEMS_SYSINIT_ITEM( + rtems_libio_post_driver, + RTEMS_SYSINIT_STD_FILE_DESCRIPTORS, + RTEMS_SYSINIT_ORDER_MIDDLE + ); +#endif + #endif /* CONFIGURE_INIT */ #endif /* _RTEMS_CONFDEFS_IODRIVERS_H */ -- cgit v1.2.3