change log for rtems (2010-07-27)

rtems-vc at rtems.org rtems-vc at rtems.org
Tue Jul 27 17:10:38 UTC 2010


 *joel*:
2010-07-27	Vinu Rajashekhar <vinutheraj at gmail.com>

	PR 1630/cpukit
	* posix/src/psignalchecksignal.c, posix/src/sigtimedwait.c:
	sigtimedwait() was not completely following the POSIX specification.

M 1.2528  cpukit/ChangeLog
M   1.10  cpukit/posix/src/psignalchecksignal.c
M   1.18  cpukit/posix/src/sigtimedwait.c

diff -u rtems/cpukit/ChangeLog:1.2527 rtems/cpukit/ChangeLog:1.2528
--- rtems/cpukit/ChangeLog:1.2527	Mon Jul 26 21:17:31 2010
+++ rtems/cpukit/ChangeLog	Tue Jul 27 11:34:26 2010
@@ -1,3 +1,9 @@
+2010-07-27	Vinu Rajashekhar <vinutheraj at gmail.com>
+
+	PR 1630/cpukit
+	* posix/src/psignalchecksignal.c, posix/src/sigtimedwait.c:
+	sigtimedwait() was not completely following the POSIX specification.
+
 2010-07-26	Joel Sherrill <joel.sherrilL at OARcorp.com>
 
 	* score/src/threadget.c: Conditionalize a check that can only occur

diff -u rtems/cpukit/posix/src/psignalchecksignal.c:1.9 rtems/cpukit/posix/src/psignalchecksignal.c:1.10
--- rtems/cpukit/posix/src/psignalchecksignal.c:1.9	Mon Jun 29 18:19:28 2009
+++ rtems/cpukit/posix/src/psignalchecksignal.c	Tue Jul 27 11:34:26 2010
@@ -19,6 +19,7 @@
 #include <errno.h>
 #include <pthread.h>
 #include <signal.h>
+#include <string.h>
 
 #include <rtems/system.h>
 #include <rtems/score/isr.h>
