sched/clock: move clock_getcpuclockid() and clock_getres() to libc

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
Petro Karashchenko
2023-07-07 12:04:59 +03:00
committed by Alan Carvalho de Assis
parent 15991ef919
commit b8d3e32bdf
7 changed files with 16 additions and 22 deletions
-2
View File
@@ -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
+2 -1
View File
@@ -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"
1 __assert assert.h void FAR const char * int FAR const char *
33 cfgetspeed termios.h speed_t FAR const struct termios *
34 cfsetspeed termios.h int FAR struct termios * speed_t
35 chdir unistd.h !defined(CONFIG_DISABLE_ENVIRON) int FAR const char *
36 clock clock_getcpuclockid time.h clock_t int pid_t FAR clockid_t *
37 clock_getres time.h int clockid_t FAR struct timespec *
38 closedir dirent.h int DIR *
39 crc32 nuttx/crc32.h uint32_t FAR const uint8_t * size_t
40 crc32part nuttx/crc32.h uint32_t FAR const uint8_t * size_t uint32_t
+1
View File
@@ -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
+2 -4
View File
@@ -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
-2
View File
@@ -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*"
1 _assert assert.h void FAR const char * int FAR const char * FAR void *
13 chown unistd.h int FAR const char * uid_t gid_t
14 clearenv stdlib.h !defined(CONFIG_DISABLE_ENVIRON) int
15 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 *
16 clock_gettime time.h int clockid_t FAR struct timespec *
17 clock_nanosleep time.h int clockid_t int FAR const struct timespec * FAR struct timespec *
18 clock_settime time.h int clockid_t const struct timespec*