Make SIGRTMIN hide the real-time signals we use internally.
__SIGRTMIN will continue to tell the truth. This matches glibc's behavior (as evidenced by the fact that we don't need a special case in the strsignal test now). Change-Id: I1abe1681d516577afa8cd39c837ef12467f68dd2
This commit is contained in:
@@ -252,3 +252,21 @@ TEST(signal, sys_siglist) {
|
||||
ASSERT_TRUE(sys_siglist[0] == NULL);
|
||||
ASSERT_STREQ("Hangup", sys_siglist[SIGHUP]);
|
||||
}
|
||||
|
||||
TEST(signal, limits) {
|
||||
// This comes from the kernel.
|
||||
ASSERT_EQ(32, __SIGRTMIN);
|
||||
|
||||
// We reserve a non-zero number at the bottom for ourselves.
|
||||
ASSERT_GT(SIGRTMIN, __SIGRTMIN);
|
||||
|
||||
// MIPS has more signals than everyone else.
|
||||
#if defined(__mips__)
|
||||
ASSERT_EQ(128, __SIGRTMAX);
|
||||
#else
|
||||
ASSERT_EQ(64, __SIGRTMAX);
|
||||
#endif
|
||||
|
||||
// We don't currently reserve any at the top.
|
||||
ASSERT_EQ(SIGRTMAX, __SIGRTMAX);
|
||||
}
|
||||
|
||||
@@ -100,11 +100,9 @@ TEST(string, strsignal) {
|
||||
ASSERT_STREQ("Hangup", strsignal(1));
|
||||
|
||||
// A real-time signal.
|
||||
#ifdef __GLIBC__ // glibc reserves real-time signals for internal use, and doesn't count those.
|
||||
ASSERT_STREQ("Real-time signal 14", strsignal(48));
|
||||
#else
|
||||
ASSERT_STREQ("Real-time signal 16", strsignal(48));
|
||||
#endif
|
||||
ASSERT_STREQ("Real-time signal 14", strsignal(SIGRTMIN + 14));
|
||||
// One of the signals the C library keeps to itself.
|
||||
ASSERT_STREQ("Unknown signal 32", strsignal(__SIGRTMIN));
|
||||
|
||||
// Errors.
|
||||
ASSERT_STREQ("Unknown signal -1", strsignal(-1)); // Too small.
|
||||
|
||||
Reference in New Issue
Block a user