[libc] Reland 90cd08c8381cf01921b915a56c7347bed1bf7a11 with test fix. (#238934)

Reland 90cd08c8381cf01921b915a56c7347bed1bf7a11 - Implement sigpending

Fix the test by verifying that SIGUSR1 is indeed blocked and is in
pending state.
But restoring the original mask caused this signal to be instantly
delivered
to the process, potentially crashing it.

Fix it by installing `SIG_IGN` handler before restore the original mask.

GitOrigin-RevId: bcbe075193bfc20b86adb4bc89ff630d33a4dbcc
12 files changed