[PATCH 1/4] cpukit: Add _arc4random_getentropy_fail.

Christian Mauderer christian.mauderer at embedded-brains.de
Thu Nov 9 13:23:52 UTC 2017


From: Christian Mauderer <Christian.Mauderer at embedded-brains.de>

Add a default implementation of _arc4random_getentropy_fail with an
internal error.
---
 cpukit/libcsupport/Makefile.am                      |  3 ++-
 cpukit/libcsupport/src/arc4random_getentropy_fail.c | 21 +++++++++++++++++++++
 cpukit/sapi/src/interrtext.c                        |  3 ++-
 cpukit/score/include/rtems/score/interr.h           |  3 ++-
 testsuites/sptests/spinternalerror02/init.c         |  2 +-
 5 files changed, 28 insertions(+), 4 deletions(-)
 create mode 100644 cpukit/libcsupport/src/arc4random_getentropy_fail.c

diff --git a/cpukit/libcsupport/Makefile.am b/cpukit/libcsupport/Makefile.am
index dbba6b1d8b..f603af5d5c 100644
--- a/cpukit/libcsupport/Makefile.am
+++ b/cpukit/libcsupport/Makefile.am
@@ -115,7 +115,8 @@ TERMINAL_IDENTIFICATION_C_FILES += src/ttyname.c
 LIBC_GLUE_C_FILES = src/__getpid.c src/__gettod.c src/__times.c \
     src/truncate.c src/access.c src/stat.c src/lstat.c src/pathconf.c \
     src/newlibc_reent.c src/newlibc_exit.c \
-    src/kill_noposix.c src/utsname.c src/realpath.c
+    src/kill_noposix.c src/utsname.c src/realpath.c \
+    src/arc4random_getentropy_fail.c
 
 BSD_LIBC_C_FILES = src/strlcpy.c src/strlcat.c src/issetugid.c
 
diff --git a/cpukit/libcsupport/src/arc4random_getentropy_fail.c b/cpukit/libcsupport/src/arc4random_getentropy_fail.c
new file mode 100644
index 0000000000..88aa1ca328
--- /dev/null
+++ b/cpukit/libcsupport/src/arc4random_getentropy_fail.c
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2017 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  <rtems at 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.
+ */
+
+#include <machine/_arc4random.h>
+#include <rtems/score/interr.h>
+
+void _arc4random_getentropy_fail( void )
+{
+  _Internal_error( INTERNAL_ERROR_ARC4RANDOM_GETENTROPY_FAIL );
+}
diff --git a/cpukit/sapi/src/interrtext.c b/cpukit/sapi/src/interrtext.c
index 6fada4be26..79ba7948ef 100644
--- a/cpukit/sapi/src/interrtext.c
+++ b/cpukit/sapi/src/interrtext.c
@@ -65,7 +65,8 @@ static const char *const internal_error_text[] = {
   "INTERNAL_ERROR_LIBIO_SEM_CREATE_FAILED",
   "INTERNAL_ERROR_LIBIO_STDOUT_FD_OPEN_FAILED",
   "INTERNAL_ERROR_LIBIO_STDERR_FD_OPEN_FAILED",
-  "INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT"
+  "INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT",
+  "INTERNAL_ERROR_ARC4RANDOM_GETENTROPY_FAIL"
 };
 
 const char *rtems_internal_error_text( rtems_fatal_code error )
diff --git a/cpukit/score/include/rtems/score/interr.h b/cpukit/score/include/rtems/score/interr.h
index ca64341948..0c02c21348 100644
--- a/cpukit/score/include/rtems/score/interr.h
+++ b/cpukit/score/include/rtems/score/interr.h
@@ -178,7 +178,8 @@ typedef enum {
   INTERNAL_ERROR_LIBIO_SEM_CREATE_FAILED = 35,
   INTERNAL_ERROR_LIBIO_STDOUT_FD_OPEN_FAILED = 36,
   INTERNAL_ERROR_LIBIO_STDERR_FD_OPEN_FAILED = 37,
-  INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT = 38
+  INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT = 38,
+  INTERNAL_ERROR_ARC4RANDOM_GETENTROPY_FAIL = 39
 } Internal_errors_Core_list;
 
 typedef CPU_Uint32ptr Internal_errors_t;
diff --git a/testsuites/sptests/spinternalerror02/init.c b/testsuites/sptests/spinternalerror02/init.c
index f1ef8f3826..9ee8e6dfe5 100644
--- a/testsuites/sptests/spinternalerror02/init.c
+++ b/testsuites/sptests/spinternalerror02/init.c
@@ -36,7 +36,7 @@ static void test_internal_error_text(void)
   } while ( text != text_last );
 
   rtems_test_assert(
-    error - 3 == INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT
+    error - 3 == INTERNAL_ERROR_ARC4RANDOM_GETENTROPY_FAIL
   );
 }
 
-- 
2.12.3



More information about the devel mailing list