提交 e241896c 编写于 作者: R Rich Felker

avoid deprecated (by linux) alarm syscall; use setitimer instead

上级 c37afdfd
#include <unistd.h>
#include <sys/time.h>
#include "syscall.h"
unsigned alarm(unsigned seconds)
{
return syscall(SYS_alarm, seconds);
struct itimerval it = { .it_value.tv_sec = seconds };
__syscall(SYS_setitimer, ITIMER_REAL, &it, &it);
return it.it_value.tv_sec + !!it.it_value.tv_usec;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册