@@ -63,6 +63,7 @@ __hidden char *map_portable_signum_to_name(int portable_signum)
63
63
char * name ;
64
64
65
65
switch (portable_signum ) {
66
+ case 0 : name = "SIG_0_PORTABLE:0" ; break ;
66
67
case SIGHUP_PORTABLE : name = "SIGHUP_PORTABLE:1" ; break ;
67
68
case SIGINT_PORTABLE : name = "SIGINT_PORTABLE:2" ; break ;
68
69
case SIGQUIT_PORTABLE : name = "SIGQUIT_PORTABLE:3" ; break ;
@@ -140,6 +141,7 @@ __hidden char *map_mips_signum_to_name(int mips_signum)
140
141
char * name ;
141
142
142
143
switch (mips_signum ) {
144
+ case 0 : name = "SIG_0:0" ; break ;
143
145
case SIGHUP : name = "SIGHUP:1" ; break ;
144
146
case SIGINT : name = "SIGINT:2" ; break ;
145
147
case SIGQUIT : name = "SIGQUIT:3" ; break ;
@@ -223,6 +225,10 @@ __hidden int signum_pton(int portable_signum)
223
225
int mips_signum = -1 ;
224
226
225
227
switch (portable_signum ) {
228
+
229
+ case 0 : /* 0 */
230
+ return 0 ;
231
+
226
232
case SIGHUP_PORTABLE : /* 1 */
227
233
return SIGHUP ;
228
234
@@ -340,8 +346,8 @@ __hidden int signum_pton(int portable_signum)
340
346
} else if (portable_signum > NSIG_PORTABLE ) {
341
347
mips_signum = (portable_signum - NSIG_PORTABLE ) + NSIG ;
342
348
} else {
343
- ALOGE ("%s: 0 <= portable_signum:%d <= NSIG_PORTABLE:%d; Not supported, return(0);" ,
344
- __func__ , portable_signum , NSIG_PORTABLE );
349
+ ALOGE ("%s: 0 < portable_signum:%d <= NSIG_PORTABLE:%d; Not supported, return(0);" ,
350
+ __func__ , portable_signum , NSIG_PORTABLE );
345
351
346
352
mips_signum = 0 ;
347
353
}
@@ -362,6 +368,9 @@ __hidden int signum_ntop(int mips_signum)
362
368
int portable_ssignum = -1 ;
363
369
364
370
switch (mips_signum ) {
371
+ case 0 : /* 0 */
372
+ return 0 ;
373
+
365
374
case SIGHUP : /* 1 */
366
375
return SIGHUP_PORTABLE ;
367
376
@@ -696,9 +705,10 @@ do_signal_portable(int portable_signum, sighandler_portable_t portable_handler,
696
705
697
706
mips_signum = signum_pton (portable_signum );
698
707
699
- if ((portable_signum != 0 ) && (( mips_signum <= 0 ) || (mips_signum > NSIG ) )) {
708
+ if ((mips_signum <= 0 ) || (mips_signum > NSIG )) {
700
709
/*
701
- * Invalid request; Let the kernel generate the proper return value and set errno.
710
+ * Invalid signal number, perhaps zero. Let the kernel generate the
711
+ * proper return value and set errno.
702
712
*/
703
713
mips_handler = sighandler_pton (portable_handler , 0 );
704
714
rv = mips_signal_fn (mips_signum , mips_handler );
@@ -801,6 +811,11 @@ static int do_kill(int id, int portable_signum, int (*fn)(int, int))
801
811
802
812
mips_signum = signum_pton (portable_signum );
803
813
814
+ /*
815
+ * SIG_0 gets passed down to the kernel to test for the existence of a process.
816
+ * If a non-zero portable_signum has been mapped to 0,
817
+ * it's unsupported and will be ignored.
818
+ */
804
819
if ((portable_signum != 0 ) && (mips_signum == 0 )) {
805
820
rv = 0 ;
806
821
} else {
@@ -876,6 +891,10 @@ int WRAP(tgkill)(int tgid, int tid, int portable_signum)
876
891
877
892
mips_signum = signum_pton (portable_signum );
878
893
894
+ /*
895
+ * If a non-zero portable_signum has been mapped to 0,
896
+ * it is unsupported and will be ignored.
897
+ */
879
898
if ((portable_signum != 0 ) && (mips_signum == 0 ))
880
899
rv = 0 ;
881
900
else
@@ -895,6 +914,11 @@ int WRAP(raise)(int portable_signum)
895
914
896
915
ALOGV ("%s(portable_signum:%d:'%s') {" , __func__ , portable_signum , portable_signame );
897
916
917
+ /*
918
+ * SIG_0 gets passed down to the kernel to test for the existence of a process.
919
+ * If a non-zero portable_signum has been mapped to 0,
920
+ * it's unsupported and will be ignored.
921
+ */
898
922
if ((portable_signum != 0 ) && (mips_signum == 0 ))
899
923
rv = 0 ;
900
924
else
@@ -1098,8 +1122,11 @@ static int do_sigaction_portable(int portable_signum, const struct sigaction_por
1098
1122
mips_signum = signum_pton (portable_signum );
1099
1123
mips_signame = map_mips_signum_to_name (mips_signum );
1100
1124
1125
+ /*
1126
+ * If a non-zero portable_signum has been mapped to 0,
1127
+ * it's unsupported and will be ignored.
1128
+ */
1101
1129
if ((portable_signum != 0 ) && (mips_signum == 0 )) {
1102
- /* We got a portable signum that we can't map; Ignore the request */
1103
1130
rv = 0 ;
1104
1131
goto done ;
1105
1132
}
@@ -1407,9 +1434,11 @@ int WRAP(siginterrupt)(int portable_signum, int flag)
1407
1434
1408
1435
mips_signum = signum_pton (portable_signum );
1409
1436
1437
+ /*
1438
+ * If a non-zero portable_signum has been mapped to 0,
1439
+ * it's unsupported and will be ignored.
1440
+ */
1410
1441
if ((portable_signum != 0 ) && (mips_signum == 0 )) {
1411
- ALOGE ("%s: Unsupported portable_signum:%d; Ignoring." , __func__ ,
1412
- portable_signum );
1413
1442
rv = 0 ;
1414
1443
} else {
1415
1444
rv = REAL (siginterrupt )(mips_signum , flag );
@@ -1663,6 +1692,15 @@ int WRAP(rt_sigqueueinfo)(pid_t pid, int portable_sig, siginfo_portable_t *porta
1663
1692
1664
1693
native_sig = signum_pton (portable_sig );
1665
1694
1695
+ /*
1696
+ * If a non-zero portable_signum has been mapped to 0,
1697
+ * it's unsupported and will be ignored.
1698
+ */
1699
+ if ((portable_sig != 0 ) && (native_sig == 0 )) {
1700
+ rv = 0 ;
1701
+ goto done ;
1702
+ }
1703
+
1666
1704
if (portable_sip != NULL ) {
1667
1705
native_sip = & native_siginfo ;
1668
1706
siginfo_pton (portable_sip , native_sip );
@@ -1671,6 +1709,7 @@ int WRAP(rt_sigqueueinfo)(pid_t pid, int portable_sig, siginfo_portable_t *porta
1671
1709
}
1672
1710
rv = syscall (__NR_rt_sigqueueinfo , pid , native_sig , native_sip );
1673
1711
1712
+ done :
1674
1713
ALOGV ("%s: return(rv:%d); }" , __func__ , rv );
1675
1714
return rv ;
1676
1715
}
@@ -1694,6 +1733,14 @@ int WRAP(rt_tgsigqueueinfo)(pid_t tgid, pid_t pid, int portable_sig,
1694
1733
1695
1734
native_sig = signum_pton (portable_sig );
1696
1735
1736
+ /*
1737
+ * If a non-zero portable_signum has been mapped to 0,
1738
+ * it's unsupported and will be ignored.
1739
+ */
1740
+ if ((portable_sig != 0 ) && (native_sig == 0 )) {
1741
+ rv = 0 ;
1742
+ goto done ;
1743
+ }
1697
1744
if (portable_sip != NULL ) {
1698
1745
native_sip = & native_siginfo ;
1699
1746
siginfo_pton (portable_sip , native_sip );
@@ -1702,6 +1749,7 @@ int WRAP(rt_tgsigqueueinfo)(pid_t tgid, pid_t pid, int portable_sig,
1702
1749
}
1703
1750
rv = syscall (__NR_rt_tgsigqueueinfo , pid , native_sig , native_sip );
1704
1751
1752
+ done :
1705
1753
ALOGV ("%s: return(rv:%d); }" , __func__ , rv );
1706
1754
return rv ;
1707
1755
}
0 commit comments