@@ -46,6 +47,7 @@
 {
   siginfo_t                   siginfo_struct;
   sigset_t                    saved_signals_blocked;
+  Thread_Wait_information     stored_thread_wait_information;
 
   if ( ! _POSIX_signals_Clear_signals( api, signo, &siginfo_struct,
                                        is_global, true ) )
@@ -73,6 +75,14 @@
   api->signals_blocked |= _POSIX_signals_Vectors[ signo ].sa_mask;
 
   /*
+   *  We have to save the blocking information of the current wait queue
+   *  because the signal handler may subsequently go on and put the thread
+   *  on a wait queue, for its own purposes.
+   */
+  memcpy( &stored_thread_wait_information, &_Thread_Executing->Wait,
+          sizeof( Thread_Wait_information ));
+
+  /*
    *  Here, the signal handler function executes
    */
   switch ( _POSIX_signals_Vectors[ signo ].sa_flags ) {
@@ -89,6 +99,12 @@
   }
 
   /*
+   *  Restore the blocking information
+   */
+  memcpy( &_Thread_Executing->Wait, &stored_thread_wait_information,
+          sizeof( Thread_Wait_information ));
+
+  /*
    *  Restore the previous set of blocked signals
    */
   api->signals_blocked = saved_signals_blocked;

diff -u rtems/cpukit/posix/src/sigtimedwait.c:1.17 rtems/cpukit/posix/src/sigtimedwait.c:1.18
--- rtems/cpukit/posix/src/sigtimedwait.c:1.17	Mon Nov 30 09:44:21 2009
+++ rtems/cpukit/posix/src/sigtimedwait.c	Tue Jul 27 11:34:26 2010
@@ -26,7 +26,7 @@
 #include <rtems/posix/time.h>
 #include <rtems/score/isr.h>
 
-int _POSIX_signals_Get_highest(
+int _POSIX_signals_Get_lowest(
   sigset_t   set
 )
 {
@@ -115,7 +115,7 @@
   _ISR_Disable( level );
   if ( *set & api->signals_pending ) {
     /* XXX real info later */
-    the_info->si_signo = _POSIX_signals_Get_highest( api->signals_pending );
+    the_info->si_signo = _POSIX_signals_Get_lowest( api->signals_pending );
     _POSIX_signals_Clear_signals(
       api,
       the_info->si_signo,
@@ -133,7 +133,7 @@
   /* Process pending signals? */
 
   if ( *set & _POSIX_signals_Pending ) {
-    signo = _POSIX_signals_Get_highest( _POSIX_signals_Pending );
+    signo = _POSIX_signals_Get_lowest( _POSIX_signals_Pending );
     _POSIX_signals_Clear_signals( api, signo, the_info, true, false );
     _ISR_Enable( level );
 
@@ -161,6 +161,17 @@
    */
 
   _POSIX_signals_Clear_signals( api, the_info->si_signo, the_info, false, false );
-  errno = _Thread_Executing->Wait.return_code;
+
+  /* Set errno only if return code is not EINTR or
+   * if EINTR was caused by a signal being caught, which
+   * was not in our set.
+   */
+
+  if ( (_Thread_Executing->Wait.return_code != EINTR)
+       || !(*set & signo_to_mask( the_info->si_signo )) ) {
+    errno = _Thread_Executing->Wait.return_code;
+    return -1;
+  }
+
   return the_info->si_signo;
 }


 *joel*:
2010-07-27	Vinu Rajashekhar <vinutheraj at gmail.com>

	PR 1629/cpukit
	* psx04/init.c: sigsuspend() was not completely following the POSIX
	specification.

M  1.298  testsuites/psxtests/ChangeLog
M   1.23  testsuites/psxtests/psx04/init.c

diff -u rtems/testsuites/psxtests/ChangeLog:1.297 rtems/testsuites/psxtests/ChangeLog:1.298
--- rtems/testsuites/psxtests/ChangeLog:1.297	Mon Jul 19 08:13:20 2010
+++ rtems/testsuites/psxtests/ChangeLog	Tue Jul 27 11:38:07 2010
@@ -1,3 +1,9 @@
+2010-07-27	Vinu Rajashekhar <vinutheraj at gmail.com>
+
+	PR 1629/cpukit
+	* psx04/init.c: sigsuspend() was not completely following the POSIX
+	specification.
+
 2010-07-19	Bharath Suri <bharath.s.jois at gmail.com>
 
 	PR 1623/testing

diff -u rtems/testsuites/psxtests/psx04/init.c:1.22 rtems/testsuites/psxtests/psx04/init.c:1.23
--- rtems/testsuites/psxtests/psx04/init.c:1.22	Tue Dec  8 11:52:52 2009
+++ rtems/testsuites/psxtests/psx04/init.c	Tue Jul 27 11:38:08 2010
@@ -414,6 +414,9 @@
 
   /* Suspend for signal that has already be sent */
 
+  status = sigemptyset( &mask );
+  rtems_test_assert(  !status );
+
   puts( "Init: sigsuspend for any signal" );
   status = sigsuspend( &mask );
   rtems_test_assert(  status );


 *joel*:
2010-07-27	Vinu Rajashekhar <vinutheraj at gmail.com>

	PR 1629/cpukit
	* posix/src/sigsuspend.c: sigsuspend() was not completely following the
	POSIX specification.

M 1.2529  cpukit/ChangeLog
M    1.6  cpukit/posix/src/sigsuspend.c

diff -u rtems/cpukit/ChangeLog:1.2528 rtems/cpukit/ChangeLog:1.2529
--- rtems/cpukit/ChangeLog:1.2528	Tue Jul 27 11:34:26 2010
+++ rtems/cpukit/ChangeLog	Tue Jul 27 11:38:15 2010
@@ -1,5 +1,11 @@
 2010-07-27	Vinu Rajashekhar <vinutheraj at gmail.com>
 
+	PR 1629/cpukit
+	* posix/src/sigsuspend.c: sigsuspend() was not completely following the
+	POSIX specification.
+
+2010-07-27	Vinu Rajashekhar <vinutheraj at gmail.com>
+
 	PR 1630/cpukit
 	* posix/src/psignalchecksignal.c, posix/src/sigtimedwait.c:
 	sigtimedwait() was not completely following the POSIX specification.

diff -u rtems/cpukit/posix/src/sigsuspend.c:1.5 rtems/cpukit/posix/src/sigsuspend.c:1.6
--- rtems/cpukit/posix/src/sigsuspend.c:1.5	Fri May 21 15:19:33 2004
+++ rtems/cpukit/posix/src/sigsuspend.c	Tue Jul 27 11:38:15 2010
@@ -15,6 +15,7 @@
 #include "config.h"
 #endif
 
+#include <assert.h>
 #include <signal.h>
 #include <errno.h>
 
@@ -28,17 +29,21 @@
 )
 {
   sigset_t            saved_signals_blocked;
-  sigset_t            all_signals;
+  sigset_t            current_unblocked_signals;
   int                 status;
   POSIX_API_Control  *api;
 
   api = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
 
+  /*
+   *  We use SIG_BLOCK and not SIG_SETMASK because there may be
+   *  signals which might be pending, which might get caught here.
+   *  We want the signals to be caught inside sigtimedwait.
+   */
   status = sigprocmask( SIG_BLOCK, sigmask, &saved_signals_blocked );
 
-  (void) sigfillset( &all_signals );
-
-  status = sigtimedwait( &all_signals, NULL, NULL );
+  current_unblocked_signals = ~(*sigmask);
+  status = sigtimedwait( &current_unblocked_signals, NULL, NULL );
 
   (void) sigprocmask( SIG_SETMASK, &saved_signals_blocked, NULL );
 
@@ -46,8 +51,7 @@
    * sigtimedwait() returns the signal number while sigsuspend()
    * is supposed to return -1 and EINTR when a signal is caught.
    */
-  if ( status != -1 )
-    rtems_set_errno_and_return_minus_one( EINTR );
+  assert ( status != -1 );
 
-  return status;
+  rtems_set_errno_and_return_minus_one( EINTR );
 }



--

Generated by Deluxe Loginfo [http://www.codewiz.org/projects/index.html#loginfo] 2.122 by Bernardo Innocenti <bernie at develer.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/vc/attachments/20100727/b2d42a55/attachment.html>


More information about the vc mailing list