1 #include <signal.h>
2 #include <unistd.h>
3 
4 #ifdef __sh__
5 #define signal(a,b)	/* Signals not supported on this target - make them go away */
6 #endif
7 
8 /* Signal handlers, we set breakpoints in them to make sure that the
9    signals really get delivered.  */
10 
11 #ifdef PROTOTYPES
12 void
handle_ABRT(int sig)13 handle_ABRT (int sig)
14 #else
15 void
16 handle_ABRT (sig)
17      int sig;
18 #endif
19 {
20 }
21 
22 #ifdef PROTOTYPES
23 void
handle_HUP(int sig)24 handle_HUP (int sig)
25 #else
26 void
27 handle_HUP (sig)
28      int sig;
29 #endif
30 {
31 }
32 
33 #ifdef PROTOTYPES
34 void
handle_QUIT(int sig)35 handle_QUIT (int sig)
36 #else
37 void
38 handle_QUIT (sig)
39      int sig;
40 #endif
41 {
42 }
43 
44 #ifdef PROTOTYPES
45 void
handle_ILL(int sig)46 handle_ILL (int sig)
47 #else
48 void
49 handle_ILL (sig)
50      int sig;
51 #endif
52 {
53 }
54 
55 #ifdef PROTOTYPES
56 void
handle_EMT(int sig)57 handle_EMT (int sig)
58 #else
59 void
60 handle_EMT (sig)
61      int sig;
62 #endif
63 {
64 }
65 
66 #ifdef PROTOTYPES
67 void
handle_FPE(int sig)68 handle_FPE (int sig)
69 #else
70 void
71 handle_FPE (sig)
72      int sig;
73 #endif
74 {
75 }
76 
77 #ifdef PROTOTYPES
78 void
handle_BUS(int sig)79 handle_BUS (int sig)
80 #else
81 void
82 handle_BUS (sig)
83      int sig;
84 #endif
85 {
86 }
87 
88 #ifdef PROTOTYPES
89 void
handle_SEGV(int sig)90 handle_SEGV (int sig)
91 #else
92 void
93 handle_SEGV (sig)
94      int sig;
95 #endif
96 {
97 }
98 
99 #ifdef PROTOTYPES
100 void
handle_SYS(int sig)101 handle_SYS (int sig)
102 #else
103 void
104 handle_SYS (sig)
105      int sig;
106 #endif
107 {
108 }
109 
110 #ifdef PROTOTYPES
111 void
handle_PIPE(int sig)112 handle_PIPE (int sig)
113 #else
114 void
115 handle_PIPE (sig)
116      int sig;
117 #endif
118 {
119 }
120 
121 #ifdef PROTOTYPES
122 void
handle_ALRM(int sig)123 handle_ALRM (int sig)
124 #else
125 void
126 handle_ALRM (sig)
127      int sig;
128 #endif
129 {
130 }
131 
132 #ifdef PROTOTYPES
133 void
handle_URG(int sig)134 handle_URG (int sig)
135 #else
136 void
137 handle_URG (sig)
138      int sig;
139 #endif
140 {
141 }
142 
143 #ifdef PROTOTYPES
144 void
handle_TSTP(int sig)145 handle_TSTP (int sig)
146 #else
147 void
148 handle_TSTP (sig)
149      int sig;
150 #endif
151 {
152 }
153 
154 #ifdef PROTOTYPES
155 void
handle_CONT(int sig)156 handle_CONT (int sig)
157 #else
158 void
159 handle_CONT (sig)
160      int sig;
161 #endif
162 {
163 }
164 
165 #ifdef PROTOTYPES
166 void
handle_CHLD(int sig)167 handle_CHLD (int sig)
168 #else
169 void
170 handle_CHLD (sig)
171      int sig;
172 #endif
173 {
174 }
175 
176 #ifdef PROTOTYPES
177 void
handle_TTIN(int sig)178 handle_TTIN (int sig)
179 #else
180 void
181 handle_TTIN (sig)
182      int sig;
183 #endif
184 {
185 }
186 
187 #ifdef PROTOTYPES
188 void
handle_TTOU(int sig)189 handle_TTOU (int sig)
190 #else
191 void
192 handle_TTOU (sig)
193      int sig;
194 #endif
195 {
196 }
197 
198 #ifdef PROTOTYPES
199 void
handle_IO(int sig)200 handle_IO (int sig)
201 #else
202 void
203 handle_IO (sig)
204      int sig;
205 #endif
206 {
207 }
208 
209 #ifdef PROTOTYPES
210 void
handle_XCPU(int sig)211 handle_XCPU (int sig)
212 #else
213 void
214 handle_XCPU (sig)
215      int sig;
216 #endif
217 {
218 }
219 
220 #ifdef PROTOTYPES
221 void
handle_XFSZ(int sig)222 handle_XFSZ (int sig)
223 #else
224 void
225 handle_XFSZ (sig)
226      int sig;
227 #endif
228 {
229 }
230 
231 #ifdef PROTOTYPES
232 void
handle_VTALRM(int sig)233 handle_VTALRM (int sig)
234 #else
235 void
236 handle_VTALRM (sig)
237      int sig;
238 #endif
239 {
240 }
241 
242 #ifdef PROTOTYPES
243 void
handle_PROF(int sig)244 handle_PROF (int sig)
245 #else
246 void
247 handle_PROF (sig)
248      int sig;
249 #endif
250 {
251 }
252 
253 #ifdef PROTOTYPES
254 void
handle_WINCH(int sig)255 handle_WINCH (int sig)
256 #else
257 void
258 handle_WINCH (sig)
259      int sig;
260 #endif
261 {
262 }
263 
264 #ifdef PROTOTYPES
265 void
handle_LOST(int sig)266 handle_LOST (int sig)
267 #else
268 void
269 handle_LOST (sig)
270      int sig;
271 #endif
272 {
273 }
274 
275 #ifdef PROTOTYPES
276 void
handle_USR1(int sig)277 handle_USR1 (int sig)
278 #else
279 void
280 handle_USR1 (sig)
281      int sig;
282 #endif
283 {
284 }
285 
286 #ifdef PROTOTYPES
287 void
handle_USR2(int sig)288 handle_USR2 (int sig)
289 #else
290 void
291 handle_USR2 (sig)
292      int sig;
293 #endif
294 {
295 }
296 
297 #ifdef PROTOTYPES
298 void
handle_PWR(int sig)299 handle_PWR (int sig)
300 #else
301 void
302 handle_PWR (sig)
303      int sig;
304 #endif
305 {
306 }
307 
308 #ifdef PROTOTYPES
309 void
handle_POLL(int sig)310 handle_POLL (int sig)
311 #else
312 void
313 handle_POLL (sig)
314      int sig;
315 #endif
316 {
317 }
318 
319 #ifdef PROTOTYPES
320 void
handle_WIND(int sig)321 handle_WIND (int sig)
322 #else
323 void
324 handle_WIND (sig)
325      int sig;
326 #endif
327 {
328 }
329 
330 #ifdef PROTOTYPES
331 void
handle_PHONE(int sig)332 handle_PHONE (int sig)
333 #else
334 void
335 handle_PHONE (sig)
336      int sig;
337 #endif
338 {
339 }
340 
341 #ifdef PROTOTYPES
342 void
handle_WAITING(int sig)343 handle_WAITING (int sig)
344 #else
345 void
346 handle_WAITING (sig)
347      int sig;
348 #endif
349 {
350 }
351 
352 #ifdef PROTOTYPES
353 void
handle_LWP(int sig)354 handle_LWP (int sig)
355 #else
356 void
357 handle_LWP (sig)
358      int sig;
359 #endif
360 {
361 }
362 
363 #ifdef PROTOTYPES
364 void
handle_DANGER(int sig)365 handle_DANGER (int sig)
366 #else
367 void
368 handle_DANGER (sig)
369      int sig;
370 #endif
371 {
372 }
373 
374 #ifdef PROTOTYPES
375 void
handle_GRANT(int sig)376 handle_GRANT (int sig)
377 #else
378 void
379 handle_GRANT (sig)
380      int sig;
381 #endif
382 {
383 }
384 
385 #ifdef PROTOTYPES
386 void
handle_RETRACT(int sig)387 handle_RETRACT (int sig)
388 #else
389 void
390 handle_RETRACT (sig)
391      int sig;
392 #endif
393 {
394 }
395 
396 #ifdef PROTOTYPES
397 void
handle_MSG(int sig)398 handle_MSG (int sig)
399 #else
400 void
401 handle_MSG (sig)
402      int sig;
403 #endif
404 {
405 }
406 
407 #ifdef PROTOTYPES
408 void
handle_SOUND(int sig)409 handle_SOUND (int sig)
410 #else
411 void
412 handle_SOUND (sig)
413      int sig;
414 #endif
415 {
416 }
417 
418 #ifdef PROTOTYPES
419 void
handle_SAK(int sig)420 handle_SAK (int sig)
421 #else
422 void
423 handle_SAK (sig)
424      int sig;
425 #endif
426 {
427 }
428 
429 #ifdef PROTOTYPES
430 void
handle_PRIO(int sig)431 handle_PRIO (int sig)
432 #else
433 void
434 handle_PRIO (sig)
435      int sig;
436 #endif
437 {
438 }
439 
440 #ifdef PROTOTYPES
441 void
handle_33(int sig)442 handle_33 (int sig)
443 #else
444 void
445 handle_33 (sig)
446      int sig;
447 #endif
448 {
449 }
450 
451 #ifdef PROTOTYPES
452 void
handle_34(int sig)453 handle_34 (int sig)
454 #else
455 void
456 handle_34 (sig)
457      int sig;
458 #endif
459 {
460 }
461 
462 #ifdef PROTOTYPES
463 void
handle_35(int sig)464 handle_35 (int sig)
465 #else
466 void
467 handle_35 (sig)
468      int sig;
469 #endif
470 {
471 }
472 
473 #ifdef PROTOTYPES
474 void
handle_36(int sig)475 handle_36 (int sig)
476 #else
477 void
478 handle_36 (sig)
479      int sig;
480 #endif
481 {
482 }
483 
484 #ifdef PROTOTYPES
485 void
handle_37(int sig)486 handle_37 (int sig)
487 #else
488 void
489 handle_37 (sig)
490      int sig;
491 #endif
492 {
493 }
494 
495 #ifdef PROTOTYPES
496 void
handle_38(int sig)497 handle_38 (int sig)
498 #else
499 void
500 handle_38 (sig)
501      int sig;
502 #endif
503 {
504 }
505 
506 #ifdef PROTOTYPES
507 void
handle_39(int sig)508 handle_39 (int sig)
509 #else
510 void
511 handle_39 (sig)
512      int sig;
513 #endif
514 {
515 }
516 
517 #ifdef PROTOTYPES
518 void
handle_40(int sig)519 handle_40 (int sig)
520 #else
521 void
522 handle_40 (sig)
523      int sig;
524 #endif
525 {
526 }
527 
528 #ifdef PROTOTYPES
529 void
handle_41(int sig)530 handle_41 (int sig)
531 #else
532 void
533 handle_41 (sig)
534      int sig;
535 #endif
536 {
537 }
538 
539 #ifdef PROTOTYPES
540 void
handle_42(int sig)541 handle_42 (int sig)
542 #else
543 void
544 handle_42 (sig)
545      int sig;
546 #endif
547 {
548 }
549 
550 #ifdef PROTOTYPES
551 void
handle_43(int sig)552 handle_43 (int sig)
553 #else
554 void
555 handle_43 (sig)
556      int sig;
557 #endif
558 {
559 }
560 
561 #ifdef PROTOTYPES
562 void
handle_44(int sig)563 handle_44 (int sig)
564 #else
565 void
566 handle_44 (sig)
567      int sig;
568 #endif
569 {
570 }
571 
572 #ifdef PROTOTYPES
573 void
handle_45(int sig)574 handle_45 (int sig)
575 #else
576 void
577 handle_45 (sig)
578      int sig;
579 #endif
580 {
581 }
582 
583 #ifdef PROTOTYPES
584 void
handle_46(int sig)585 handle_46 (int sig)
586 #else
587 void
588 handle_46 (sig)
589      int sig;
590 #endif
591 {
592 }
593 
594 #ifdef PROTOTYPES
595 void
handle_47(int sig)596 handle_47 (int sig)
597 #else
598 void
599 handle_47 (sig)
600      int sig;
601 #endif
602 {
603 }
604 
605 #ifdef PROTOTYPES
606 void
handle_48(int sig)607 handle_48 (int sig)
608 #else
609 void
610 handle_48 (sig)
611      int sig;
612 #endif
613 {
614 }
615 
616 #ifdef PROTOTYPES
617 void
handle_49(int sig)618 handle_49 (int sig)
619 #else
620 void
621 handle_49 (sig)
622      int sig;
623 #endif
624 {
625 }
626 
627 #ifdef PROTOTYPES
628 void
handle_50(int sig)629 handle_50 (int sig)
630 #else
631 void
632 handle_50 (sig)
633      int sig;
634 #endif
635 {
636 }
637 
638 #ifdef PROTOTYPES
639 void
handle_51(int sig)640 handle_51 (int sig)
641 #else
642 void
643 handle_51 (sig)
644      int sig;
645 #endif
646 {
647 }
648 
649 #ifdef PROTOTYPES
650 void
handle_52(int sig)651 handle_52 (int sig)
652 #else
653 void
654 handle_52 (sig)
655      int sig;
656 #endif
657 {
658 }
659 
660 #ifdef PROTOTYPES
661 void
handle_53(int sig)662 handle_53 (int sig)
663 #else
664 void
665 handle_53 (sig)
666      int sig;
667 #endif
668 {
669 }
670 
671 #ifdef PROTOTYPES
672 void
handle_54(int sig)673 handle_54 (int sig)
674 #else
675 void
676 handle_54 (sig)
677      int sig;
678 #endif
679 {
680 }
681 
682 #ifdef PROTOTYPES
683 void
handle_55(int sig)684 handle_55 (int sig)
685 #else
686 void
687 handle_55 (sig)
688      int sig;
689 #endif
690 {
691 }
692 
693 #ifdef PROTOTYPES
694 void
handle_56(int sig)695 handle_56 (int sig)
696 #else
697 void
698 handle_56 (sig)
699      int sig;
700 #endif
701 {
702 }
703 
704 #ifdef PROTOTYPES
705 void
handle_57(int sig)706 handle_57 (int sig)
707 #else
708 void
709 handle_57 (sig)
710      int sig;
711 #endif
712 {
713 }
714 
715 #ifdef PROTOTYPES
716 void
handle_58(int sig)717 handle_58 (int sig)
718 #else
719 void
720 handle_58 (sig)
721      int sig;
722 #endif
723 {
724 }
725 
726 #ifdef PROTOTYPES
727 void
handle_59(int sig)728 handle_59 (int sig)
729 #else
730 void
731 handle_59 (sig)
732      int sig;
733 #endif
734 {
735 }
736 
737 #ifdef PROTOTYPES
738 void
handle_60(int sig)739 handle_60 (int sig)
740 #else
741 void
742 handle_60 (sig)
743      int sig;
744 #endif
745 {
746 }
747 
748 #ifdef PROTOTYPES
749 void
handle_61(int sig)750 handle_61 (int sig)
751 #else
752 void
753 handle_61 (sig)
754      int sig;
755 #endif
756 {
757 }
758 
759 #ifdef PROTOTYPES
760 void
handle_62(int sig)761 handle_62 (int sig)
762 #else
763 void
764 handle_62 (sig)
765      int sig;
766 #endif
767 {
768 }
769 
770 #ifdef PROTOTYPES
771 void
handle_63(int sig)772 handle_63 (int sig)
773 #else
774 void
775 handle_63 (sig)
776      int sig;
777 #endif
778 {
779 }
780 
781 #ifdef PROTOTYPES
782 void
handle_TERM(int sig)783 handle_TERM (int sig)
784 #else
785 void
786 handle_TERM (sig)
787      int sig;
788 #endif
789 {
790 }
791 
792 /* Functions to send signals.  These also serve as markers.  */
793 int
gen_ABRT()794 gen_ABRT ()
795 {
796   kill (getpid (), SIGABRT);
797   return 0;
798 }
799 
800 int
gen_HUP()801 gen_HUP ()
802 {
803 #ifdef SIGHUP
804   kill (getpid (), SIGHUP);
805 #else
806   handle_HUP (0);
807 #endif
808 return 0;
809 }
810 
811 int
gen_QUIT()812 gen_QUIT ()
813 {
814 #ifdef SIGQUIT
815   kill (getpid (), SIGQUIT);
816 #else
817   handle_QUIT (0);
818 #endif
819 return 0;
820 }
821 
822 int
gen_ILL()823 gen_ILL ()
824 {
825 #ifdef SIGILL
826   kill (getpid (), SIGILL);
827 #else
828   handle_ILL (0);
829 #endif
830 return 0;
831 }
832 
833 int
gen_EMT()834 gen_EMT ()
835 {
836 #ifdef SIGEMT
837   kill (getpid (), SIGEMT);
838 #else
839   handle_EMT (0);
840 #endif
841 return 0;
842 }
843 
844 int x;
845 
846 int
gen_FPE()847 gen_FPE ()
848 {
849   /* The intent behind generating SIGFPE this way is to check the mapping
850      from the CPU exception itself to the signals.  It would be nice to
851      do the same for SIGBUS, SIGSEGV, etc., but I suspect that even this
852      test might turn out to be insufficiently portable.  */
853 
854 #if 0
855   /* Loses on the PA because after the signal handler executes we try to
856      re-execute the failing instruction again.  Perhaps we could siglongjmp
857      out of the signal handler?  */
858   /* The expect script looks for the word "kill"; don't delete it.  */
859   return 5 / x; /* and we both started jumping up and down yelling kill */
860 #else
861   kill (getpid (), SIGFPE);
862 #endif
863 return 0;
864 }
865 
866 int
gen_BUS()867 gen_BUS ()
868 {
869 #ifdef SIGBUS
870   kill (getpid (), SIGBUS);
871 #else
872   handle_BUS (0);
873 #endif
874 return 0;
875 }
876 
877 int
gen_SEGV()878 gen_SEGV ()
879 {
880 #ifdef SIGSEGV
881   kill (getpid (), SIGSEGV);
882 #else
883   handle_SEGV (0);
884 #endif
885 return 0;
886 }
887 
888 int
gen_SYS()889 gen_SYS ()
890 {
891 #ifdef SIGSYS
892   kill (getpid (), SIGSYS);
893 #else
894   handle_SYS (0);
895 #endif
896 return 0;
897 }
898 
899 int
gen_PIPE()900 gen_PIPE ()
901 {
902 #ifdef SIGPIPE
903   kill (getpid (), SIGPIPE);
904 #else
905   handle_PIPE (0);
906 #endif
907 return 0;
908 }
909 
910 int
gen_ALRM()911 gen_ALRM ()
912 {
913 #ifdef SIGALRM
914   kill (getpid (), SIGALRM);
915 #else
916   handle_ALRM (0);
917 #endif
918 return 0;
919 }
920 
921 int
gen_URG()922 gen_URG ()
923 {
924 #ifdef SIGURG
925   kill (getpid (), SIGURG);
926 #else
927   handle_URG (0);
928 #endif
929 return 0;
930 }
931 
932 int
gen_TSTP()933 gen_TSTP ()
934 {
935 #ifdef SIGTSTP
936   kill (getpid (), SIGTSTP);
937 #else
938   handle_TSTP (0);
939 #endif
940 return 0;
941 }
942 
943 int
gen_CONT()944 gen_CONT ()
945 {
946 #ifdef SIGCONT
947   kill (getpid (), SIGCONT);
948 #else
949   handle_CONT (0);
950 #endif
951 return 0;
952 }
953 
954 int
gen_CHLD()955 gen_CHLD ()
956 {
957 #ifdef SIGCHLD
958   kill (getpid (), SIGCHLD);
959 #else
960   handle_CHLD (0);
961 #endif
962 return 0;
963 }
964 
965 int
gen_TTIN()966 gen_TTIN ()
967 {
968 #ifdef SIGTTIN
969   kill (getpid (), SIGTTIN);
970 #else
971   handle_TTIN (0);
972 #endif
973 return 0;
974 }
975 
976 int
gen_TTOU()977 gen_TTOU ()
978 {
979 #ifdef SIGTTOU
980   kill (getpid (), SIGTTOU);
981 #else
982   handle_TTOU (0);
983 #endif
984 return 0;
985 }
986 
987 int
gen_IO()988 gen_IO ()
989 {
990 #ifdef SIGIO
991   kill (getpid (), SIGIO);
992 #else
993   handle_IO (0);
994 #endif
995 return 0;
996 }
997 
998 int
gen_XCPU()999 gen_XCPU ()
1000 {
1001 #ifdef SIGXCPU
1002   kill (getpid (), SIGXCPU);
1003 #else
1004   handle_XCPU (0);
1005 #endif
1006 return 0;
1007 }
1008 
1009 int
gen_XFSZ()1010 gen_XFSZ ()
1011 {
1012 #ifdef SIGXFSZ
1013   kill (getpid (), SIGXFSZ);
1014 #else
1015   handle_XFSZ (0);
1016 #endif
1017 return 0;
1018 }
1019 
1020 int
gen_VTALRM()1021 gen_VTALRM ()
1022 {
1023 #ifdef SIGVTALRM
1024   kill (getpid (), SIGVTALRM);
1025 #else
1026   handle_VTALRM (0);
1027 #endif
1028 return 0;
1029 }
1030 
1031 int
gen_PROF()1032 gen_PROF ()
1033 {
1034 #ifdef SIGPROF
1035   kill (getpid (), SIGPROF);
1036 #else
1037   handle_PROF (0);
1038 #endif
1039 return 0;
1040 }
1041 
1042 int
gen_WINCH()1043 gen_WINCH ()
1044 {
1045 #ifdef SIGWINCH
1046   kill (getpid (), SIGWINCH);
1047 #else
1048   handle_WINCH (0);
1049 #endif
1050 return 0;
1051 }
1052 
1053 int
gen_LOST()1054 gen_LOST ()
1055 {
1056 #if defined(SIGLOST) && (!defined(SIGABRT) || SIGLOST != SIGABRT)
1057   kill (getpid (), SIGLOST);
1058 #else
1059   handle_LOST (0);
1060 #endif
1061 return 0;
1062 }
1063 
1064 int
gen_USR1()1065 gen_USR1 ()
1066 {
1067 #ifdef SIGUSR1
1068   kill (getpid (), SIGUSR1);
1069 #else
1070   handle_USR1 (0);
1071 #endif
1072 return 0;
1073 }
1074 
1075 int
gen_USR2()1076 gen_USR2 ()
1077 {
1078 #ifdef SIGUSR2
1079   kill (getpid (), SIGUSR2);
1080 #else
1081   handle_USR2 (0);
1082 #endif
1083 return 0;
1084 }
1085 
1086 int
gen_PWR()1087 gen_PWR ()
1088 {
1089 #ifdef SIGPWR
1090   kill (getpid (), SIGPWR);
1091 #else
1092   handle_PWR (0);
1093 #endif
1094 return 0;
1095 }
1096 
1097 int
gen_POLL()1098 gen_POLL ()
1099 {
1100 #if defined (SIGPOLL) && (!defined (SIGIO) || SIGPOLL != SIGIO)
1101   kill (getpid (), SIGPOLL);
1102 #else
1103   handle_POLL (0);
1104 #endif
1105 return 0;
1106 }
1107 
1108 int
gen_WIND()1109 gen_WIND ()
1110 {
1111 #ifdef SIGWIND
1112   kill (getpid (), SIGWIND);
1113 #else
1114   handle_WIND (0);
1115 #endif
1116 return 0;
1117 }
1118 
1119 int
gen_PHONE()1120 gen_PHONE ()
1121 {
1122 #ifdef SIGPHONE
1123   kill (getpid (), SIGPHONE);
1124 #else
1125   handle_PHONE (0);
1126 #endif
1127 return 0;
1128 }
1129 
1130 int
gen_WAITING()1131 gen_WAITING ()
1132 {
1133 #ifdef SIGWAITING
1134   kill (getpid (), SIGWAITING);
1135 #else
1136   handle_WAITING (0);
1137 #endif
1138 return 0;
1139 }
1140 
1141 int
gen_LWP()1142 gen_LWP ()
1143 {
1144 #ifdef SIGLWP
1145   kill (getpid (), SIGLWP);
1146 #else
1147   handle_LWP (0);
1148 #endif
1149 return 0;
1150 }
1151 
1152 int
gen_DANGER()1153 gen_DANGER ()
1154 {
1155 #ifdef SIGDANGER
1156   kill (getpid (), SIGDANGER);
1157 #else
1158   handle_DANGER (0);
1159 #endif
1160 return 0;
1161 }
1162 
1163 int
gen_GRANT()1164 gen_GRANT ()
1165 {
1166 #ifdef SIGGRANT
1167   kill (getpid (), SIGGRANT);
1168 #else
1169   handle_GRANT (0);
1170 #endif
1171 return 0;
1172 }
1173 
1174 int
gen_RETRACT()1175 gen_RETRACT ()
1176 {
1177 #ifdef SIGRETRACT
1178   kill (getpid (), SIGRETRACT);
1179 #else
1180   handle_RETRACT (0);
1181 #endif
1182 return 0;
1183 }
1184 
1185 int
gen_MSG()1186 gen_MSG ()
1187 {
1188 #ifdef SIGMSG
1189   kill (getpid (), SIGMSG);
1190 #else
1191   handle_MSG (0);
1192 #endif
1193 return 0;
1194 }
1195 
1196 int
gen_SOUND()1197 gen_SOUND ()
1198 {
1199 #ifdef SIGSOUND
1200   kill (getpid (), SIGSOUND);
1201 #else
1202   handle_SOUND (0);
1203 #endif
1204 return 0;
1205 }
1206 
1207 int
gen_SAK()1208 gen_SAK ()
1209 {
1210 #ifdef SIGSAK
1211   kill (getpid (), SIGSAK);
1212 #else
1213   handle_SAK (0);
1214 #endif
1215 return 0;
1216 }
1217 
1218 int
gen_PRIO()1219 gen_PRIO ()
1220 {
1221 #ifdef SIGPRIO
1222   kill (getpid (), SIGPRIO);
1223 #else
1224   handle_PRIO (0);
1225 #endif
1226 return 0;
1227 }
1228 
1229 int
gen_33()1230 gen_33 ()
1231 {
1232 #ifdef SIG33
1233   kill (getpid (), 33);
1234 #else
1235   handle_33 (0);
1236 #endif
1237 return 0;
1238 }
1239 
1240 int
gen_34()1241 gen_34 ()
1242 {
1243 #ifdef SIG34
1244   kill (getpid (), 34);
1245 #else
1246   handle_34 (0);
1247 #endif
1248 return 0;
1249 }
1250 
1251 int
gen_35()1252 gen_35 ()
1253 {
1254 #ifdef SIG35
1255   kill (getpid (), 35);
1256 #else
1257   handle_35 (0);
1258 #endif
1259 return 0;
1260 }
1261 
1262 int
gen_36()1263 gen_36 ()
1264 {
1265 #ifdef SIG36
1266   kill (getpid (), 36);
1267 #else
1268   handle_36 (0);
1269 #endif
1270 return 0;
1271 }
1272 
1273 int
gen_37()1274 gen_37 ()
1275 {
1276 #ifdef SIG37
1277   kill (getpid (), 37);
1278 #else
1279   handle_37 (0);
1280 #endif
1281 return 0;
1282 }
1283 
1284 int
gen_38()1285 gen_38 ()
1286 {
1287 #ifdef SIG38
1288   kill (getpid (), 38);
1289 #else
1290   handle_38 (0);
1291 #endif
1292 return 0;
1293 }
1294 
1295 int
gen_39()1296 gen_39 ()
1297 {
1298 #ifdef SIG39
1299   kill (getpid (), 39);
1300 #else
1301   handle_39 (0);
1302 #endif
1303 return 0;
1304 }
1305 
1306 int
gen_40()1307 gen_40 ()
1308 {
1309 #ifdef SIG40
1310   kill (getpid (), 40);
1311 #else
1312   handle_40 (0);
1313 #endif
1314 return 0;
1315 }
1316 
1317 int
gen_41()1318 gen_41 ()
1319 {
1320 #ifdef SIG41
1321   kill (getpid (), 41);
1322 #else
1323   handle_41 (0);
1324 #endif
1325 return 0;
1326 }
1327 
1328 int
gen_42()1329 gen_42 ()
1330 {
1331 #ifdef SIG42
1332   kill (getpid (), 42);
1333 #else
1334   handle_42 (0);
1335 #endif
1336 return 0;
1337 }
1338 
1339 int
gen_43()1340 gen_43 ()
1341 {
1342 #ifdef SIG43
1343   kill (getpid (), 43);
1344 #else
1345   handle_43 (0);
1346 #endif
1347 return 0;
1348 }
1349 
1350 int
gen_44()1351 gen_44 ()
1352 {
1353 #ifdef SIG44
1354   kill (getpid (), 44);
1355 #else
1356   handle_44 (0);
1357 #endif
1358 return 0;
1359 }
1360 
1361 int
gen_45()1362 gen_45 ()
1363 {
1364 #ifdef SIG45
1365   kill (getpid (), 45);
1366 #else
1367   handle_45 (0);
1368 #endif
1369 return 0;
1370 }
1371 
1372 int
gen_46()1373 gen_46 ()
1374 {
1375 #ifdef SIG46
1376   kill (getpid (), 46);
1377 #else
1378   handle_46 (0);
1379 #endif
1380 return 0;
1381 }
1382 
1383 int
gen_47()1384 gen_47 ()
1385 {
1386 #ifdef SIG47
1387   kill (getpid (), 47);
1388 #else
1389   handle_47 (0);
1390 #endif
1391 return 0;
1392 }
1393 
1394 int
gen_48()1395 gen_48 ()
1396 {
1397 #ifdef SIG48
1398   kill (getpid (), 48);
1399 #else
1400   handle_48 (0);
1401 #endif
1402 return 0;
1403 }
1404 
1405 int
gen_49()1406 gen_49 ()
1407 {
1408 #ifdef SIG49
1409   kill (getpid (), 49);
1410 #else
1411   handle_49 (0);
1412 #endif
1413 return 0;
1414 }
1415 
1416 int
gen_50()1417 gen_50 ()
1418 {
1419 #ifdef SIG50
1420   kill (getpid (), 50);
1421 #else
1422   handle_50 (0);
1423 #endif
1424 return 0;
1425 }
1426 
1427 int
gen_51()1428 gen_51 ()
1429 {
1430 #ifdef SIG51
1431   kill (getpid (), 51);
1432 #else
1433   handle_51 (0);
1434 #endif
1435 return 0;
1436 }
1437 
1438 int
gen_52()1439 gen_52 ()
1440 {
1441 #ifdef SIG52
1442   kill (getpid (), 52);
1443 #else
1444   handle_52 (0);
1445 #endif
1446 return 0;
1447 }
1448 
1449 int
gen_53()1450 gen_53 ()
1451 {
1452 #ifdef SIG53
1453   kill (getpid (), 53);
1454 #else
1455   handle_53 (0);
1456 #endif
1457 return 0;
1458 }
1459 
1460 int
gen_54()1461 gen_54 ()
1462 {
1463 #ifdef SIG54
1464   kill (getpid (), 54);
1465 #else
1466   handle_54 (0);
1467 #endif
1468 return 0;
1469 }
1470 
1471 int
gen_55()1472 gen_55 ()
1473 {
1474 #ifdef SIG55
1475   kill (getpid (), 55);
1476 #else
1477   handle_55 (0);
1478 #endif
1479 return 0;
1480 }
1481 
1482 int
gen_56()1483 gen_56 ()
1484 {
1485 #ifdef SIG56
1486   kill (getpid (), 56);
1487 #else
1488   handle_56 (0);
1489 #endif
1490 return 0;
1491 }
1492 
1493 int
gen_57()1494 gen_57 ()
1495 {
1496 #ifdef SIG57
1497   kill (getpid (), 57);
1498 #else
1499   handle_57 (0);
1500 #endif
1501 return 0;
1502 }
1503 
1504 int
gen_58()1505 gen_58 ()
1506 {
1507 #ifdef SIG58
1508   kill (getpid (), 58);
1509 #else
1510   handle_58 (0);
1511 #endif
1512 return 0;
1513 }
1514 
1515 int
gen_59()1516 gen_59 ()
1517 {
1518 #ifdef SIG59
1519   kill (getpid (), 59);
1520 #else
1521   handle_59 (0);
1522 #endif
1523 return 0;
1524 }
1525 
1526 int
gen_60()1527 gen_60 ()
1528 {
1529 #ifdef SIG60
1530   kill (getpid (), 60);
1531 #else
1532   handle_60 (0);
1533 #endif
1534 return 0;
1535 }
1536 
1537 int
gen_61()1538 gen_61 ()
1539 {
1540 #ifdef SIG61
1541   kill (getpid (), 61);
1542 #else
1543   handle_61 (0);
1544 #endif
1545 return 0;
1546 }
1547 
1548 int
gen_62()1549 gen_62 ()
1550 {
1551 #ifdef SIG62
1552   kill (getpid (), 62);
1553 #else
1554   handle_62 (0);
1555 #endif
1556 return 0;
1557 }
1558 
1559 int
gen_63()1560 gen_63 ()
1561 {
1562 #ifdef SIG63
1563   kill (getpid (), 63);
1564 #else
1565   handle_63 (0);
1566 #endif
1567 return 0;
1568 }
1569 
1570 int
gen_TERM()1571 gen_TERM ()
1572 {
1573   kill (getpid (), SIGTERM);
1574 return 0;
1575 }
1576 
1577 int
main()1578 main ()
1579 {
1580 #ifdef usestubs
1581   set_debug_traps ();
1582   breakpoint ();
1583 #endif
1584 
1585 #ifdef SIG_SETMASK
1586   /* Ensure all the signals aren't blocked.
1587      The environment in which the testsuite is run may have blocked some
1588      for whatever reason.  */
1589   {
1590     sigset_t newset;
1591     sigemptyset (&newset);
1592     sigprocmask (SIG_SETMASK, &newset, NULL);
1593   }
1594 #endif
1595 
1596   signal (SIGABRT, handle_ABRT);
1597 #ifdef SIGHUP
1598   signal (SIGHUP, handle_HUP);
1599 #endif
1600 #ifdef SIGQUIT
1601   signal (SIGQUIT, handle_QUIT);
1602 #endif
1603 #ifdef SIGILL
1604   signal (SIGILL, handle_ILL);
1605 #endif
1606 #ifdef SIGEMT
1607   signal (SIGEMT, handle_EMT);
1608 #endif
1609 #ifdef SIGFPE
1610   signal (SIGFPE, handle_FPE);
1611 #endif
1612 #ifdef SIGBUS
1613   signal (SIGBUS, handle_BUS);
1614 #endif
1615 #ifdef SIGSEGV
1616   signal (SIGSEGV, handle_SEGV);
1617 #endif
1618 #ifdef SIGSYS
1619   signal (SIGSYS, handle_SYS);
1620 #endif
1621 #ifdef SIGPIPE
1622   signal (SIGPIPE, handle_PIPE);
1623 #endif
1624 #ifdef SIGALRM
1625   signal (SIGALRM, handle_ALRM);
1626 #endif
1627 #ifdef SIGURG
1628   signal (SIGURG, handle_URG);
1629 #endif
1630 #ifdef SIGTSTP
1631   signal (SIGTSTP, handle_TSTP);
1632 #endif
1633 #ifdef SIGCONT
1634   signal (SIGCONT, handle_CONT);
1635 #endif
1636 #ifdef SIGCHLD
1637   signal (SIGCHLD, handle_CHLD);
1638 #endif
1639 #ifdef SIGTTIN
1640   signal (SIGTTIN, handle_TTIN);
1641 #endif
1642 #ifdef SIGTTOU
1643   signal (SIGTTOU, handle_TTOU);
1644 #endif
1645 #ifdef SIGIO
1646   signal (SIGIO, handle_IO);
1647 #endif
1648 #ifdef SIGXCPU
1649   signal (SIGXCPU, handle_XCPU);
1650 #endif
1651 #ifdef SIGXFSZ
1652   signal (SIGXFSZ, handle_XFSZ);
1653 #endif
1654 #ifdef SIGVTALRM
1655   signal (SIGVTALRM, handle_VTALRM);
1656 #endif
1657 #ifdef SIGPROF
1658   signal (SIGPROF, handle_PROF);
1659 #endif
1660 #ifdef SIGWINCH
1661   signal (SIGWINCH, handle_WINCH);
1662 #endif
1663 #if defined(SIGLOST) && (!defined(SIGABRT) || SIGLOST != SIGABRT)
1664   signal (SIGLOST, handle_LOST);
1665 #endif
1666 #ifdef SIGUSR1
1667   signal (SIGUSR1, handle_USR1);
1668 #endif
1669 #ifdef SIGUSR2
1670   signal (SIGUSR2, handle_USR2);
1671 #endif
1672 #ifdef SIGPWR
1673   signal (SIGPWR, handle_PWR);
1674 #endif
1675 #if defined (SIGPOLL) && (!defined (SIGIO) || SIGPOLL != SIGIO)
1676   signal (SIGPOLL, handle_POLL);
1677 #endif
1678 #ifdef SIGWIND
1679   signal (SIGWIND, handle_WIND);
1680 #endif
1681 #ifdef SIGPHONE
1682   signal (SIGPHONE, handle_PHONE);
1683 #endif
1684 #ifdef SIGWAITING
1685   signal (SIGWAITING, handle_WAITING);
1686 #endif
1687 #ifdef SIGLWP
1688   signal (SIGLWP, handle_LWP);
1689 #endif
1690 #ifdef SIGDANGER
1691   signal (SIGDANGER, handle_DANGER);
1692 #endif
1693 #ifdef SIGGRANT
1694   signal (SIGGRANT, handle_GRANT);
1695 #endif
1696 #ifdef SIGRETRACT
1697   signal (SIGRETRACT, handle_RETRACT);
1698 #endif
1699 #ifdef SIGMSG
1700   signal (SIGMSG, handle_MSG);
1701 #endif
1702 #ifdef SIGSOUND
1703   signal (SIGSOUND, handle_SOUND);
1704 #endif
1705 #ifdef SIGSAK
1706   signal (SIGSAK, handle_SAK);
1707 #endif
1708 #ifdef SIGPRIO
1709   signal (SIGPRIO, handle_PRIO);
1710 #endif
1711 #ifdef __Lynx__
1712   /* Lynx doesn't seem to have anything in signal.h for this.  */
1713   signal (33, handle_33);
1714   signal (34, handle_34);
1715   signal (35, handle_35);
1716   signal (36, handle_36);
1717   signal (37, handle_37);
1718   signal (38, handle_38);
1719   signal (39, handle_39);
1720   signal (40, handle_40);
1721   signal (41, handle_41);
1722   signal (42, handle_42);
1723   signal (43, handle_43);
1724   signal (44, handle_44);
1725   signal (45, handle_45);
1726   signal (46, handle_46);
1727   signal (47, handle_47);
1728   signal (48, handle_48);
1729   signal (49, handle_49);
1730   signal (50, handle_50);
1731   signal (51, handle_51);
1732   signal (52, handle_52);
1733   signal (53, handle_53);
1734   signal (54, handle_54);
1735   signal (55, handle_55);
1736   signal (56, handle_56);
1737   signal (57, handle_57);
1738   signal (58, handle_58);
1739   signal (59, handle_59);
1740   signal (60, handle_60);
1741   signal (61, handle_61);
1742   signal (62, handle_62);
1743   signal (63, handle_63);
1744 #endif /* lynx */
1745   signal (SIGTERM, handle_TERM);
1746 
1747   x = 0;
1748 
1749   gen_ABRT ();
1750   gen_HUP ();
1751   gen_QUIT ();
1752   gen_ILL ();
1753   gen_EMT ();
1754   gen_FPE ();
1755   gen_BUS ();
1756   gen_SEGV ();
1757   gen_SYS ();
1758   gen_PIPE ();
1759   gen_ALRM ();
1760   gen_URG ();
1761   gen_TSTP ();
1762   gen_CONT ();
1763   gen_CHLD ();
1764   gen_TTIN ();
1765   gen_TTOU ();
1766   gen_IO ();
1767   gen_XCPU ();
1768   gen_XFSZ ();
1769   gen_VTALRM ();
1770   gen_PROF ();
1771   gen_WINCH ();
1772   gen_LOST ();
1773   gen_USR1 ();
1774   gen_USR2 ();
1775   gen_PWR ();
1776   gen_POLL ();
1777   gen_WIND ();
1778   gen_PHONE ();
1779   gen_WAITING ();
1780   gen_LWP ();
1781   gen_DANGER ();
1782   gen_GRANT ();
1783   gen_RETRACT ();
1784   gen_MSG ();
1785   gen_SOUND ();
1786   gen_SAK ();
1787   gen_PRIO ();
1788   gen_33 ();
1789   gen_34 ();
1790   gen_35 ();
1791   gen_36 ();
1792   gen_37 ();
1793   gen_38 ();
1794   gen_39 ();
1795   gen_40 ();
1796   gen_41 ();
1797   gen_42 ();
1798   gen_43 ();
1799   gen_44 ();
1800   gen_45 ();
1801   gen_46 ();
1802   gen_47 ();
1803   gen_48 ();
1804   gen_49 ();
1805   gen_50 ();
1806   gen_51 ();
1807   gen_52 ();
1808   gen_53 ();
1809   gen_54 ();
1810   gen_55 ();
1811   gen_56 ();
1812   gen_57 ();
1813   gen_58 ();
1814   gen_59 ();
1815   gen_60 ();
1816   gen_61 ();
1817   gen_62 ();
1818   gen_63 ();
1819   gen_TERM ();
1820 
1821   return 0;
1822 }
1823