Changeset c8f5ab5 in rtems


Ignore:
Timestamp:
Jun 11, 1996, 8:43:55 PM (25 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
699fe08a
Parents:
fb39f19
Message:

tested blocking a signal, sending it to self, then unblocking it.

make minimum stack size for posix threads double that of the cpu's minimum
requirement.

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/posix/src/psignal.c

    rfb39f19 rc8f5ab5  
    6060  /* SIGUSR1     */  SIGACTION_TERMINATE,
    6161  /* SIGUSR2     */  SIGACTION_TERMINATE,
    62   /* SIGCHLD    */  SIGACTION_IGNORE,
    63   /* SIGCONT     */  SIGACTION_CONTINUE,
    64   /* SIGSTOP     */  SIGACTION_STOP,
    65   /* SIGTSTP     */  SIGACTION_STOP,
    66   /* SIGTTIN     */  SIGACTION_STOP,
    67   /* SIGTTOU     */  SIGACTION_STOP,
    68   /* SIGBUS      */  SIGACTION_TERMINATE,
    69   /* SIGRTMIN 21 */  SIGACTION_IGNORE,
     62  /* SIGRTMIN 14 */  SIGACTION_IGNORE,
     63  /* SIGRT    15 */  SIGACTION_IGNORE,
     64  /* SIGRT    16 */  SIGACTION_IGNORE,
     65  /* SIGRT    17 */  SIGACTION_IGNORE,
     66  /* SIGRT    18 */  SIGACTION_IGNORE,
     67  /* SIGRT    19 */  SIGACTION_IGNORE,
     68  /* SIGRT    20 */  SIGACTION_IGNORE,
     69  /* SIGRT    21 */  SIGACTION_IGNORE,
    7070  /* SIGRT    22 */  SIGACTION_IGNORE,
    7171  /* SIGRT    23 */  SIGACTION_IGNORE,
     
    109109  siginfo_t          *siginfo = NULL;  /* really needs to be set below */
    110110  siginfo_t           siginfo_struct;
     111  sigset_t            saved_signals_blocked;
    111112
    112113  mask = signo_to_mask( signo );
     
    137138          _POSIX_signals_Vectors[ signo ].sa_sigaction );
    138139 
     140  /*
     141   *  Just to prevent sending a signal which is currently being ignored.
     142   */
     143
     144  if ( _POSIX_signals_Vectors[ signo ].sa_handler == SIG_IGN )
     145    return FALSE;
     146
     147  /*
     148   *  Block the signals requested in sa_mask
     149   */
     150
     151  saved_signals_blocked = api->signals_blocked;
     152  api->signals_blocked |= _POSIX_signals_Vectors[ signo ].sa_mask;
     153
    139154  switch ( _POSIX_signals_Vectors[ signo ].sa_flags ) {
    140155    case SA_SIGINFO:
     
    156171      break;
    157172  }
     173
     174  /*
     175   *  Restore the previous set of blocked signals
     176   */
     177 
     178  api->signals_blocked = saved_signals_blocked;
     179
    158180  return TRUE;
    159181}
     
    165187  POSIX_API_Control  *api;
    166188  int                 signo;
     189  ISR_Level           level;
    167190
    168191  api = the_thread->API_Extensions[ THREAD_API_POSIX ];
     
    170193  /*
    171194   *  If we invoke any user code, there is the possibility that
    172    *  a new signal has been posted that we should process.
    173    */
    174 
    175 /* XXX somewhere we need to see if all pending signals are gone and clear */
    176 /* XXX do_post_switch_extension */
     195   *  a new signal has been posted that we should process so we
     196   *  restart the loop if a signal handler was invoked.
     197   *
     198   *  The first thing done is to check there are any signals to be
     199   *  processed at all.  No point in doing this loop otherwise.
     200   */
    177201
    178202restart:
     203  _ISR_Disable( level );
     204    if ( !(~api->signals_blocked &
     205          (api->signals_pending | _POSIX_signals_Pending)) )
     206      return;
     207  _ISR_Enable( level );
     208
    179209  for ( signo = SIGRTMIN ; signo <= SIGRTMAX ; signo++ ) {
    180210
     
    187217  }
    188218
    189   for ( signo = SIGABRT ; signo <= SIGBUS ; signo++ ) {
     219  for ( signo = SIGABRT ; signo <= __SIGLASTNOTRT ; signo++ ) {
    190220
    191221    if ( _POSIX_signals_Check_signal( api, signo, FALSE ) )
     
    371401)
    372402{
    373   if ( !act )
    374     set_errno_and_return_minus_one( EFAULT );
    375 
    376403  if ( !is_valid_signo(sig) )
    377404    set_errno_and_return_minus_one( EINVAL );
     
    380407    *oact = _POSIX_signals_Vectors[ sig ];
    381408
     409  /* XXX some signals cannot be ignored */
     410  /* XXX can't find this in spec -- ignore calls on SIGKILL and SIGSTOP */
     411  /* XXX we don't do SIGSTOP */
     412
     413  if ( sig == SIGKILL )
     414    set_errno_and_return_minus_one( EINVAL );
     415 
    382416  /* XXX need to interpret some stuff here */
    383   /* XXX some signals cannot be ignored */
    384 
    385   _POSIX_signals_Vectors[ sig ] = *act;
     417
     418  if ( act ) {
     419    _POSIX_signals_Vectors[ sig ] = *act;
     420  }
    386421
    387422  return 0;
     
    421456{
    422457  POSIX_API_Control  *api;
    423   boolean             evaluate_signals;
    424458
    425459/* XXX some signals can not be ignored */
     
    435469  if ( !set )
    436470    set_errno_and_return_minus_one( EFAULT );
    437 
    438   evaluate_signals = TRUE;
    439471
    440472  switch ( how ) {
    441473    case SIG_BLOCK:
    442474      api->signals_blocked |= *set;
    443       evaluate_signals = FALSE;
    444475      break;
    445476    case SIG_UNBLOCK:
     
    457488  /* XXX evaluate the new set */
    458489
    459   if ( evaluate_signals == TRUE ) {
    460      if ( ~api->signals_blocked &
    461           (api->signals_pending | _POSIX_signals_Pending) ) {
    462        api->signals_global_pending &= _POSIX_signals_Pending;
    463        _Thread_Executing->do_post_task_switch_extension = TRUE;
    464        _Thread_Dispatch();
    465      }
     490  if ( ~api->signals_blocked &
     491       (api->signals_pending | _POSIX_signals_Pending) ) {
     492    api->signals_global_pending &= _POSIX_signals_Pending;
     493    _Thread_Executing->do_post_task_switch_extension = TRUE;
     494    _Thread_Dispatch();
    466495  }
    467496
     
    623652        if ( api->signals_pending & ~api->signals_blocked ) {
    624653          the_thread->do_post_task_switch_extension = TRUE;
    625 
    626  
    627           /* XXX may have to unblock the task -- this is a kludge -- fix it */
     654 
     655          /* XXX unblock the task -- this is a kludge -- fix it */
     656
    628657          if ( the_thread->current_state & STATES_INTERRUPTIBLE_BY_SIGNAL ) {
    629658            the_thread->Wait.return_code = EINTR;
  • c/src/exec/posix/src/pthread.c

    rfb39f19 rc8f5ab5  
    2929  TRUE,                    /* is_initialized */
    3030  NULL,                    /* stackaddr */
    31   STACK_MINIMUM_SIZE,      /* stacksize */
     31  STACK_MINIMUM_SIZE * 2,  /* stacksize */
    3232  PTHREAD_SCOPE_PROCESS,   /* contentionscope */
    3333  PTHREAD_EXPLICIT_SCHED,  /* inheritsched */
  • cpukit/posix/src/psignal.c

    rfb39f19 rc8f5ab5  
    6060  /* SIGUSR1     */  SIGACTION_TERMINATE,
    6161  /* SIGUSR2     */  SIGACTION_TERMINATE,
    62   /* SIGCHLD    */  SIGACTION_IGNORE,
    63   /* SIGCONT     */  SIGACTION_CONTINUE,
    64   /* SIGSTOP     */  SIGACTION_STOP,
    65   /* SIGTSTP     */  SIGACTION_STOP,
    66   /* SIGTTIN     */  SIGACTION_STOP,
    67   /* SIGTTOU     */  SIGACTION_STOP,
    68   /* SIGBUS      */  SIGACTION_TERMINATE,
    69   /* SIGRTMIN 21 */  SIGACTION_IGNORE,
     62  /* SIGRTMIN 14 */  SIGACTION_IGNORE,
     63  /* SIGRT    15 */  SIGACTION_IGNORE,
     64  /* SIGRT    16 */  SIGACTION_IGNORE,
     65  /* SIGRT    17 */  SIGACTION_IGNORE,
     66  /* SIGRT    18 */  SIGACTION_IGNORE,
     67  /* SIGRT    19 */  SIGACTION_IGNORE,
     68  /* SIGRT    20 */  SIGACTION_IGNORE,
     69  /* SIGRT    21 */  SIGACTION_IGNORE,
    7070  /* SIGRT    22 */  SIGACTION_IGNORE,
    7171  /* SIGRT    23 */  SIGACTION_IGNORE,
     
    109109  siginfo_t          *siginfo = NULL;  /* really needs to be set below */
    110110  siginfo_t           siginfo_struct;
     111  sigset_t            saved_signals_blocked;
    111112
    112113  mask = signo_to_mask( signo );
     
    137138          _POSIX_signals_Vectors[ signo ].sa_sigaction );
    138139 
     140  /*
     141   *  Just to prevent sending a signal which is currently being ignored.
     142   */
     143
     144  if ( _POSIX_signals_Vectors[ signo ].sa_handler == SIG_IGN )
     145    return FALSE;
     146
     147  /*
     148   *  Block the signals requested in sa_mask
     149   */
     150
     151  saved_signals_blocked = api->signals_blocked;
     152  api->signals_blocked |= _POSIX_signals_Vectors[ signo ].sa_mask;
     153
    139154  switch ( _POSIX_signals_Vectors[ signo ].sa_flags ) {
    140155    case SA_SIGINFO:
     
    156171      break;
    157172  }
     173
     174  /*
     175   *  Restore the previous set of blocked signals
     176   */
     177 
     178  api->signals_blocked = saved_signals_blocked;
     179
    158180  return TRUE;
    159181}
     
    165187  POSIX_API_Control  *api;
    166188  int                 signo;
     189  ISR_Level           level;
    167190
    168191  api = the_thread->API_Extensions[ THREAD_API_POSIX ];
     
    170193  /*
    171194   *  If we invoke any user code, there is the possibility that
    172    *  a new signal has been posted that we should process.
    173    */
    174 
    175 /* XXX somewhere we need to see if all pending signals are gone and clear */
    176 /* XXX do_post_switch_extension */
     195   *  a new signal has been posted that we should process so we
     196   *  restart the loop if a signal handler was invoked.
     197   *
     198   *  The first thing done is to check there are any signals to be
     199   *  processed at all.  No point in doing this loop otherwise.
     200   */
    177201
    178202restart:
     203  _ISR_Disable( level );
     204    if ( !(~api->signals_blocked &
     205          (api->signals_pending | _POSIX_signals_Pending)) )
     206      return;
     207  _ISR_Enable( level );
     208
    179209  for ( signo = SIGRTMIN ; signo <= SIGRTMAX ; signo++ ) {
    180210
     
    187217  }
    188218
    189   for ( signo = SIGABRT ; signo <= SIGBUS ; signo++ ) {
     219  for ( signo = SIGABRT ; signo <= __SIGLASTNOTRT ; signo++ ) {
    190220
    191221    if ( _POSIX_signals_Check_signal( api, signo, FALSE ) )
     
    371401)
    372402{
    373   if ( !act )
    374     set_errno_and_return_minus_one( EFAULT );
    375 
    376403  if ( !is_valid_signo(sig) )
    377404    set_errno_and_return_minus_one( EINVAL );
     
    380407    *oact = _POSIX_signals_Vectors[ sig ];
    381408
     409  /* XXX some signals cannot be ignored */
     410  /* XXX can't find this in spec -- ignore calls on SIGKILL and SIGSTOP */
     411  /* XXX we don't do SIGSTOP */
     412
     413  if ( sig == SIGKILL )
     414    set_errno_and_return_minus_one( EINVAL );
     415 
    382416  /* XXX need to interpret some stuff here */
    383   /* XXX some signals cannot be ignored */
    384 
    385   _POSIX_signals_Vectors[ sig ] = *act;
     417
     418  if ( act ) {
     419    _POSIX_signals_Vectors[ sig ] = *act;
     420  }
    386421
    387422  return 0;
     
    421456{
    422457  POSIX_API_Control  *api;
    423   boolean             evaluate_signals;
    424458
    425459/* XXX some signals can not be ignored */
     
    435469  if ( !set )
    436470    set_errno_and_return_minus_one( EFAULT );
    437 
    438   evaluate_signals = TRUE;
    439471
    440472  switch ( how ) {
    441473    case SIG_BLOCK:
    442474      api->signals_blocked |= *set;
    443       evaluate_signals = FALSE;
    444475      break;
    445476    case SIG_UNBLOCK:
     
    457488  /* XXX evaluate the new set */
    458489
    459   if ( evaluate_signals == TRUE ) {
    460      if ( ~api->signals_blocked &
    461           (api->signals_pending | _POSIX_signals_Pending) ) {
    462        api->signals_global_pending &= _POSIX_signals_Pending;
    463        _Thread_Executing->do_post_task_switch_extension = TRUE;
    464        _Thread_Dispatch();
    465      }
     490  if ( ~api->signals_blocked &
     491       (api->signals_pending | _POSIX_signals_Pending) ) {
     492    api->signals_global_pending &= _POSIX_signals_Pending;
     493    _Thread_Executing->do_post_task_switch_extension = TRUE;
     494    _Thread_Dispatch();
    466495  }
    467496
     
    623652        if ( api->signals_pending & ~api->signals_blocked ) {
    624653          the_thread->do_post_task_switch_extension = TRUE;
    625 
    626  
    627           /* XXX may have to unblock the task -- this is a kludge -- fix it */
     654 
     655          /* XXX unblock the task -- this is a kludge -- fix it */
     656
    628657          if ( the_thread->current_state & STATES_INTERRUPTIBLE_BY_SIGNAL ) {
    629658            the_thread->Wait.return_code = EINTR;
  • cpukit/posix/src/pthread.c

    rfb39f19 rc8f5ab5  
    2929  TRUE,                    /* is_initialized */
    3030  NULL,                    /* stackaddr */
    31   STACK_MINIMUM_SIZE,      /* stacksize */
     31  STACK_MINIMUM_SIZE * 2,  /* stacksize */
    3232  PTHREAD_SCOPE_PROCESS,   /* contentionscope */
    3333  PTHREAD_EXPLICIT_SCHED,  /* inheritsched */
Note: See TracChangeset for help on using the changeset viewer.