Changeset 7d9fff6 in rtems


Ignore:
Timestamp:
Aug 26, 2013, 3:39:00 PM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
7bff82f
Parents:
a4c3e71
git-author:
Sebastian Huber <sebastian.huber@…> (08/26/13 15:39:00)
git-committer:
Sebastian Huber <sebastian.huber@…> (08/27/13 10:51:46)
Message:

posix: Add and use _POSIX_signals_Acquire()

Add and use _POSIX_signals_Release(). The post-switch handler is not
protected by disabled thread dispatching. Use proper SMP lock for
signal management.

Files:
7 edited

Legend:

Unmodified
Added
Removed
  • cpukit/posix/include/rtems/posix/psignalimpl.h

    ra4c3e71 r7d9fff6  
    3333#include <rtems/posix/sigset.h>
    3434#include <rtems/score/apiext.h>
     35#include <rtems/score/isrlock.h>
    3536#include <rtems/score/threadq.h>
    3637
     
    5455 *  Variables
    5556 */
     57
     58extern ISR_lock_Control _POSIX_signals_Lock;
    5659
    5760extern sigset_t  _POSIX_signals_Pending;
     
    7780 */
    7881void _POSIX_signals_Manager_Initialization(void);
     82
     83#define _POSIX_signals_Acquire( level ) \
     84  _ISR_lock_ISR_disable_and_acquire( &_POSIX_signals_Lock, level )
     85
     86#define _POSIX_signals_Release( level ) \
     87  _ISR_lock_Release_and_ISR_enable( &_POSIX_signals_Lock, level )
    7988
    8089static inline void _POSIX_signals_Add_post_switch_extension(void)
     
    111120  siginfo_t          *info,
    112121  bool                is_global,
    113   bool                check_blocked
     122  bool                check_blocked,
     123  bool                do_signals_acquire_release
    114124);
    115125
  • cpukit/posix/src/psignal.c

    ra4c3e71 r7d9fff6  
    4545
    4646/*** PROCESS WIDE STUFF ****/
     47
     48ISR_lock_Control _POSIX_signals_Lock = ISR_LOCK_INITIALIZER;
    4749
    4850sigset_t  _POSIX_signals_Pending;
     
    145147   */
    146148  while (1) {
    147     _ISR_Disable( level );
     149    _POSIX_signals_Acquire( level );
    148150      if ( !(~api->signals_blocked &
    149151            (api->signals_pending | _POSIX_signals_Pending)) ) {
    150        _ISR_Enable( level );
     152       _POSIX_signals_Release( level );
    151153       break;
    152154     }
    153     _ISR_Enable( level );
     155    _POSIX_signals_Release( level );
    154156
    155157    for ( signo = SIGRTMIN ; signo <= SIGRTMAX ; signo++ ) {
  • cpukit/posix/src/psignalchecksignal.c

    ra4c3e71 r7d9fff6  
    5050
    5151  if ( ! _POSIX_signals_Clear_signals( api, signo, &siginfo_struct,
    52                                        is_global, true ) )
     52                                       is_global, true, true ) )
    5353    return false;
    5454
  • cpukit/posix/src/psignalclearsignals.c

    ra4c3e71 r7d9fff6  
    4343  siginfo_t          *info,
    4444  bool                is_global,
    45   bool                check_blocked
     45  bool                check_blocked,
     46  bool                do_signals_acquire_release
    4647)
    4748{
     
    6869  /* XXX are we sure they can be cleared the same way? */
    6970
    70   _ISR_Disable( level );
     71  if ( do_signals_acquire_release ) {
     72    _POSIX_signals_Acquire( level );
     73  }
     74
    7175    if ( is_global ) {
    7276       if ( mask & (_POSIX_signals_Pending & signals_blocked) ) {
     
    98102      }
    99103    }
    100   _ISR_Enable( level );
     104
     105  if ( do_signals_acquire_release ) {
     106    _POSIX_signals_Release( level );
     107  }
     108
    101109  return do_callout;
    102110}
  • cpukit/posix/src/psignalsetprocesssignals.c

    ra4c3e71 r7d9fff6  
    4040  ISR_Level  level;
    4141
    42   _ISR_Disable( level );
     42  _POSIX_signals_Acquire( level );
    4343    _POSIX_signals_Pending |= mask;
    44   _ISR_Enable( level );
     44  _POSIX_signals_Release( level );
    4545}
  • cpukit/posix/src/sigtimedwait.c

    ra4c3e71 r7d9fff6  
    118118  /* API signals pending? */
    119119
    120   _ISR_Disable( level );
     120  _POSIX_signals_Acquire( level );
    121121  if ( *set & api->signals_pending ) {
    122122    /* XXX real info later */
     
    127127      the_info,
    128128      false,
     129      false,
    129130      false
    130131    );
    131     _ISR_Enable( level );
     132    _POSIX_signals_Release( level );
    132133
    133134    the_info->si_code = SI_USER;
     
    140141  if ( *set & _POSIX_signals_Pending ) {
    141142    signo = _POSIX_signals_Get_lowest( _POSIX_signals_Pending );
    142     _POSIX_signals_Clear_signals( api, signo, the_info, true, false );
    143     _ISR_Enable( level );
     143    _POSIX_signals_Clear_signals( api, signo, the_info, true, false, false );
     144    _POSIX_signals_Release( level );
    144145
    145146    the_info->si_signo = signo;
     
    157158    executing->Wait.return_argument = the_info;
    158159    _Thread_queue_Enter_critical_section( &_POSIX_signals_Wait_queue );
    159     _ISR_Enable( level );
     160    _POSIX_signals_Release( level );
    160161    _Thread_queue_Enqueue( &_POSIX_signals_Wait_queue, executing, interval );
    161162  _Thread_Enable_dispatch();
     
    166167   */
    167168
    168   _POSIX_signals_Clear_signals( api, the_info->si_signo, the_info, false, false );
     169  _POSIX_signals_Clear_signals(
     170    api,
     171    the_info->si_signo,
     172    the_info,
     173    false,
     174    false,
     175    true
     176  );
    169177
    170178  /* Set errno only if return code is not EINTR or
  • testsuites/psxtests/psxsignal05/init.c

    ra4c3e71 r7d9fff6  
    8080    &info,
    8181    true,              /* is_global */
    82     false              /* check_blocked */
     82    false,             /* check_blocked */
     83    true               /* do_signals_acquire_release */
    8384  );
    8485  rtems_test_assert( bc );
Note: See TracChangeset for help on using the changeset viewer.