source: rtems/cpukit/include/rtems/posix/psignalimpl.h

Last change on this file was a660e9dc, checked in by Sebastian Huber <sebastian.huber@…>, on 09/08/22 at 08:37:05

Do not use RTEMS_INLINE_ROUTINE

Directly use "static inline" which is available in C99 and later. This brings
the RTEMS implementation closer to standard C.

Close #3935.

  • Property mode set to 100644
File size: 4.2 KB
Line 
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/**
4 * @file
5 *
6 * @brief POSIX Signals Support
7 *
8 * This include file defines internal information about POSIX signals.
9 */
10
11/*
12 *  COPYRIGHT (c) 1989-2013.
13 *  On-Line Applications Research Corporation (OAR).
14 *
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions
17 * are met:
18 * 1. Redistributions of source code must retain the above copyright
19 *    notice, this list of conditions and the following disclaimer.
20 * 2. Redistributions in binary form must reproduce the above copyright
21 *    notice, this list of conditions and the following disclaimer in the
22 *    documentation and/or other materials provided with the distribution.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#ifndef _RTEMS_POSIX_PSIGNALIMPL_H
38#define _RTEMS_POSIX_PSIGNALIMPL_H
39
40/**
41 * @defgroup POSIX_SIGNALS POSIX Signals Support
42 *
43 * @ingroup POSIXAPI
44 *
45 * @brief Internal Information about POSIX Signals
46 *
47 */
48/**@{**/
49
50#include <rtems/posix/psignal.h>
51#include <rtems/posix/pthread.h>
52#include <rtems/posix/sigset.h>
53#include <rtems/score/isrlock.h>
54#include <rtems/score/percpu.h>
55#include <rtems/score/threadqimpl.h>
56
57#define POSIX_SIGNALS_TQ_OPERATIONS &_Thread_queue_Operations_FIFO
58
59#define _States_Is_interruptible_signal( _states ) \
60  ( ((_states) & \
61    (STATES_WAITING_FOR_SIGNAL|STATES_INTERRUPTIBLE_BY_SIGNAL)) == \
62      (STATES_WAITING_FOR_SIGNAL|STATES_INTERRUPTIBLE_BY_SIGNAL))
63
64#define SIGACTION_TERMINATE \
65  { 0, SIGNAL_ALL_MASK, {_POSIX_signals_Abnormal_termination_handler} }
66#define SIGACTION_IGNORE \
67  { 0, SIGNAL_ALL_MASK, {SIG_IGN} }
68#define SIGACTION_STOP \
69  { 0, SIGNAL_ALL_MASK, {_POSIX_signals_Stop_handler} }
70#define SIGACTION_CONTINUE \
71  { 0, SIGNAL_ALL_MASK, {_POSIX_signals_Continue_handler} }
72
73#define SIG_ARRAY_MAX  (SIGRTMAX + 1)
74
75/*
76 *  Variables
77 */
78
79extern sigset_t  _POSIX_signals_Pending;
80
81extern const struct sigaction _POSIX_signals_Default_vectors[ SIG_ARRAY_MAX ];
82
83extern struct sigaction _POSIX_signals_Vectors[ SIG_ARRAY_MAX ];
84
85extern Thread_queue_Control _POSIX_signals_Wait_queue;
86
87extern Chain_Control _POSIX_signals_Inactive_siginfo;
88
89extern Chain_Control _POSIX_signals_Siginfo[ SIG_ARRAY_MAX ];
90
91/*
92 *  Internal routines
93 */
94
95static inline void _POSIX_signals_Acquire(
96  Thread_queue_Context *queue_context
97)
98{
99  _Thread_queue_Acquire( &_POSIX_signals_Wait_queue, queue_context );
100}
101
102static inline void _POSIX_signals_Release(
103  Thread_queue_Context *queue_context
104)
105{
106  _Thread_queue_Release( &_POSIX_signals_Wait_queue, queue_context );
107}
108
109/**
110 * @brief Unlock POSIX signals thread.
111 */
112bool _POSIX_signals_Unblock_thread(
113  Thread_Control  *the_thread,
114  int              signo,
115  siginfo_t       *info
116);
117
118/**
119 * @brief Clear POSIX signals.
120 */
121bool _POSIX_signals_Clear_signals(
122  POSIX_API_Control  *api,
123  int                 signo,
124  siginfo_t          *info,
125  bool                is_global,
126  bool                check_blocked,
127  bool                do_signals_acquire_release
128);
129
130int _POSIX_signals_Send(
131  pid_t               pid,
132  int                 sig,
133  const union sigval *value
134);
135
136/**
137 *  @brief Set POSIX process signals.
138 */
139void _POSIX_signals_Set_process_signals(
140  sigset_t   mask
141);
142
143void _POSIX_signals_Clear_process_signals(
144  int        signo
145);
146
147/*
148 *  Default signal handlers
149 */
150
151#define _POSIX_signals_Stop_handler NULL
152#define _POSIX_signals_Continue_handler NULL
153
154void _POSIX_signals_Abnormal_termination_handler( int signo );
155
156/** @} */
157
158#endif
159/* end of file */
Note: See TracBrowser for help on using the repository browser.