提交 f19ac717 编写于 作者: T teamol 提交者: teamol

fix time mould's musl api:clock_getcpuclockid & pthread_getcpuclockid

Change-Id: I8224c82a2fb34b0ab6e5b9b100f7de860f95cafe
上级 522b0ea7
#include <unsupported_api.h>
#include "pthread_impl.h"
int pthread_getcpuclockid(pthread_t t, clockid_t *clockid)
{
unsupported_api(__FUNCTION__);
*clockid = (-t->tid-1)*8U + 6;
return 0;
*clockid = (-t->tid-1)*8U + 6;
return 0;
}
#include <time.h>
#include <errno.h>
#include <unistd.h>
#include <unsupported_api.h>
#include "syscall.h"
int clock_getcpuclockid(pid_t pid, clockid_t *clk)
{
struct timespec ts;
unsupported_api(__FUNCTION__);
struct timespec ts;
clockid_t id = (-pid-1)*8U + 2;
int ret = __syscall(SYS_clock_getres, id, &ts);
if (ret) return -ret;
*clk = id;
return 0;
clockid_t id = (-pid-1)*8U + 2;
int ret = __syscall(SYS_clock_getres, id, &ts);
if (ret) return -ret;
*clk = id;
return 0;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册