Switch to upstream alarm(3).

The only way the setitimer call can fail is if the unsigned number of seconds is
too large to fit in the kernel's signed number of seconds. If you schedule a
68-year alarm, glibc will fail by returning 0 and BSD will fail by returning -1.

Change-Id: Ic3721b01428f5402d99f31fd7f2ba2cc58805607
This commit is contained in:
Elliott Hughes
2014-03-03 14:38:20 -08:00
parent dfeb42ede6
commit aedb00d04e
3 changed files with 10 additions and 17 deletions

View File

@@ -112,3 +112,7 @@ TEST(unistd, read_EBADF) {
ASSERT_EQ(-1, read(-1, buf, sizeof(buf)));
ASSERT_EQ(EBADF, errno);
}
TEST(unistd, alarm) {
ASSERT_EQ(0U, alarm(0));
}