source: rtems/cpukit/posix/src/psignalclearsignals.c @ a112364

4.115
Last change on this file since a112364 was a112364, checked in by Sebastian Huber <sebastian.huber@…>, on 07/24/13 at 15:30:26

score: Create threadq implementation header

Move implementation specific parts of tqdata.h, threadq.h and
threadq.inl into new header file threadqimpl.h. The threadq.h contains
now only the application visible API.

Delete tqdata.h.

  • Property mode set to 100644
File size: 2.7 KB
Line 
1/**
2 * @file
3 *
4 * @brief POSIX Signals Clear Signals
5 * @ingroup POSIX_SIGNALS POSIX Signals Support
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2007.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <errno.h>
22#include <pthread.h>
23#include <signal.h>
24
25#include <rtems/system.h>
26#include <rtems/score/isr.h>
27#include <rtems/score/thread.h>
28#include <rtems/score/wkspace.h>
29#include <rtems/seterr.h>
30#include <rtems/posix/threadsup.h>
31#include <rtems/posix/psignalimpl.h>
32#include <rtems/posix/pthreadimpl.h>
33#include <rtems/posix/time.h>
34#include <stdio.h>
35
36/*
37 *  _POSIX_signals_Clear_signals
38 */
39
40bool _POSIX_signals_Clear_signals(
41  POSIX_API_Control  *api,
42  int                 signo,
43  siginfo_t          *info,
44  bool                is_global,
45  bool                check_blocked
46)
47{
48  sigset_t                    mask;
49  sigset_t                    signals_blocked;
50  ISR_Level                   level;
51  bool                        do_callout;
52  POSIX_signals_Siginfo_node *psiginfo;
53
54  mask = signo_to_mask( signo );
55
56  do_callout = false;
57
58  /* set blocked signals based on if checking for them, SIGNAL_ALL_MASK
59   * insures that no signals are blocked and all are checked.
60   */
61
62  if ( check_blocked )
63    signals_blocked = ~api->signals_blocked;
64  else
65    signals_blocked = SIGNAL_ALL_MASK;
66
67  /* XXX is this right for siginfo type signals? */
68  /* XXX are we sure they can be cleared the same way? */
69
70  _ISR_Disable( level );
71    if ( is_global ) {
72       if ( mask & (_POSIX_signals_Pending & signals_blocked) ) {
73         if ( _POSIX_signals_Vectors[ signo ].sa_flags == SA_SIGINFO ) {
74           psiginfo = (POSIX_signals_Siginfo_node *)
75             _Chain_Get_unprotected( &_POSIX_signals_Siginfo[ signo ] );
76           _POSIX_signals_Clear_process_signals( signo );
77           /*
78            *  It may be impossible to get here with an empty chain
79            *  BUT until that is proven we need to be defensive and
80            *  protect against it.
81            */
82           if ( psiginfo ) {
83             *info = psiginfo->Info;
84             _Chain_Append_unprotected(
85               &_POSIX_signals_Inactive_siginfo,
86               &psiginfo->Node
87             );
88           } else
89             do_callout = false;
90         }
91         _POSIX_signals_Clear_process_signals( signo );
92         do_callout = true;
93       }
94    } else {
95      if ( mask & (api->signals_pending & signals_blocked) ) {
96        api->signals_pending &= ~mask;
97        do_callout = true;
98      }
99    }
100  _ISR_Enable( level );
101  return do_callout;
102}
Note: See TracBrowser for help on using the repository browser.