sched/clock: move clock_getcpuclockid() and clock_getres() to libc
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
parent
15991ef919
commit
b8d3e32bdf
@ -170,8 +170,6 @@ SYSCALL_LOOKUP(clock_nanosleep, 4)
|
||||
*/
|
||||
|
||||
SYSCALL_LOOKUP(clock, 0)
|
||||
SYSCALL_LOOKUP(clock_getcpuclockid, 2)
|
||||
SYSCALL_LOOKUP(clock_getres, 2)
|
||||
SYSCALL_LOOKUP(clock_gettime, 2)
|
||||
SYSCALL_LOOKUP(clock_settime, 2)
|
||||
#ifdef CONFIG_CLOCK_TIMEKEEPING
|
||||
|
@ -33,7 +33,8 @@
|
||||
"cfgetspeed","termios.h","","speed_t","FAR const struct termios *"
|
||||
"cfsetspeed","termios.h","","int","FAR struct termios *","speed_t"
|
||||
"chdir","unistd.h","!defined(CONFIG_DISABLE_ENVIRON)","int","FAR const char *"
|
||||
"clock","time.h","","clock_t"
|
||||
"clock_getcpuclockid","time.h","","int","pid_t","FAR clockid_t *"
|
||||
"clock_getres","time.h","","int","clockid_t","FAR struct timespec *"
|
||||
"closedir","dirent.h","","int","DIR *"
|
||||
"crc32","nuttx/crc32.h","","uint32_t","FAR const uint8_t *","size_t"
|
||||
"crc32part","nuttx/crc32.h","","uint32_t","FAR const uint8_t *","size_t","uint32_t"
|
||||
|
Can't render this file because it has a wrong number of fields in line 3.
|
@ -23,6 +23,7 @@
|
||||
CSRCS += sched_getprioritymax.c sched_getprioritymin.c
|
||||
CSRCS += clock_ticks2time.c clock_time2ticks.c
|
||||
CSRCS += clock_timespec_add.c clock_timespec_subtract.c
|
||||
CSRCS += clock_getcpuclockid.c clock_getres.c
|
||||
|
||||
ifneq ($(CONFIG_CANCELLATION_POINTS),y)
|
||||
CSRCS += task_setcanceltype.c task_testcancel.c
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* sched/clock/clock_getcpuclockid.c
|
||||
* libs/libc/sched/clock_getcpuclockid.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
@ -25,10 +25,10 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "clock/clock.h"
|
||||
#include <nuttx/clock.h>
|
||||
#include <nuttx/sched.h>
|
||||
#include <nuttx/signal.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
@ -52,17 +52,15 @@
|
||||
|
||||
int clock_getcpuclockid(pid_t pid, FAR clockid_t *clockid)
|
||||
{
|
||||
if (pid < 0)
|
||||
{
|
||||
set_errno(EINVAL);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/* If the pid is 0, we need to use the pid of current process */
|
||||
|
||||
if (pid == 0)
|
||||
{
|
||||
pid = getpid();
|
||||
pid = _SCHED_GETPID();
|
||||
}
|
||||
else if (_SIG_KILL(pid, 0) < 0)
|
||||
{
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/* For clock_getcpuclockid, the clock type are
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* sched/clock/clock_getres.c
|
||||
* libs/libc/sched/clock_getres.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
@ -29,7 +29,7 @@
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include "clock/clock.h"
|
||||
#include <nuttx/clock.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
@ -18,10 +18,8 @@
|
||||
#
|
||||
############################################################################
|
||||
|
||||
CSRCS += clock_initialize.c clock_settime.c clock_gettime.c clock_getres.c
|
||||
CSRCS += clock_abstime2ticks.c
|
||||
CSRCS += clock_systime_ticks.c clock_systime_timespec.c
|
||||
CSRCS += clock.c clock_getcpuclockid.c
|
||||
CSRCS += clock.c clock_initialize.c clock_settime.c clock_gettime.c
|
||||
CSRCS += clock_abstime2ticks.c clock_systime_ticks.c clock_systime_timespec.c
|
||||
|
||||
ifeq ($(CONFIG_CLOCK_TIMEKEEPING),y)
|
||||
CSRCS += clock_timekeeping.c
|
||||
|
@ -13,8 +13,6 @@
|
||||
"chown","unistd.h","","int","FAR const char *","uid_t","gid_t"
|
||||
"clearenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","int"
|
||||
"clock","time.h","","clock_t"
|
||||
"clock_getcpuclockid","time.h","","int","pid_t","FAR clockid_t *"
|
||||
"clock_getres","time.h","","int","clockid_t","FAR struct timespec *"
|
||||
"clock_gettime","time.h","","int","clockid_t","FAR struct timespec *"
|
||||
"clock_nanosleep","time.h","","int","clockid_t","int","FAR const struct timespec *", "FAR struct timespec *"
|
||||
"clock_settime","time.h","","int","clockid_t","const struct timespec*"
|
||||
|
Can't render this file because it has a wrong number of fields in line 2.
|
Loading…
Reference in New Issue
Block a user