6
6
7
7
#include "_common.h"
8
8
9
+ #include <stdlib.h>
10
+
9
11
#ifdef CONFIG_POSIX_API
10
12
#include <signal.h>
11
13
#else
19
21
*/
20
22
ZTEST (posix_headers , test_signal_h )
21
23
{
22
- /* zassert_not_equal(-1, SIG_DFL); */ /* not implemented */
23
- /* zassert_not_equal(-1, SIG_ERR); */ /* not implemented */
24
+ typedef void * (* my_sig_handler_t )(int signo );
25
+
26
+ my_sig_handler_t handler ;
27
+
28
+ handler = SIG_DFL ;
29
+ handler = SIG_ERR ;
30
+ handler = SIG_IGN ;
24
31
/* zassert_not_equal(-1, SIG_HOLD); */ /* not implemented */
25
- /* zassert_not_equal(-1, SIG_IGN); */ /* not implemented */
26
32
27
33
zassert_not_equal ((sig_atomic_t )- 1 , (sig_atomic_t )0 );
28
- /* zassert_not_equal((pid_t)-1, (pid_t)0); */ /* not implemented */
34
+ zassert_not_equal ((pid_t )- 1 , (pid_t )0 );
29
35
30
36
zassert_not_equal (-1 , offsetof(struct sigevent , sigev_notify ));
31
37
zassert_not_equal (-1 , offsetof(struct sigevent , sigev_signo ));
@@ -47,6 +53,15 @@ ZTEST(posix_headers, test_signal_h)
47
53
zassert_not_equal (-1 , SIG_UNBLOCK );
48
54
zassert_not_equal (-1 , SIG_SETMASK );
49
55
56
+ zassert_not_equal (-1 , offsetof(struct sigaction , sa_handler ));
57
+ zassert_not_equal (-1 , offsetof(struct sigaction , sa_mask ));
58
+ zassert_not_equal (-1 , offsetof(struct sigaction , sa_flags ));
59
+ zassert_not_equal (-1 , offsetof(struct sigaction , sa_sigaction ));
60
+
61
+ zassert_not_equal (-1 , offsetof(siginfo_t , si_signo ));
62
+ zassert_not_equal (-1 , offsetof(siginfo_t , si_code ));
63
+ zassert_not_equal (-1 , offsetof(siginfo_t , si_value ));
64
+
50
65
/* zassert_not_equal(-1, SA_NOCLDSTOP); */ /* not implemented */
51
66
/* zassert_not_equal(-1, SA_ONSTACK); */ /* not implemented */
52
67
/* zassert_not_equal(-1, SA_RESETHAND); */ /* not implemented */
@@ -117,18 +132,11 @@ ZTEST(posix_headers, test_signal_h)
117
132
/* zassert_not_equal(-1, CLD_STOPPED); */ /* not implemented */
118
133
/* zassert_not_equal(-1, CLD_CONTINUED); */ /* not implemented */
119
134
120
- /* zassert_not_equal(-1, POLL_IN); */ /* not implemented */
121
- /* zassert_not_equal(-1, POLL_OUT); */ /* not implemented */
122
- /* zassert_not_equal(-1, POLL_MSG); */ /* not implemented */
123
- /* zassert_not_equal(-1, POLL_ERR); */ /* not implemented */
124
- /* zassert_not_equal(-1, POLL_PRI); */ /* not implemented */
125
- /* zassert_not_equal(-1, POLL_HUP); */ /* not implemented */
126
-
127
- /* zassert_not_equal(-1, SI_USER); */ /* not implemented */
128
- /* zassert_not_equal(-1, SI_QUEUE); */ /* not implemented */
129
- /* zassert_not_equal(-1, SI_TIMER); */ /* not implemented */
130
- /* zassert_not_equal(-1, SI_ASYNCIO); */ /* not implemented */
131
- /* zassert_not_equal(-1, SI_MESGQ); */ /* not implemented */
135
+ zassert_not_equal (-1 , SI_USER );
136
+ zassert_not_equal (-1 , SI_QUEUE );
137
+ zassert_not_equal (-1 , SI_TIMER );
138
+ zassert_not_equal (-1 , SI_ASYNCIO );
139
+ zassert_not_equal (-1 , SI_MESGQ );
132
140
133
141
#ifdef CONFIG_POSIX_SIGNALS
134
142
zassert_true (SIGRTMIN >= 0 );
@@ -158,37 +166,40 @@ ZTEST(posix_headers, test_signal_h)
158
166
zassert_not_equal (-1 , SIGXCPU );
159
167
zassert_not_equal (-1 , SIGXFSZ );
160
168
zassert_not_equal (((sigset_t ){.sig [0 ] = 0 }).sig [0 ], ((sigset_t ){.sig [0 ] = -1 }).sig [0 ]);
161
- zassert_not_null (sigemptyset );
162
- zassert_not_null (sigfillset );
169
+ zassert_not_null (abort );
170
+ zassert_not_null (alarm );
171
+ zassert_not_null (kill );
172
+ zassert_not_null (pause );
173
+ zassert_not_null (pthread_sigmask );
174
+ zassert_not_null (raise );
175
+ zassert_not_null (sigaction );
163
176
zassert_not_null (sigaddset );
164
177
zassert_not_null (sigdelset );
178
+ zassert_not_null (sigemptyset );
179
+ zassert_not_null (sigfillset );
165
180
zassert_not_null (sigismember );
166
- zassert_not_null (strsignal );
181
+ zassert_not_null (signal );
182
+ zassert_not_null (sigpending );
167
183
zassert_not_null (sigprocmask );
168
- zassert_not_null (pthread_sigmask );
184
+ zassert_not_null (sigsuspend );
185
+ zassert_not_null (sigwait );
186
+ zassert_not_null (strsignal );
169
187
#endif /* CONFIG_POSIX_SIGNALS */
170
188
171
189
if (IS_ENABLED (CONFIG_POSIX_API )) {
172
- /* zassert_not_null(kill); */ /* not implemented */
173
190
/* zassert_not_null(killpg); */ /* not implemented */
174
191
/* zassert_not_null(psiginfo); */ /* not implemented */
175
192
/* zassert_not_null(psignal); */ /* not implemented */
176
193
/* zassert_not_null(pthread_kill); */ /* not implemented */
177
- /* zassert_not_null(raise); */ /* not implemented */
178
- /* zassert_not_null(sigaction); */ /* not implemented */
179
194
/* zassert_not_null(sigaltstack); */ /* not implemented */
180
195
/* zassert_not_null(sighold); */ /* not implemented */
181
196
/* zassert_not_null(sigignore); */ /* not implemented */
182
197
/* zassert_not_null(siginterrupt); */ /* not implemented */
183
- /* zassert_not_null(signal); */ /* not implemented */
184
198
/* zassert_not_null(sigpause); */ /* not implemented */
185
- /* zassert_not_null(sigpending); */ /* not implemented */
186
199
/* zassert_not_null(sigqueue); */ /* not implemented */
187
200
/* zassert_not_null(sigrelse); */ /* not implemented */
188
201
/* zassert_not_null(sigset); */ /* not implemented */
189
- /* zassert_not_null(sigsuspend); */ /* not implemented */
190
202
/* zassert_not_null(sigtimedwait); */ /* not implemented */
191
- /* zassert_not_null(sigwait); */ /* not implemented */
192
203
/* zassert_not_null(sigwaitinfo); */ /* not implemented */
193
204
}
194
205
}
0 commit comments