提交 4b1244a0 编写于 作者: R Rich Felker

implement the remaining clock_* interfaces

上级 19eb13b9
#include <time.h>
#include <errno.h>
#include <unistd.h>
#include "syscall.h"
int clock_getcpuclockid(pid_t pid, clockid_t *clk)
{
if (pid && pid != getpid()) return EPERM;
*clk = CLOCK_PROCESS_CPUTIME_ID;
return 0;
}
#define SYSCALL_RETURN_ERRNO
#include <time.h>
#include "syscall.h"
int clock_getres(clockid_t clk, struct timespec *ts)
{
return syscall2(__NR_clock_getres, clk, (long)ts);
}
#define SYSCALL_RETURN_ERRNO
#include <time.h>
#include "syscall.h"
......
#define SYSCALL_RETURN_ERRNO
#include <time.h>
#include "syscall.h"
int clock_nanosleep(clockid_t clk, int flags, const struct timespec *req, struct timespec *rem)
{
return syscall4(__NR_clock_nanosleep, clk, flags, (long)req, (long)rem);
}
#define SYSCALL_RETURN_ERRNO
#include <time.h>
#include "syscall.h"
int clock_settime(clockid_t clk, const struct timespec *ts)
{
return syscall2(__NR_clock_settime, clk, (long)ts);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册