Changeset 0997128 in rtems


Ignore:
Timestamp:
Jul 22, 2009, 9:26:56 PM (10 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
2d730043
Parents:
cdea617
Message:

2009-07-22 Joel Sherrill <joel.sherrill@…>

  • posix/src/killinfo.c: Clean up. Avoid NULL pointer case.
Location:
cpukit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    rcdea617 r0997128  
     12009-07-22      Joel Sherrill <joel.sherrill@OARcorp.com>
     2
     3        * posix/src/killinfo.c: Clean up. Avoid NULL pointer case.
     4
    152009-07-22      Joel Sherrill <joel.sherrill@OARcorp.com>
    26
  • cpukit/posix/src/killinfo.c

    rcdea617 r0997128  
    6161   *  Only supported for the "calling process" (i.e. this node).
    6262   */
    63 
    6463  if ( pid != getpid() )
    6564    rtems_set_errno_and_return_minus_one( ESRCH );
     
    6867   *  Validate the signal passed.
    6968   */
    70 
    7169  if ( !sig )
    7270    rtems_set_errno_and_return_minus_one( EINVAL );
     
    7876   *  If the signal is being ignored, then we are out of here.
    7977   */
    80 
    81   if ( _POSIX_signals_Vectors[ sig ].sa_handler == SIG_IGN ) {
     78  if ( _POSIX_signals_Vectors[ sig ].sa_handler == SIG_IGN )
    8279    return 0;
    83   }
    8480
    8581  /*
     
    8884   *  faults.
    8985   */
    90 
    9186  if ( (sig == SIGFPE) || (sig == SIGILL) || (sig == SIGSEGV ) )
    9287      return pthread_kill( pthread_self(), sig );
     
    9792   *  Build up a siginfo structure
    9893   */
    99 
    10094  siginfo = &siginfo_struct;
    10195  siginfo->si_signo = sig;
     
    113107   *  get it an execute it as soon as the dispatcher executes.
    114108   */
    115 
    116109  the_thread = _Thread_Executing;
    117110
     
    170163   *    + rtems internal threads do not receive signals.
    171164   */
    172 
    173165  interested_thread = NULL;
    174166  interested_priority = PRIORITY_MAXIMUM + 1;
     
    179171
    180172    /*
    181      *  Thie can occur when no one is interested and ITRON is not configured.
     173     *  This can occur when no one is interested and ITRON is not configured.
    182174     */
    183175    if ( !_Objects_Information_table[ the_api ] )
     
    209201       *  go on to the next thread.
    210202       */
    211 
    212203      if ( the_thread->current_priority > interested_priority )
    213204        continue;
     
    216207       *  If this thread is not interested, then go on to the next thread.
    217208       */
    218 
    219209      api = the_thread->API_Extensions[ THREAD_API_POSIX ];
    220210
     
    228218
    229219      /*
    230        *  Now we know the thread under connsideration is interested.
     220       *  If we have not seen a thread interested in this signal yet,
     221       *  then we have found the first one.
     222       */
     223      if ( !interested_thread ) {
     224        interested_thread   = the_thread;
     225        interested_priority = the_thread->current_priority;
     226        continue;
     227      }
     228
     229      /*
     230       *  Now we know the thread under consideration is interested.
    231231       *  If the thread under consideration is of higher priority, then
    232232       *  it becomes the interested thread.
    233233       */
    234 
    235234      if ( the_thread->current_priority < interested_priority ) {
    236235        interested_thread   = the_thread;
     
    244243       *  to a blocked thread.
    245244       */
    246 
    247245      if ( _States_Is_ready( interested_thread->current_state ) )
    248246        continue;
     
    253251       *  interested thread.
    254252       */
    255 
    256253      if ( _States_Is_ready( the_thread->current_state ) ) {
    257254        interested_thread   = the_thread;
     
    264261       *  If the interested thread is interruptible, then just use it.
    265262       */
    266 
    267       /* XXX need a new states macro */
    268       if ( interested_thread->current_state & STATES_INTERRUPTIBLE_BY_SIGNAL )
     263      if (_States_Is_interruptible_by_signal(interested_thread->current_state))
    269264        continue;
    270265
     
    275270       *  then it becomes the interested thread.
    276271       */
    277 
    278       /* XXX need a new states macro */
    279       if ( the_thread->current_state & STATES_INTERRUPTIBLE_BY_SIGNAL ) {
     272      if ( _States_Is_interruptible_by_signal(the_thread->current_state) ) {
    280273        interested_thread   = the_thread;
    281274        interested_priority = the_thread->current_priority;
     
    299292   *    + sigaction() which changes the handler to SIG_IGN.
    300293   */
    301 
    302294  the_thread = NULL;
    303295  goto post_process_signal;
     
    308300   *  evaluate the signals pending.
    309301   */
    310 
    311302process_it:
    312303
     
    317308   *  blocked waiting for the signal.
    318309   */
    319 
    320310  if ( _POSIX_signals_Unblock_thread( the_thread, sig, siginfo ) ) {
    321311    _Thread_Enable_dispatch();
     
    329319   *  signal to the process wide information set.
    330320   */
    331 
    332321  _POSIX_signals_Set_process_signals( mask );
    333322
     
    336325    psiginfo = (POSIX_signals_Siginfo_node *)
    337326               _Chain_Get( &_POSIX_signals_Inactive_siginfo );
    338     if ( !psiginfo ) {
     327    if ( !psiginfo )
    339328      rtems_set_errno_and_return_minus_one( EAGAIN );
    340     }
    341329
    342330    psiginfo->Info = *siginfo;
Note: See TracChangeset for help on using the changeset viewer.