summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-01-25 22:03:00 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-02-03 10:00:57 +0100
commitca4602e914d4ec00bf5db51e0830d702d5bc3f4e (patch)
tree9f67d1d8b61d97a50452d6011647bcac0bf5f3aa /cpukit/libcsupport
parentUse atexit() handler to close std file descriptors (diff)
downloadrtems-ca4602e914d4ec00bf5db51e0830d702d5bc3f4e.tar.bz2
Use linker set for libio initialization
Update #2408.
Diffstat (limited to 'cpukit/libcsupport')
-rw-r--r--cpukit/libcsupport/Makefile.am1
-rw-r--r--cpukit/libcsupport/include/rtems/libio.h15
-rw-r--r--cpukit/libcsupport/src/libio_helper_null.c30
-rw-r--r--cpukit/libcsupport/src/libio_init.c15
4 files changed, 14 insertions, 47 deletions
diff --git a/cpukit/libcsupport/Makefile.am b/cpukit/libcsupport/Makefile.am
index d223b1d78e..0b2607f2b9 100644
--- a/cpukit/libcsupport/Makefile.am
+++ b/cpukit/libcsupport/Makefile.am
@@ -41,7 +41,6 @@ ASSOCIATION_C_FILES = src/assoclocalbyname.c \
BASE_FS_C_FILES = src/base_fs.c src/mount.c src/unmount.c src/libio.c \
src/mount-mgr.c src/mount-mktgt.c src/libio_init.c \
src/privateenv.c \
- src/libio_helper_null.c \
src/libio_exit.c \
src/open_dev_console.c src/__usrenv.c src/rtems_mkdir.c
BASE_FS_C_FILES += src/uenvgetgroups.c
diff --git a/cpukit/libcsupport/include/rtems/libio.h b/cpukit/libcsupport/include/rtems/libio.h
index 824fa2833d..a87031ca91 100644
--- a/cpukit/libcsupport/include/rtems/libio.h
+++ b/cpukit/libcsupport/include/rtems/libio.h
@@ -1338,13 +1338,6 @@ typedef struct {
/** @} */
/**
- * @brief RTEMS LibIO Initialization
- *
- * Called by BSP startup code to initialize the libio subsystem.
- */
-void rtems_libio_init(void);
-
-/**
* @name External I/O Handlers
*/
/**@{**/
@@ -1481,14 +1474,6 @@ static inline rtems_device_minor_number rtems_filesystem_dev_minor_t(
*/
void rtems_filesystem_initialize( void );
-typedef void (*rtems_libio_helper)(void);
-
-extern const rtems_libio_helper rtems_libio_init_helper;
-
-extern const rtems_libio_helper rtems_libio_post_driver_helper;
-
-void rtems_libio_helper_null(void);
-
void rtems_libio_post_driver(void);
void rtems_libio_exit(void);
diff --git a/cpukit/libcsupport/src/libio_helper_null.c b/cpukit/libcsupport/src/libio_helper_null.c
deleted file mode 100644
index 947155fc85..0000000000
--- a/cpukit/libcsupport/src/libio_helper_null.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * @file
- *
- * @ingroup LibIO
- */
-
-/*
- * Copyright (c) 2013 embedded brains GmbH. All rights reserved.
- *
- * embedded brains GmbH
- * Obere Lagerstr. 30
- * 82178 Puchheim
- * Germany
- * <rtems@embedded-brains.de>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#if HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include <rtems/libio.h>
-
-void rtems_libio_helper_null(void)
-{
- /* Do nothing */
-}
diff --git a/cpukit/libcsupport/src/libio_init.c b/cpukit/libcsupport/src/libio_init.c
index 88f5d8cef3..3ac2e3b67d 100644
--- a/cpukit/libcsupport/src/libio_init.c
+++ b/cpukit/libcsupport/src/libio_init.c
@@ -32,6 +32,7 @@
#include <stdlib.h> /* calloc() */
#include <rtems/libio.h> /* libio.h not pulled in by rtems */
+#include <rtems/sysinit.h>
/*
* File descriptor Table Information
@@ -40,7 +41,7 @@
rtems_id rtems_libio_semaphore;
rtems_libio_t *rtems_libio_iop_freelist;
-void rtems_libio_init( void )
+static void rtems_libio_init( void )
{
rtems_status_code rc;
uint32_t i;
@@ -81,3 +82,15 @@ void rtems_libio_init( void )
if ( rc != RTEMS_SUCCESSFUL )
rtems_fatal_error_occurred( rc );
}
+
+RTEMS_SYSINIT_ITEM(
+ rtems_libio_init,
+ RTEMS_SYSINIT_LIBIO,
+ RTEMS_SYSINIT_ORDER_MIDDLE
+);
+
+RTEMS_SYSINIT_ITEM(
+ rtems_libio_post_driver,
+ RTEMS_SYSINIT_STD_FILE_DESCRIPTORS,
+ RTEMS_SYSINIT_ORDER_MIDDLE
+);