[rtems commit] alarm.c: Per comment add debug code for kill() failing

Joel Sherrill joel at rtems.org
Tue Dec 10 01:46:24 UTC 2013


Module:    rtems
Branch:    master
Commit:    967c14385b9194d4257bc44bf21bf1312f9f3321
Changeset: http://git.rtems.org/rtems/commit/?id=967c14385b9194d4257bc44bf21bf1312f9f3321

Author:    Joel Sherrill <joel.sherrill at oarcorp.com>
Date:      Mon Dec  9 15:36:38 2013 -0600

alarm.c: Per comment add debug code for kill() failing

This is highly unlikely and would indicate a serious bug
in the system or corruption. But it is better to be cautious.

---

 cpukit/posix/src/alarm.c |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/cpukit/posix/src/alarm.c b/cpukit/posix/src/alarm.c
index d46d571..8def4a0 100644
--- a/cpukit/posix/src/alarm.c
+++ b/cpukit/posix/src/alarm.c
@@ -9,7 +9,7 @@
  *  3.4.1 Schedule Alarm, P1003.1b-1993, p. 79
  */
 
-/*  COPYRIGHT (c) 1989-2007.
+/*  COPYRIGHT (c) 1989-2013.
  *  On-Line Applications Research Corporation (OAR).
  *
  *  The license and distribution terms for this file may be
@@ -32,14 +32,27 @@
 /*
  *  _POSIX_signals_Alarm_TSR
  */
-
 static void _POSIX_signals_Alarm_TSR(
   Objects_Id      id __attribute__((unused)),
   void           *argument __attribute__((unused))
 )
 {
-  kill( getpid(), SIGALRM );
-  /* XXX can't print from an ISR, should this be fatal? */
+  #if defined(RTEMS_DEBUG)
+    int status;
+    #define KILL_STATUS status =
+  #else
+    #define KILL_STATUS (void)
+  #endif
+
+  KILL_STATUS kill( getpid(), SIGALRM );
+
+  #if defined(RTEMS_DEBUG)
+    /*
+     *  There is no reason to think this might fail but we should be
+     *  cautious.
+     */
+    assert(status == 0);
+  #endif
 }
 
 static Watchdog_Control _POSIX_signals_Alarm_timer = WATCHDOG_INITIALIZER(




More information about the vc mailing list