implement the remaining clock_* interfaces
This commit is contained in:
parent
19eb13b9a4
commit
4b1244a0bf
5 changed files with 36 additions and 0 deletions
11
src/time/clock_getcpuclockid.c
Normal file
11
src/time/clock_getcpuclockid.c
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#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;
|
||||
}
|
||||
8
src/time/clock_getres.c
Normal file
8
src/time/clock_getres.c
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#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);
|
||||
}
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
#define SYSCALL_RETURN_ERRNO
|
||||
#include <time.h>
|
||||
#include "syscall.h"
|
||||
|
||||
|
|
|
|||
8
src/time/clock_nanosleep.c
Normal file
8
src/time/clock_nanosleep.c
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#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);
|
||||
}
|
||||
8
src/time/clock_settime.c
Normal file
8
src/time/clock_settime.c
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue