diff --git a/include/sys/syscall.h b/include/sys/syscall.h index d0223e9799..d2ca587a57 100644 --- a/include/sys/syscall.h +++ b/include/sys/syscall.h @@ -1,8 +1,8 @@ -/**************************************************************************** +ystim**************************************************************************** * include/sys/syscall.h * This file contains the system call numbers. * - * Copyright (C) 2011-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -237,7 +237,7 @@ * NuttX configuration. */ -#define SYS_clock_systimer (__SYS_clock+0) +#define SYS_clock (__SYS_clock+0) #define SYS_clock_getres (__SYS_clock+1) #define SYS_clock_gettime (__SYS_clock+2) #define SYS_clock_settime (__SYS_clock+3) diff --git a/libs/libc/time/Make.defs b/libs/libc/time/Make.defs index b20b4a6701..89698d6a1c 100644 --- a/libs/libc/time/Make.defs +++ b/libs/libc/time/Make.defs @@ -38,7 +38,7 @@ CSRCS += lib_strftime.c lib_calendar2utc.c lib_daysbeforemonth.c CSRCS += lib_gettimeofday.c lib_isleapyear.c lib_settimeofday.c lib_time.c -CSRCS += lib_difftime.c lib_clock.c +CSRCS += lib_difftime.c ifndef CONFIG_DISABLE_SIGNALS CSRCS += lib_nanosleep.c diff --git a/libs/libc/wqueue/work_queue.c b/libs/libc/wqueue/work_queue.c index fb7995ff7f..6133c37e36 100644 --- a/libs/libc/wqueue/work_queue.c +++ b/libs/libc/wqueue/work_queue.c @@ -114,7 +114,7 @@ static int work_qqueue(FAR struct usr_wqueue_s *wqueue, /* Now, time-tag that entry and put it in the work queue. */ - work->qtime = clock_systimer(); /* Time work queued */ + work->qtime = clock(); /* Time work queued */ dq_addlast((FAR dq_entry_t *)work, &wqueue->q); kill(wqueue->pid, SIGWORK); /* Wake up the worker thread */ diff --git a/libs/libc/wqueue/work_usrthread.c b/libs/libc/wqueue/work_usrthread.c index 08c00ba7fb..eceb57e0c6 100644 --- a/libs/libc/wqueue/work_usrthread.c +++ b/libs/libc/wqueue/work_usrthread.c @@ -141,7 +141,7 @@ void work_process(FAR struct usr_wqueue_s *wqueue) /* Get the time that we started this polling cycle in clock ticks. */ - stick = clock_systimer(); + stick = clock(); /* And check each entry in the work queue. Since we have locked the * work queue we know: (1) we will not be suspended unless we do @@ -157,7 +157,7 @@ void work_process(FAR struct usr_wqueue_s *wqueue) * zero. Therefore a delay of zero will always execute immediately. */ - ctick = clock_systimer(); + ctick = clock(); elapsed = ctick - work->qtime; if (elapsed >= work->delay) { @@ -251,7 +251,7 @@ void work_process(FAR struct usr_wqueue_s *wqueue) /* Get the delay (in clock ticks) since we started the sampling */ - elapsed = clock_systimer() - stick; + elapsed = clock() - stick; if (elapsed < wqueue->delay && next > 0) { /* How must time would we need to delay to get to the end of the diff --git a/sched/clock/Make.defs b/sched/clock/Make.defs index 20ddd3d03b..e18b4877f2 100644 --- a/sched/clock/Make.defs +++ b/sched/clock/Make.defs @@ -36,7 +36,7 @@ CSRCS += clock_initialize.c clock_settime.c clock_gettime.c clock_getres.c CSRCS += clock_time2ticks.c clock_abstime2ticks.c clock_ticks2time.c CSRCS += clock_systimer.c clock_systimespec.c clock_timespec_add.c -CSRCS += clock_timespec_subtract.c +CSRCS += clock_timespec_subtract.c clock.c ifeq ($(CONFIG_CLOCK_TIMEKEEPING),y) CSRCS += clock_timekeeping.c diff --git a/libs/libc/time/lib_clock.c b/sched/clock/clock.c similarity index 97% rename from libs/libc/time/lib_clock.c rename to sched/clock/clock.c index 385e787ad7..5d25a6548e 100644 --- a/libs/libc/time/lib_clock.c +++ b/sched/clock/clock.c @@ -1,7 +1,7 @@ /**************************************************************************** - * libs/libc/time/lib_clock.c + * sched/clock/clock.c * - * Copyright (C) 2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2015, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without diff --git a/syscall/Makefile b/syscall/Makefile index 94fa8cdfdb..b6de9b836a 100644 --- a/syscall/Makefile +++ b/syscall/Makefile @@ -43,7 +43,6 @@ MKSYSCALL = "$(TOPDIR)$(DELIM)tools$(DELIM)mksyscall$(HOSTEXEEXT)" CSVFILE = "$(TOPDIR)$(DELIM)syscall$(DELIM)syscall.csv" STUB_SRCS += syscall_funclookup.c syscall_stublookup.c syscall_nparms.c -STUB_SRCS += syscall_clock_systimer.c ASRCS = AOBJS = $(ASRCS:.S=$(OBJEXT)) diff --git a/syscall/syscall.csv b/syscall/syscall.csv index 186a3993d1..529b891121 100644 --- a/syscall/syscall.csv +++ b/syscall/syscall.csv @@ -9,11 +9,11 @@ "bind","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","FAR const struct sockaddr*","socklen_t" "boardctl","sys/boardctl.h","defined(CONFIG_LIB_BOARDCTL)","int","unsigned int","uintptr_t" "clearenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","int" +"clock","time.h","","clock_t" "clock_getres","time.h","","int","clockid_t","struct timespec*" "clock_gettime","time.h","","int","clockid_t","struct timespec*" "clock_nanosleep","time.h","!defined(CONFIG_DISABLE_SIGNALS)","int","clockid_t","int","FAR const struct timespec *", "FAR struct timespec*" "clock_settime","time.h","","int","clockid_t","const struct timespec*" -"clock_systimer","nuttx/clock.h","!defined(__HAVE_KERNEL_GLOBALS)","clock_t" "close","unistd.h","CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0","int","int" "closedir","dirent.h","CONFIG_NFILE_DESCRIPTORS > 0","int","FAR DIR*" "connect","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","FAR const struct sockaddr*","socklen_t" diff --git a/syscall/syscall_clock_systimer.c b/syscall/syscall_clock_systimer.c deleted file mode 100644 index c0d13132d0..0000000000 --- a/syscall/syscall_clock_systimer.c +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** - * syscall/syscall_clock_systimer.c - * - * Copyright (C) 2011-2012, 2014, 2016 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include - -#include - -/**************************************************************************** - * Pre-processor definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: syscall_clock_systimer - * - * Description: - * In the kernel build, proxying for clock_systimer() must be handled - * specially. In the kernel phase of the build, clock_systimer() is - * macro that simply accesses a global variable. In the user phase of - * the kernel build, clock_systimer() is a proxy function. - * - * In order to fill out the table g_funclookup[], this function will stand - * in during the kernel phase of the build so that clock_systemer() will - * have an address that can be included in the g_funclookup[] table. - * - ****************************************************************************/ - -clock_t syscall_clock_systimer(void) -{ - return clock_systimer(); -} diff --git a/syscall/syscall_funclookup.c b/syscall/syscall_funclookup.c index ab8ccf4927..4b99ac6efb 100644 --- a/syscall/syscall_funclookup.c +++ b/syscall/syscall_funclookup.c @@ -89,19 +89,6 @@ #include #include -/* clock_systimer is a special case: In the kernel build, proxying for - * clock_systimer() must be handled specially. In the kernel phase of - * the build, clock_systimer() is macro that simply accesses a global - * variable. In the user phase of the kernel build, clock_systimer() - * is a proxy function. - * - * In order to fill out the table g_funclookup[], this function will stand - * in during the kernel phase of the build so that clock_systemer() will - * have an address that can be included in the g_funclookup[] table. - */ - -clock_t syscall_clock_systimer(void); - /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ diff --git a/syscall/syscall_lookup.h b/syscall/syscall_lookup.h index d8c4e91b41..e0b91642b0 100644 --- a/syscall/syscall_lookup.h +++ b/syscall/syscall_lookup.h @@ -164,7 +164,7 @@ SYSCALL_LOOKUP(up_assert, 2, STUB_up_assert) * NuttX configuration. */ - SYSCALL_LOOKUP(syscall_clock_systimer, 0, STUB_clock_systimer) + SYSCALL_LOOKUP(syscall_clock, 0, STUB_clock) SYSCALL_LOOKUP(clock_getres, 2, STUB_clock_getres) SYSCALL_LOOKUP(clock_gettime, 2, STUB_clock_gettime) SYSCALL_LOOKUP(clock_settime, 2, STUB_clock_settime) diff --git a/syscall/syscall_stublookup.c b/syscall/syscall_stublookup.c index f6326e3bb1..26690f6a95 100644 --- a/syscall/syscall_stublookup.c +++ b/syscall/syscall_stublookup.c @@ -160,7 +160,7 @@ uintptr_t STUB_clock_nanosleep(int nbr, uintptr_t parm1, uintptr_t parm2, * NuttX configuration. */ -uintptr_t STUB_clock_systimer(int nbr); +uintptr_t STUB_clock(int nbr); uintptr_t STUB_clock_getres(int nbr, uintptr_t parm1, uintptr_t parm2); uintptr_t STUB_clock_gettime(int nbr, uintptr_t parm1, uintptr_t parm2); uintptr_t STUB_clock_settime(int nbr, uintptr_t parm1, uintptr_t parm2);