mirror of
https://github.com/apache/nuttx.git
synced 2026-06-01 07:45:16 +08:00
Back out and replace recent kludges for errno and clock_systimer. There is a cleaner way
This commit is contained in:
+3
-1
@@ -409,8 +409,10 @@ audio/libaudio$(LIBEXT): context
|
|||||||
lib/libaudio$(LIBEXT): audio/libaudio$(LIBEXT)
|
lib/libaudio$(LIBEXT): audio/libaudio$(LIBEXT)
|
||||||
$(Q) install audio/libaudio$(LIBEXT) lib/libaudio$(LIBEXT)
|
$(Q) install audio/libaudio$(LIBEXT) lib/libaudio$(LIBEXT)
|
||||||
|
|
||||||
|
# Special case
|
||||||
|
|
||||||
syscall/libstubs$(LIBEXT): context
|
syscall/libstubs$(LIBEXT): context
|
||||||
$(Q) $(MAKE) -C syscall TOPDIR="$(TOPDIR)" libstubs$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
$(Q) $(MAKE) -C syscall TOPDIR="$(TOPDIR)" libstubs$(LIBEXT) # EXTRADEFINES=$(KDEFINE)
|
||||||
|
|
||||||
lib/libstubs$(LIBEXT): syscall/libstubs$(LIBEXT)
|
lib/libstubs$(LIBEXT): syscall/libstubs$(LIBEXT)
|
||||||
$(Q) install syscall/libstubs$(LIBEXT) lib/libstubs$(LIBEXT)
|
$(Q) install syscall/libstubs$(LIBEXT) lib/libstubs$(LIBEXT)
|
||||||
|
|||||||
+3
-1
@@ -430,8 +430,10 @@ audio\libaudio$(LIBEXT): context
|
|||||||
lib\libaudio$(LIBEXT): audio\libaudio$(LIBEXT)
|
lib\libaudio$(LIBEXT): audio\libaudio$(LIBEXT)
|
||||||
$(Q) install audio\libaudio$(LIBEXT) lib\libaudio$(LIBEXT)
|
$(Q) install audio\libaudio$(LIBEXT) lib\libaudio$(LIBEXT)
|
||||||
|
|
||||||
|
# Special case
|
||||||
|
|
||||||
syscall\libstubs$(LIBEXT): context
|
syscall\libstubs$(LIBEXT): context
|
||||||
$(Q) $(MAKE) -C syscall TOPDIR="$(TOPDIR)" libstubs$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
$(Q) $(MAKE) -C syscall TOPDIR="$(TOPDIR)" libstubs$(LIBEXT) # EXTRADEFINES=$(KDEFINE)
|
||||||
|
|
||||||
lib\libstubs$(LIBEXT): syscall\libstubs$(LIBEXT)
|
lib\libstubs$(LIBEXT): syscall\libstubs$(LIBEXT)
|
||||||
$(Q) install syscall\libstubs$(LIBEXT) lib\libstubs$(LIBEXT)
|
$(Q) install syscall\libstubs$(LIBEXT) lib\libstubs$(LIBEXT)
|
||||||
|
|||||||
+1
-1
@@ -63,7 +63,7 @@
|
|||||||
|
|
||||||
# define __DIRECT_ERRNO_ACCESS 1
|
# define __DIRECT_ERRNO_ACCESS 1
|
||||||
|
|
||||||
#elif defined(CONFIG_BUILD_KERNEL)
|
#elif defined(CONFIG_BUILD_KERNEL) && defined(__KERNEL__)
|
||||||
/* Kernel only build. The kernel has access */
|
/* Kernel only build. The kernel has access */
|
||||||
|
|
||||||
# define __DIRECT_ERRNO_ACCESS 1
|
# define __DIRECT_ERRNO_ACCESS 1
|
||||||
|
|||||||
@@ -71,18 +71,12 @@
|
|||||||
|
|
||||||
# define __HAVE_KERNEL_GLOBALS 0
|
# define __HAVE_KERNEL_GLOBALS 0
|
||||||
|
|
||||||
#elif defined(CONFIG_BUILD_PROTECTED)
|
#elif defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)
|
||||||
# if defined(__KERNEL__)
|
|
||||||
/* Case 3: Kernel mode of protected kernel build */
|
/* Case 3: Kernel mode of protected kernel build */
|
||||||
|
|
||||||
# define __HAVE_KERNEL_GLOBALS 1
|
# define __HAVE_KERNEL_GLOBALS 1
|
||||||
# else
|
|
||||||
/* User mode of protected kernel build */
|
|
||||||
|
|
||||||
# define __HAVE_KERNEL_GLOBALS 0
|
#elif defined(CONFIG_BUILD_KERNEL) && defined(__KERNEL__)
|
||||||
# endif
|
|
||||||
|
|
||||||
#elif defined(CONFIG_BUILD_KERNEL)
|
|
||||||
/* Case 3: Kernel only build */
|
/* Case 3: Kernel only build */
|
||||||
|
|
||||||
# define __HAVE_KERNEL_GLOBALS 1
|
# define __HAVE_KERNEL_GLOBALS 1
|
||||||
|
|||||||
@@ -1,110 +0,0 @@
|
|||||||
/************************************************************************
|
|
||||||
* include/nuttx/errno.h
|
|
||||||
*
|
|
||||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
************************************************************************/
|
|
||||||
|
|
||||||
#ifndef __INCLUDE_NUTTX_ERRNO_H
|
|
||||||
#define __INCLUDE_NUTTX_ERRNO_H
|
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Included Files
|
|
||||||
************************************************************************/
|
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
|
||||||
|
|
||||||
/* These must always be included before this file */
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <nuttx/clock.h>
|
|
||||||
|
|
||||||
#ifdef CONFIG_LIB_SYSCALL
|
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
************************************************************************/
|
|
||||||
/* 'errno' and timer access is awkward. We need to generate get_errno(),
|
|
||||||
* set_errno(), and clock_systimer() interfaces to support the system
|
|
||||||
* calls, even though we don't use them from within the OS.
|
|
||||||
*
|
|
||||||
* The "normal" pre-processor definitions for the errno functions are in
|
|
||||||
* errno.h and clock functions in nuttx/clock.h but we need the internal
|
|
||||||
* function prototypes in here because those may be macro-ized.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#undef get_errno
|
|
||||||
#undef set_errno
|
|
||||||
#undef clock_systimer
|
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Type Declarations
|
|
||||||
************************************************************************/
|
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Public Data
|
|
||||||
************************************************************************/
|
|
||||||
|
|
||||||
#undef EXTERN
|
|
||||||
#if defined(__cplusplus)
|
|
||||||
#define EXTERN extern "C"
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
#else
|
|
||||||
#define EXTERN extern
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Public Function Prototypes
|
|
||||||
************************************************************************/
|
|
||||||
/* These get_errno(), set_errno(), and clock_systimer() functions are
|
|
||||||
* always exported as functions from the kernel always when the system
|
|
||||||
* call interface is built. errno.h and nuttx/clock.h provide the
|
|
||||||
* context-specific usage interface for both the kernel- and
|
|
||||||
* user-spaces. These may be different: These interfaces may be macro-
|
|
||||||
* ized in those header files.
|
|
||||||
*
|
|
||||||
* This header file always exists to disambiguate the context. The
|
|
||||||
* prototypes here duplicate those of errno.h and nuttx/clock.h and must
|
|
||||||
* exactly match.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void set_errno(int errcode);
|
|
||||||
int get_errno(void);
|
|
||||||
uint32_t clock_systimer(void);
|
|
||||||
|
|
||||||
#undef EXTERN
|
|
||||||
#if defined(__cplusplus)
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* CONFIG_LIB_SYSCALL */
|
|
||||||
#endif /* __INCLUDE_NUTTX_ERRNO_H */
|
|
||||||
@@ -49,7 +49,10 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
/* See nuttx/clock.h */
|
||||||
|
|
||||||
|
#undef clock_systimer
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -74,7 +77,6 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if !defined(clock_systimer) /* See nuttx/clock.h */
|
|
||||||
uint32_t clock_systimer(void)
|
uint32_t clock_systimer(void)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SCHED_TICKLESS
|
#ifdef CONFIG_SCHED_TICKLESS
|
||||||
@@ -104,7 +106,6 @@ uint32_t clock_systimer(void)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: clock_systimer64
|
* Name: clock_systimer64
|
||||||
@@ -122,7 +123,6 @@ uint32_t clock_systimer(void)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if !defined(clock_systimer) /* See nuttx/clock.h */
|
|
||||||
#ifdef CONFIG_SYSTEM_TIME64
|
#ifdef CONFIG_SYSTEM_TIME64
|
||||||
uint64_t clock_systimer64(void)
|
uint64_t clock_systimer64(void)
|
||||||
{
|
{
|
||||||
@@ -144,4 +144,3 @@ uint64_t clock_systimer64(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|||||||
+3
-3
@@ -6,7 +6,7 @@
|
|||||||
"clock_getres","time.h","","int","clockid_t","struct timespec*"
|
"clock_getres","time.h","","int","clockid_t","struct timespec*"
|
||||||
"clock_gettime","time.h","","int","clockid_t","struct timespec*"
|
"clock_gettime","time.h","","int","clockid_t","struct timespec*"
|
||||||
"clock_settime","time.h","","int","clockid_t","const struct timespec*"
|
"clock_settime","time.h","","int","clockid_t","const struct timespec*"
|
||||||
"clock_systimer","nuttx/syscall.h","","uint32_t"
|
"clock_systimer","nuttx/clock.h","","uint32_t"
|
||||||
"close","unistd.h","CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0","int","int"
|
"close","unistd.h","CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0","int","int"
|
||||||
"closedir","dirent.h","CONFIG_NFILE_DESCRIPTORS > 0","int","FAR DIR*"
|
"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"
|
"connect","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","FAR const struct sockaddr*","socklen_t"
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
"fcntl","fcntl.h","CONFIG_NFILE_DESCRIPTORS > 0","int","int","int","..."
|
"fcntl","fcntl.h","CONFIG_NFILE_DESCRIPTORS > 0","int","int","int","..."
|
||||||
"fs_fdopen","nuttx/fs/fs.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","FAR struct file_struct*","int","int","FAR struct tcb_s*"
|
"fs_fdopen","nuttx/fs/fs.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","FAR struct file_struct*","int","int","FAR struct tcb_s*"
|
||||||
"fsync","unistd.h","CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT)","int","int"
|
"fsync","unistd.h","CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT)","int","int"
|
||||||
"get_errno","nuttx/syscall.h","","int"
|
"get_errno","errno.h","","int"
|
||||||
"getenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","FAR char*","FAR const char*"
|
"getenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","FAR char*","FAR const char*"
|
||||||
"getpid","unistd.h","","pid_t"
|
"getpid","unistd.h","","pid_t"
|
||||||
"getsockopt","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","int","int","FAR void*","FAR socklen_t*"
|
"getsockopt","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","int","int","FAR void*","FAR socklen_t*"
|
||||||
@@ -110,7 +110,7 @@
|
|||||||
"send","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","ssize_t","int","FAR const void*","size_t","int"
|
"send","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","ssize_t","int","FAR const void*","size_t","int"
|
||||||
"sendfile","sys/sendfile.h","CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_NET_SENDFILE)","ssize_t","int","int","FAR off_t*","size_t"
|
"sendfile","sys/sendfile.h","CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_NET_SENDFILE)","ssize_t","int","int","FAR off_t*","size_t"
|
||||||
"sendto","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","ssize_t","int","FAR const void*","size_t","int","FAR const struct sockaddr*","socklen_t"
|
"sendto","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","ssize_t","int","FAR const void*","size_t","int","FAR const struct sockaddr*","socklen_t"
|
||||||
"set_errno","nuttx/syscall.h","","void","int"
|
"set_errno","errno.h","","void","int"
|
||||||
"setenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","int","const char*","const char*","int"
|
"setenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","int","const char*","const char*","int"
|
||||||
"setsockopt","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","int","int","FAR const void*","socklen_t"
|
"setsockopt","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","int","int","FAR const void*","socklen_t"
|
||||||
"sigaction","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","int","FAR const struct sigaction*","FAR struct sigaction*"
|
"sigaction","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","int","FAR const struct sigaction*","FAR struct sigaction*"
|
||||||
|
|||||||
|
@@ -46,7 +46,7 @@
|
|||||||
* a kernel build.
|
* a kernel build.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(CONFIG_LIB_SYSCALL) && defined(__KERNEL__)
|
#if defined(CONFIG_LIB_SYSCALL)
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor definitions
|
* Pre-processor definitions
|
||||||
@@ -341,4 +341,4 @@ const uintptr_t g_stublookup[SYS_nsyscalls] =
|
|||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#endif /* CONFIG_LIB_SYSCALL && __KERNEL__ */
|
#endif /* CONFIG_LIB_SYSCALL */
|
||||||
|
|||||||
Reference in New Issue
Block a user