Changeset 173d1f8 in rtems


Ignore:
Timestamp:
Dec 14, 2015, 12:10:24 PM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
e01b184
Parents:
54c3fbd
git-author:
Sebastian Huber <sebastian.huber@…> (12/14/15 12:10:24)
git-committer:
Sebastian Huber <sebastian.huber@…> (12/15/15 06:41:34)
Message:

posix: Store unblocked signals

Store the unblock signals to exploit the zero-initialization of the
thread control block.

Location:
cpukit/posix
Files:
8 edited

Legend:

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

    r54c3fbd r173d1f8  
    6464  Watchdog_Control        Sporadic_timer;
    6565
    66   /** This is the set of signals which are currently blocked. */
    67   sigset_t                signals_blocked;
     66  /** This is the set of signals which are currently unblocked. */
     67  sigset_t                signals_unblocked;
    6868  /** This is the set of signals which are currently pending. */
    6969  sigset_t                signals_pending;
  • cpukit/posix/src/killinfo.c

    r54c3fbd r173d1f8  
    5353
    5454#define _POSIX_signals_Is_interested( _api, _mask ) \
    55   ( ~(_api)->signals_blocked & (_mask) )
     55  ( (_api)->signals_unblocked & (_mask) )
    5656
    5757int killinfo(
     
    154154      #if defined(DEBUG_SIGNAL_PROCESSING)
    155155        printk( "Waiting Thread=%p option=0x%08x mask=0x%08x blocked=0x%08x\n",
    156           the_thread, the_thread->Wait.option, mask, api->signals_blocked);
     156          the_thread, the_thread->Wait.option, mask, ~api->signals_unblocked);
    157157      #endif
    158158
     
    167167       * not blocked this one?
    168168       */
    169       if (~api->signals_blocked & mask)
     169      if (api->signals_unblocked & mask)
    170170        goto process_it;
    171171    }
  • cpukit/posix/src/psignal.c

    r54c3fbd r173d1f8  
    145145  while (1) {
    146146    _POSIX_signals_Acquire( &lock_context );
    147       if ( !(~api->signals_blocked &
     147      if ( !(api->signals_unblocked &
    148148            (api->signals_pending | _POSIX_signals_Pending)) ) {
    149149       _POSIX_signals_Release( &lock_context );
  • cpukit/posix/src/psignalchecksignal.c

    r54c3fbd r173d1f8  
    4444{
    4545  siginfo_t                   siginfo_struct;
    46   sigset_t                    saved_signals_blocked;
     46  sigset_t                    saved_signals_unblocked;
    4747  Thread_Wait_information     stored_thread_wait_information;
    4848  Thread_Control             *executing;
     
    7070   *  Block the signals requested in sa_mask
    7171   */
    72   saved_signals_blocked = api->signals_blocked;
    73   api->signals_blocked |= _POSIX_signals_Vectors[ signo ].sa_mask;
     72  saved_signals_unblocked = api->signals_unblocked;
     73  api->signals_unblocked &= ~_POSIX_signals_Vectors[ signo ].sa_mask;
    7474
    7575  executing = _Thread_Get_executing();
     
    106106
    107107  /*
    108    *  Restore the previous set of blocked signals
     108   *  Restore the previous set of unblocked signals
    109109   */
    110   api->signals_blocked = saved_signals_blocked;
     110  api->signals_unblocked = saved_signals_unblocked;
    111111
    112112  return true;
  • cpukit/posix/src/psignalclearsignals.c

    r54c3fbd r173d1f8  
    4747{
    4848  sigset_t                    mask;
    49   sigset_t                    signals_blocked;
     49  sigset_t                    signals_unblocked;
    5050  ISR_lock_Context            lock_context;
    5151  bool                        do_callout;
     
    6161
    6262  if ( check_blocked )
    63     signals_blocked = ~api->signals_blocked;
     63    signals_unblocked = api->signals_unblocked;
    6464  else
    65     signals_blocked = SIGNAL_ALL_MASK;
     65    signals_unblocked = SIGNAL_ALL_MASK;
    6666
    6767  /* XXX is this right for siginfo type signals? */
     
    7373
    7474    if ( is_global ) {
    75        if ( mask & (_POSIX_signals_Pending & signals_blocked) ) {
     75       if ( mask & (_POSIX_signals_Pending & signals_unblocked) ) {
    7676         if ( _POSIX_signals_Vectors[ signo ].sa_flags == SA_SIGINFO ) {
    7777           psiginfo = (POSIX_signals_Siginfo_node *)
     
    9696       }
    9797    } else {
    98       if ( mask & (api->signals_pending & signals_blocked) ) {
     98      if ( mask & (api->signals_pending & signals_unblocked) ) {
    9999        api->signals_pending &= ~mask;
    100100        do_callout = true;
  • cpukit/posix/src/psignalunblockthread.c

    r54c3fbd r173d1f8  
    7070  if ( _States_Is_interruptible_signal( the_thread->current_state ) ) {
    7171
    72     if ( (the_thread->Wait.option & mask) || (~api->signals_blocked & mask) ) {
     72    if ( (the_thread->Wait.option & mask) || (api->signals_unblocked & mask) ) {
    7373      the_thread->Wait.return_code = EINTR;
    7474
     
    9797   *  Thread is not waiting due to a sigwait.
    9898   */
    99   if ( ~api->signals_blocked & mask ) {
     99  if ( api->signals_unblocked & mask ) {
    100100
    101101    /*
  • cpukit/posix/src/pthread.c

    r54c3fbd r173d1f8  
    223223  ) {
    224224    executing_api = _Thread_Get_executing()->API_Extensions[ THREAD_API_POSIX ];
    225     api->signals_blocked = executing_api->signals_blocked;
    226   } else {
    227     api->signals_blocked = SIGNAL_ALL_MASK;
     225    api->signals_unblocked = executing_api->signals_unblocked;
    228226  }
    229227
  • cpukit/posix/src/pthreadsigmask.c

    r54c3fbd r173d1f8  
    4646
    4747  if ( oset )
    48     *oset = api->signals_blocked;
     48    *oset = ~api->signals_unblocked;
    4949
    5050  if ( !set )
     
    5353  switch ( how ) {
    5454    case SIG_BLOCK:
    55       api->signals_blocked |= *set;
     55      api->signals_unblocked &= ~*set;
    5656      break;
    5757    case SIG_UNBLOCK:
    58       api->signals_blocked &= ~*set;
     58      api->signals_unblocked |= *set;
    5959      break;
    6060    case SIG_SETMASK:
    61       api->signals_blocked = *set;
     61      api->signals_unblocked = ~*set;
    6262      break;
    6363    default:
     
    6969  /* XXX evaluate the new set */
    7070
    71   if ( ~api->signals_blocked &
     71  if ( api->signals_unblocked &
    7272       (api->signals_pending | _POSIX_signals_Pending) ) {
    7373    _Thread_Dispatch();
Note: See TracChangeset for help on using the changeset viewer.