1 | /* |
---|
2 | * COPYRIGHT (c) 1989-1999. |
---|
3 | * On-Line Applications Research Corporation (OAR). |
---|
4 | * |
---|
5 | * The license and distribution terms for this file may be |
---|
6 | * found in the file LICENSE in this distribution or at |
---|
7 | * http://www.OARcorp.com/rtems/license.html. |
---|
8 | * |
---|
9 | * $Id$ |
---|
10 | */ |
---|
11 | |
---|
12 | #define CONFIGURE_INIT |
---|
13 | #include "system.h" |
---|
14 | #include <signal.h> |
---|
15 | #include <errno.h> |
---|
16 | |
---|
17 | volatile int Signal_occurred; |
---|
18 | volatile int Signal_count; |
---|
19 | |
---|
20 | void Signal_handler( |
---|
21 | int signo |
---|
22 | ) |
---|
23 | { |
---|
24 | Signal_count++; |
---|
25 | printf( |
---|
26 | "Signal: %d caught by 0x%x (%d)\n", |
---|
27 | signo, |
---|
28 | pthread_self(), |
---|
29 | Signal_count |
---|
30 | ); |
---|
31 | Signal_occurred = 1; |
---|
32 | } |
---|
33 | |
---|
34 | void Signal_info_handler( |
---|
35 | int signo, |
---|
36 | siginfo_t *info, |
---|
37 | void *context |
---|
38 | ) |
---|
39 | { |
---|
40 | Signal_count++; |
---|
41 | printf( |
---|
42 | "Signal_info: %d caught by 0x%x (%d) si_signo= %d si_code= %d value= %d\n", |
---|
43 | signo, |
---|
44 | pthread_self(), |
---|
45 | Signal_count, |
---|
46 | info->si_signo, |
---|
47 | info->si_code, |
---|
48 | info->si_value.sival_int |
---|
49 | ); |
---|
50 | Signal_occurred = 1; |
---|
51 | } |
---|
52 | |
---|
53 | void *POSIX_Init( |
---|
54 | void *argument |
---|
55 | ) |
---|
56 | { |
---|
57 | int status; |
---|
58 | struct sigaction act; |
---|
59 | sigset_t mask; |
---|
60 | sigset_t pending_set; |
---|
61 | sigset_t oset; |
---|
62 | struct timespec timeout; |
---|
63 | siginfo_t info; |
---|
64 | |
---|
65 | puts( "\n\n*** POSIX TEST 4 ***" ); |
---|
66 | |
---|
67 | /* set the time of day, and print our buffer in multiple ways */ |
---|
68 | |
---|
69 | set_time( TM_FRIDAY, TM_MAY, 24, 96, 11, 5, 0 ); |
---|
70 | |
---|
71 | /* get id of this thread */ |
---|
72 | |
---|
73 | Init_id = pthread_self(); |
---|
74 | printf( "Init's ID is 0x%08x\n", Init_id ); |
---|
75 | |
---|
76 | /* install a signal handler for SIGUSR1 */ |
---|
77 | |
---|
78 | status = sigemptyset( &act.sa_mask ); |
---|
79 | assert( !status ); |
---|
80 | printf( "Init: sigemptyset - set= 0x%08x\n", act.sa_mask ); |
---|
81 | |
---|
82 | /* test sigfillset following the above sigemptyset */ |
---|
83 | |
---|
84 | status = sigfillset( &act.sa_mask ); |
---|
85 | assert( !status ); |
---|
86 | printf( "Init: sigfillset - set= 0x%08x\n", act.sa_mask ); |
---|
87 | |
---|
88 | /* test sigdelset */ |
---|
89 | |
---|
90 | status = sigdelset( &act.sa_mask, SIGUSR1 ); |
---|
91 | assert( !status ); |
---|
92 | printf( "Init: sigdelset - delete SIGUSR1 set= 0x%08x\n", act.sa_mask ); |
---|
93 | |
---|
94 | /* test sigismember - FALSE */ |
---|
95 | |
---|
96 | status = sigismember( &act.sa_mask, SIGUSR1 ); |
---|
97 | assert( !status ); |
---|
98 | puts( "Init: sigismember - FALSE since SIGUSR1 is not a member" ); |
---|
99 | |
---|
100 | /* test sigismember - TRUE */ |
---|
101 | |
---|
102 | status = sigismember( &act.sa_mask, SIGUSR2 ); |
---|
103 | assert( status ); |
---|
104 | puts( "Init: sigismember - TRUE since SIGUSR2 is a member" ); |
---|
105 | |
---|
106 | /* return the set to empty */ |
---|
107 | |
---|
108 | act.sa_handler = Signal_handler; |
---|
109 | act.sa_flags = 0; |
---|
110 | |
---|
111 | sigaction( SIGUSR1, &act, NULL ); |
---|
112 | |
---|
113 | /* simple signal to process */ |
---|
114 | |
---|
115 | Signal_count = 0; |
---|
116 | Signal_occurred = 0; |
---|
117 | |
---|
118 | puts( "Init: send SIGUSR1 to process" ); |
---|
119 | status = kill( getpid(), SIGUSR1 ); |
---|
120 | assert( !status ); |
---|
121 | |
---|
122 | /* end of install a signal handler for SIGUSR1 */ |
---|
123 | |
---|
124 | Signal_occurred = 0; |
---|
125 | |
---|
126 | /* now block the signal, send it, see if it is pending, and unblock it */ |
---|
127 | |
---|
128 | empty_line(); |
---|
129 | |
---|
130 | status = sigemptyset( &mask ); |
---|
131 | assert( !status ); |
---|
132 | |
---|
133 | status = sigaddset( &mask, SIGUSR1 ); |
---|
134 | assert( !status ); |
---|
135 | |
---|
136 | puts( "Init: Block SIGUSR1" ); |
---|
137 | act.sa_handler = Signal_handler; |
---|
138 | act.sa_flags = 0; |
---|
139 | |
---|
140 | sigaction( SIGUSR1, &act, NULL ); |
---|
141 | |
---|
142 | /* simple signal to process */ |
---|
143 | |
---|
144 | Signal_count = 0; |
---|
145 | Signal_occurred = 0; |
---|
146 | |
---|
147 | puts( "Init: send SIGUSR1 to process" ); |
---|
148 | status = kill( getpid(), SIGUSR1 ); |
---|
149 | assert( !status ); |
---|
150 | |
---|
151 | Signal_occurred = 0; |
---|
152 | |
---|
153 | /* now block the signal, send it, see if it is pending, and unblock it */ |
---|
154 | |
---|
155 | empty_line(); |
---|
156 | |
---|
157 | status = sigemptyset( &mask ); |
---|
158 | assert( !status ); |
---|
159 | |
---|
160 | status = sigaddset( &mask, SIGUSR1 ); |
---|
161 | assert( !status ); |
---|
162 | |
---|
163 | puts( "Init: Block SIGUSR1" ); |
---|
164 | status = sigprocmask( SIG_BLOCK, &mask, NULL ); |
---|
165 | assert( !status ); |
---|
166 | |
---|
167 | status = sigpending( &pending_set ); |
---|
168 | assert( !status ); |
---|
169 | printf( "Init: Signals pending 0x%08x\n", pending_set ); |
---|
170 | |
---|
171 | puts( "Init: send SIGUSR1 to process" ); |
---|
172 | status = kill( getpid(), SIGUSR1 ); |
---|
173 | assert( !status ); |
---|
174 | |
---|
175 | status = sigpending( &pending_set ); |
---|
176 | assert( !status ); |
---|
177 | printf( "Init: Signals pending 0x%08x\n", pending_set ); |
---|
178 | |
---|
179 | puts( "Init: Unblock SIGUSR1" ); |
---|
180 | status = sigprocmask( SIG_UNBLOCK, &mask, NULL ); |
---|
181 | assert( !status ); |
---|
182 | |
---|
183 | /* now let another task get interrupted by a signal */ |
---|
184 | |
---|
185 | empty_line(); |
---|
186 | |
---|
187 | puts( "Init: create a thread interested in SIGUSR1" ); |
---|
188 | status = pthread_create( &Task1_id, NULL, Task_1, NULL ); |
---|
189 | assert( !status ); |
---|
190 | |
---|
191 | puts( "Init: Block SIGUSR1" ); |
---|
192 | status = sigprocmask( SIG_BLOCK, &mask, NULL ); |
---|
193 | assert( !status ); |
---|
194 | |
---|
195 | status = sigpending( &pending_set ); |
---|
196 | assert( !status ); |
---|
197 | printf( "Init: Signals pending 0x%08x\n", pending_set ); |
---|
198 | |
---|
199 | puts( "Init: sleep so the other task can block" ); |
---|
200 | status = sleep( 1 ); |
---|
201 | assert( !status ); |
---|
202 | |
---|
203 | /* switch to task 1 */ |
---|
204 | |
---|
205 | puts( "Init: send SIGUSR1 to process" ); |
---|
206 | status = kill( getpid(), SIGUSR1 ); |
---|
207 | assert( !status ); |
---|
208 | |
---|
209 | status = sigpending( &pending_set ); |
---|
210 | assert( !status ); |
---|
211 | printf( "Init: Signals pending 0x%08x\n", pending_set ); |
---|
212 | |
---|
213 | puts( "Init: sleep so the other task can catch signal" ); |
---|
214 | status = sleep( 1 ); |
---|
215 | assert( !status ); |
---|
216 | |
---|
217 | /* switch to task 1 */ |
---|
218 | |
---|
219 | /* test alarm */ |
---|
220 | |
---|
221 | empty_line(); |
---|
222 | |
---|
223 | /* install a signal handler for SIGALRM and unblock it */ |
---|
224 | |
---|
225 | status = sigemptyset( &act.sa_mask ); |
---|
226 | assert( !status ); |
---|
227 | |
---|
228 | act.sa_handler = Signal_handler; |
---|
229 | act.sa_flags = 0; |
---|
230 | |
---|
231 | sigaction( SIGALRM, &act, NULL ); |
---|
232 | |
---|
233 | status = sigemptyset( &mask ); |
---|
234 | assert( !status ); |
---|
235 | |
---|
236 | status = sigaddset( &mask, SIGALRM ); |
---|
237 | assert( !status ); |
---|
238 | |
---|
239 | puts( "Init: Unblock SIGALRM" ); |
---|
240 | status = sigprocmask( SIG_UNBLOCK, &mask, NULL ); |
---|
241 | assert( !status ); |
---|
242 | |
---|
243 | /* schedule the alarm */ |
---|
244 | |
---|
245 | puts( "Init: Firing alarm in 5 seconds" ); |
---|
246 | status = alarm( 5 ); |
---|
247 | printf( "Init: %d seconds left on previous alarm\n", status ); |
---|
248 | assert( !status ); |
---|
249 | |
---|
250 | puts( "Init: Firing alarm in 2 seconds" ); |
---|
251 | status = alarm( 2 ); |
---|
252 | printf( "Init: %d seconds left on previous alarm\n", status ); |
---|
253 | assert( status ); |
---|
254 | |
---|
255 | puts( "Init: Wait 4 seconds for alarm" ); |
---|
256 | status = sleep( 4 ); |
---|
257 | printf( "Init: %d seconds left in sleep\n", status ); |
---|
258 | assert( status ); |
---|
259 | |
---|
260 | /* test SIG_SETMASK case and returning oset of pthread_sigmask */ |
---|
261 | |
---|
262 | empty_line(); |
---|
263 | |
---|
264 | status = sigemptyset( &mask ); |
---|
265 | assert( !status ); |
---|
266 | |
---|
267 | status = sigaddset( &mask, SIGUSR1 ); |
---|
268 | assert( !status ); |
---|
269 | |
---|
270 | status = sigaddset( &mask, SIGUSR2 ); |
---|
271 | assert( !status ); |
---|
272 | |
---|
273 | puts( "Init: Block SIGUSR1 and SIGUSR2 only" ); |
---|
274 | status = pthread_sigmask( SIG_SETMASK, &mask, &oset ); |
---|
275 | printf( "Init: Previous blocked set was 0x%08x\n", oset ); |
---|
276 | assert( !status ); |
---|
277 | |
---|
278 | /* test inquiry about current blocked set with pthread_sigmask */ |
---|
279 | |
---|
280 | status = pthread_sigmask( 0, NULL, &oset ); |
---|
281 | printf( "Init: Current blocked set is 0x%08x\n", oset ); |
---|
282 | assert( !status ); |
---|
283 | |
---|
284 | /* return blocked mask to no signals blocked */ |
---|
285 | |
---|
286 | status = sigemptyset( &mask ); |
---|
287 | assert( !status ); |
---|
288 | |
---|
289 | puts( "Init: Unblock all signals" ); |
---|
290 | status = pthread_sigmask( SIG_SETMASK, &mask, &oset ); |
---|
291 | printf( "Init: Previous blocked set was 0x%08x\n", oset ); |
---|
292 | assert( !status ); |
---|
293 | |
---|
294 | /* test sigsuspend */ |
---|
295 | |
---|
296 | empty_line(); |
---|
297 | |
---|
298 | puts( "Init: create a thread to send Init SIGUSR1" ); |
---|
299 | status = pthread_create( &Task2_id, NULL, Task_2, NULL ); |
---|
300 | assert( !status ); |
---|
301 | |
---|
302 | status = sigemptyset( &mask ); |
---|
303 | assert( !status ); |
---|
304 | |
---|
305 | puts( "Init: sigsuspend for any signal" ); |
---|
306 | status = sigsuspend( &mask ); |
---|
307 | assert( status ); |
---|
308 | printf( "Init: awakended from sigsuspend status=%08d \n", status ); |
---|
309 | |
---|
310 | /* test a SIGINFO case, these are signals sent to a process only */ |
---|
311 | |
---|
312 | empty_line(); |
---|
313 | |
---|
314 | puts( "Init: create a thread to sent Process SIGUSR1 with SA_SIGINFO" ); |
---|
315 | status = pthread_create( &Task3_id, NULL, Task_3, NULL ); |
---|
316 | assert( !status ); |
---|
317 | |
---|
318 | /* set action on SIGUSR1 to an info case */ |
---|
319 | act.sa_handler = Signal_handler; |
---|
320 | act.sa_flags = SA_SIGINFO; |
---|
321 | act.sa_sigaction = Signal_info_handler; |
---|
322 | |
---|
323 | sigaction( SIGUSR1, &act, NULL ); |
---|
324 | |
---|
325 | puts( "Init: sleep so the Task_3 can sigqueue SIGUSR1" ); |
---|
326 | status = sleep( 1 ); |
---|
327 | assert( !status ); |
---|
328 | |
---|
329 | /* switch to task 1 */ |
---|
330 | |
---|
331 | puts( "Init: sigqueue occurred" ); |
---|
332 | |
---|
333 | /* Send SIGUSR1, Task_3 has issued a sigwaitinfo */ |
---|
334 | |
---|
335 | status = sigemptyset( &mask ); |
---|
336 | assert( !status ); |
---|
337 | |
---|
338 | status = sigaddset( &mask, SIGUSR1 ); |
---|
339 | assert( !status ); |
---|
340 | |
---|
341 | puts( "Init: Block SIGUSR1" ); |
---|
342 | status = sigprocmask( SIG_BLOCK, &mask, NULL ); |
---|
343 | assert( !status ); |
---|
344 | |
---|
345 | puts( "Init: send SIGUSR1 to process" ); |
---|
346 | status = kill( getpid(), SIGUSR1 ); |
---|
347 | assert( !status ); |
---|
348 | |
---|
349 | puts( "Init: sleep so the Task_3 can receive SIGUSR1" ); |
---|
350 | status = sleep( 1 ); |
---|
351 | assert( !status ); |
---|
352 | |
---|
353 | /* Send SIGUSR1, Task_3 has issued a sigwait */ |
---|
354 | |
---|
355 | status = sigemptyset( &mask ); |
---|
356 | assert( !status ); |
---|
357 | |
---|
358 | status = sigaddset( &mask, SIGUSR1 ); |
---|
359 | assert( !status ); |
---|
360 | |
---|
361 | puts( "Init: Block SIGUSR1" ); |
---|
362 | status = sigprocmask( SIG_BLOCK, &mask, NULL ); |
---|
363 | assert( !status ); |
---|
364 | |
---|
365 | puts( "Init: send SIGUSR1 to process" ); |
---|
366 | status = kill( getpid(), SIGUSR1 ); |
---|
367 | assert( !status ); |
---|
368 | |
---|
369 | puts( "Init: sleep so the Task_3 can receive SIGUSR1" ); |
---|
370 | status = sleep( 1 ); |
---|
371 | assert( !status ); |
---|
372 | |
---|
373 | /* Send SIGUSR1, Task_3 has issued a sigwaitinfo */ |
---|
374 | |
---|
375 | status = sigemptyset( &mask ); |
---|
376 | assert( !status ); |
---|
377 | |
---|
378 | status = sigaddset( &mask, SIGUSR2 ); |
---|
379 | assert( !status ); |
---|
380 | |
---|
381 | puts( "Init: Block SIGUSR2" ); |
---|
382 | status = sigprocmask( SIG_BLOCK, &mask, NULL ); |
---|
383 | assert( !status ); |
---|
384 | |
---|
385 | puts( "Init: send SIGUSR2 to process" ); |
---|
386 | status = kill( getpid(), SIGUSR2 ); |
---|
387 | assert( !status ); |
---|
388 | |
---|
389 | puts( "Init: sleep so the Task_3 can receive SIGUSR2" ); |
---|
390 | status = sleep( 1 ); |
---|
391 | assert( !status ); |
---|
392 | |
---|
393 | /* Suspend for signal that has already be sent */ |
---|
394 | |
---|
395 | puts( "Init: sigsuspend for any signal" ); |
---|
396 | status = sigsuspend( &mask ); |
---|
397 | assert( status ); |
---|
398 | printf( "Init: awakended from sigsuspend status=%d \n", status ); |
---|
399 | |
---|
400 | /* generate error cases for psignal */ |
---|
401 | |
---|
402 | empty_line(); |
---|
403 | |
---|
404 | status = sigemptyset( NULL ); |
---|
405 | if ( status != -1 ) |
---|
406 | printf( "status = %d\n", status ); |
---|
407 | assert( errno == EINVAL ); |
---|
408 | puts( "Init: sigemptyset - EINVAL (set invalid)" ); |
---|
409 | |
---|
410 | status = sigfillset( NULL ); |
---|
411 | if ( status != -1 ) |
---|
412 | printf( "status = %d\n", status ); |
---|
413 | assert( errno == EINVAL ); |
---|
414 | puts( "Init: sigfillset - EINVAL (set invalid)" ); |
---|
415 | |
---|
416 | status = sigaddset( NULL, SIGUSR1 ); |
---|
417 | if ( status != -1 ) |
---|
418 | printf( "status = %d\n", status ); |
---|
419 | assert( errno == EINVAL ); |
---|
420 | puts( "Init: sigaddset - EINVAL (set invalid)" ); |
---|
421 | |
---|
422 | status = sigaddset( &mask, 0 ); |
---|
423 | assert( !status ); |
---|
424 | puts( "Init: sigaddset - SUCCESSFUL (signal = 0)" ); |
---|
425 | |
---|
426 | status = sigaddset( &mask, 999 ); |
---|
427 | if ( status != -1 ) |
---|
428 | printf( "status = %d\n", status ); |
---|
429 | assert( errno == EINVAL ); |
---|
430 | puts( "Init: sigaddset - EINVAL (set invalid)" ); |
---|
431 | |
---|
432 | status = sigdelset( NULL, SIGUSR1 ); |
---|
433 | if ( status != -1 ) |
---|
434 | printf( "status = %d\n", status ); |
---|
435 | assert( errno == EINVAL ); |
---|
436 | puts( "Init: sigdelset - EINVAL (set invalid)" ); |
---|
437 | |
---|
438 | status = sigdelset( &mask, 0 ); |
---|
439 | assert( !status ); |
---|
440 | puts( "Init: sigdelset - SUCCESSFUL (signal = 0)" ); |
---|
441 | |
---|
442 | status = sigdelset( &mask, 999 ); |
---|
443 | if ( status != -1 ) |
---|
444 | printf( "status = %d\n", status ); |
---|
445 | assert( errno == EINVAL ); |
---|
446 | puts( "Init: sigdelset - EINVAL (set invalid)" ); |
---|
447 | |
---|
448 | status = sigismember( NULL, SIGUSR1 ); |
---|
449 | if ( status != -1 ) |
---|
450 | printf( "status = %d\n", status ); |
---|
451 | assert( errno == EINVAL ); |
---|
452 | puts( "Init: sigismember - EINVAL (set invalid)" ); |
---|
453 | |
---|
454 | status = sigismember( &mask, 0 ); |
---|
455 | assert( !status ); |
---|
456 | puts( "Init: sigismember - SUCCESSFUL (signal = 0)" ); |
---|
457 | |
---|
458 | status = sigismember( &mask, 999 ); |
---|
459 | if ( status != -1 ) |
---|
460 | printf( "status = %d\n", status ); |
---|
461 | assert( errno == EINVAL ); |
---|
462 | puts( "Init: sigismember - EINVAL (signal invalid)" ); |
---|
463 | |
---|
464 | status = sigaction( 0, &act, 0 ); |
---|
465 | assert( !status ); |
---|
466 | puts( "Init: sigaction - SUCCESSFUL (signal = 0)" ); |
---|
467 | |
---|
468 | status = sigaction( 999, &act, NULL ); |
---|
469 | if ( status != -1 ) |
---|
470 | printf( "status = %d\n", status ); |
---|
471 | assert( errno == EINVAL ); |
---|
472 | puts( "Init: sigaction - EINVAL (signal invalid)" ); |
---|
473 | |
---|
474 | status = sigaction( SIGKILL, &act, NULL ); |
---|
475 | if ( status != -1 ) |
---|
476 | printf( "status = %d\n", status ); |
---|
477 | assert( errno == EINVAL ); |
---|
478 | puts( "Init: sigaction - EINVAL (SIGKILL)" ); |
---|
479 | |
---|
480 | status = pthread_sigmask( SIG_BLOCK, NULL, NULL ); |
---|
481 | if ( status != -1 ) |
---|
482 | printf( "status = %d\n", status ); |
---|
483 | assert( errno == EINVAL ); |
---|
484 | puts( "Init: pthread_sigmask - EINVAL (set and oset invalid)" ); |
---|
485 | |
---|
486 | status = pthread_sigmask( 999, &pending_set, NULL ); |
---|
487 | if ( status != -1 ) |
---|
488 | printf( "status = %d\n", status ); |
---|
489 | assert( errno == EINVAL ); |
---|
490 | puts( "Init: pthread_sigmask - EINVAL (how invalid)" ); |
---|
491 | |
---|
492 | status = sigpending( NULL ); |
---|
493 | if ( status != -1 ) |
---|
494 | printf( "status = %d\n", status ); |
---|
495 | assert( errno == EINVAL ); |
---|
496 | puts( "Init: sigpending - EINVAL (set invalid)" ); |
---|
497 | |
---|
498 | timeout.tv_nsec = -1; |
---|
499 | status = sigtimedwait( &mask, &info, &timeout ); |
---|
500 | if ( status != -1 ) |
---|
501 | printf( "status = %d\n", status ); |
---|
502 | assert( errno == EINVAL ); |
---|
503 | puts( "Init: pthread_sigmask - EINVAL (timout->nsec invalid < 0)" ); |
---|
504 | |
---|
505 | timeout.tv_nsec = 0x7fffffff; |
---|
506 | status = sigtimedwait( &mask, &info, &timeout ); |
---|
507 | if ( status != -1 ) |
---|
508 | printf( "status = %d\n", status ); |
---|
509 | assert( errno == EINVAL ); |
---|
510 | puts( "Init: pthread_sigmask - EINVAL (timout->nsec invalid to large)" ); |
---|
511 | |
---|
512 | status = pthread_kill( Init_id, 999 ); |
---|
513 | if ( status != -1 ) |
---|
514 | printf( "status = %d\n", status ); |
---|
515 | assert( errno == EINVAL ); |
---|
516 | puts( "Init: pthread_kill - EINVAL (sig invalid)" ); |
---|
517 | |
---|
518 | status = pthread_kill( 0, SIGUSR2 ); |
---|
519 | if ( status != -1 ) |
---|
520 | printf( "status = %d\n", status ); |
---|
521 | assert( errno == ESRCH ); |
---|
522 | puts( "Init: pthread_kill - ESRCH (signal SA_SIGINFO)" ); |
---|
523 | |
---|
524 | status = pthread_kill( Init_id, 0 ); |
---|
525 | assert( !status ); |
---|
526 | puts( "Init: pthread_kill - SUCCESSFUL (signal = 0)" ); |
---|
527 | |
---|
528 | act.sa_handler = SIG_IGN; |
---|
529 | act.sa_flags = 0; |
---|
530 | sigaction( SIGUSR2, &act, NULL ); |
---|
531 | status = pthread_kill( Init_id, SIGUSR2 ); |
---|
532 | assert( !status ); |
---|
533 | puts( "Init: pthread_kill - SUCCESSFUL (signal = SIG_IGN)" ); |
---|
534 | |
---|
535 | status = kill( 0x7fffffff, SIGUSR1 ); |
---|
536 | if ( status != -1 ) |
---|
537 | printf( "status = %d\n", status ); |
---|
538 | assert( errno == ESRCH ); |
---|
539 | puts( "Init: kill - ESRCH (pid invalid)" ); |
---|
540 | |
---|
541 | status = kill( getpid(), 0 ); |
---|
542 | assert( !status ); |
---|
543 | puts( "Init: kill - SUCCESSFUL (signal = 0)" ); |
---|
544 | |
---|
545 | status = kill( getpid(), 999 ); |
---|
546 | if ( status != -1 ) |
---|
547 | printf( "status = %d\n", status ); |
---|
548 | assert( errno == EINVAL ); |
---|
549 | puts( "Init: kill - EINVAL (sig invalid)" ); |
---|
550 | |
---|
551 | /* exit this thread */ |
---|
552 | |
---|
553 | puts( "*** END OF POSIX TEST 4 ***" ); |
---|
554 | rtems_test_exit( 0 ); |
---|
555 | |
---|
556 | return NULL; /* just so the compiler thinks we returned something */ |
---|
557 | } |
---|