source: rtems/cpukit/posix/src/psignalclearsignals.c @ 188c82b

4.104.114.84.95
Last change on this file since 188c82b was 188c82b, checked in by Joel Sherrill <joel.sherrill@…>, on 08/30/00 at 17:12:55

2000-08-30 Joel Sherrill <joel@…>

  • Many files: Moved posix/include/rtems/posix/seterr.h to score/include/rtems/seterr.h so it would be available within all APIs.
  • Property mode set to 100644
File size: 2.3 KB
Line 
1/*
2 *  $Id$
3 */
4
5#include <assert.h>
6#include <errno.h>
7#include <pthread.h>
8#include <signal.h>
9
10#include <rtems/system.h>
11#include <rtems/score/isr.h>
12#include <rtems/score/thread.h>
13#include <rtems/score/tqdata.h>
14#include <rtems/score/wkspace.h>
15#include <rtems/seterr.h>
16#include <rtems/posix/threadsup.h>
17#include <rtems/posix/psignal.h>
18#include <rtems/posix/pthread.h>
19#include <rtems/posix/time.h>
20#include <stdio.h>
21
22/*PAGE
23 *
24 *  _POSIX_signals_Clear_signals
25 */
26 
27boolean _POSIX_signals_Clear_signals(
28  POSIX_API_Control  *api,
29  int                 signo,
30  siginfo_t          *info,
31  boolean             is_global,
32  boolean             check_blocked
33)
34{
35  sigset_t                    mask;
36  sigset_t                    signals_blocked;
37  ISR_Level                   level;
38  boolean                     do_callout;
39  POSIX_signals_Siginfo_node *psiginfo;
40 
41  mask = signo_to_mask( signo );
42 
43  do_callout = FALSE;
44 
45  /* set blocked signals based on if checking for them, SIGNAL_ALL_MASK
46   * insures that no signals are blocked and all are checked.
47   */
48
49  if ( check_blocked )
50    signals_blocked = ~api->signals_blocked;
51  else
52    signals_blocked = SIGNAL_ALL_MASK;
53
54  /* XXX this is not right for siginfo type signals yet */
55  /* XXX since they can't be cleared the same way */
56 
57  _ISR_Disable( level );
58    if ( is_global ) {
59       if ( mask & (_POSIX_signals_Pending & signals_blocked) ) {
60         if ( _POSIX_signals_Vectors[ signo ].sa_flags == SA_SIGINFO ) {
61           psiginfo = (POSIX_signals_Siginfo_node *)
62             _Chain_Get_unprotected( &_POSIX_signals_Siginfo[ signo ] );
63           if ( _Chain_Is_empty( &_POSIX_signals_Siginfo[ signo ] ) )
64             _POSIX_signals_Clear_process_signals( mask );
65           if ( psiginfo ) {
66             *info = psiginfo->Info;
67             _Chain_Append_unprotected(
68               &_POSIX_signals_Inactive_siginfo,
69               &psiginfo->Node
70             );
71           } else
72             do_callout = FALSE;
73         } else
74           _POSIX_signals_Clear_process_signals( mask );
75         do_callout = TRUE;
76       }
77    } else {
78      if ( mask & (api->signals_pending & signals_blocked) ) {
79        api->signals_pending &= ~mask;
80        do_callout = TRUE;
81      }
82    }
83  _ISR_Enable( level );
84  return do_callout;
85}
Note: See TracBrowser for help on using the repository browser.