mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 14:27:37 +08:00
committed by
Alan Carvalho de Assis
parent
eca7059785
commit
f8a809eb5b
@@ -182,12 +182,12 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
|||||||
|
|
||||||
/* Save the adjusted stack values in the struct tcb_s */
|
/* Save the adjusted stack values in the struct tcb_s */
|
||||||
|
|
||||||
tcb->adj_stack_ptr = (uint32_t*)top_of_stack;
|
tcb->adj_stack_ptr = (uint32_t *)top_of_stack;
|
||||||
tcb->adj_stack_size = size_of_stack;
|
tcb->adj_stack_size = size_of_stack;
|
||||||
|
|
||||||
board_autoled_on(LED_STACKCREATED);
|
board_autoled_on(LED_STACKCREATED);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -210,5 +210,5 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -185,9 +185,9 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
|||||||
top_of_stack = (uint32_t) tcb->stack_alloc_ptr + stack_size - 4;
|
top_of_stack = (uint32_t) tcb->stack_alloc_ptr + stack_size - 4;
|
||||||
|
|
||||||
/* The MINERVA stack must be aligned at word (4 byte) boundaries; for
|
/* The MINERVA stack must be aligned at word (4 byte) boundaries; for
|
||||||
* floating point use, the stack must be aligned to 8-byte addresses. If
|
* floating point use, the stack must be aligned to 8-byte addresses.
|
||||||
* necessary top_of_stack must be rounded down to the next boundary to
|
* If necessary top_of_stack must be rounded down to the next boundary
|
||||||
* meet these alignment requirements.
|
* to meet these alignment requirements.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
top_of_stack = STACK_ALIGN_DOWN(top_of_stack);
|
top_of_stack = STACK_ALIGN_DOWN(top_of_stack);
|
||||||
|
|||||||
@@ -118,19 +118,19 @@
|
|||||||
int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_TLS
|
#ifdef CONFIG_TLS
|
||||||
/* Add the size of the TLS information structure */
|
/* Add the size of the TLS information structure */
|
||||||
|
|
||||||
stack_size += sizeof(struct tls_info_s);
|
stack_size += sizeof(struct tls_info_s);
|
||||||
|
|
||||||
/* The allocated stack size must not exceed the maximum possible for the
|
/* The allocated stack size must not exceed the maximum possible for the
|
||||||
* TLS feature.
|
* TLS feature.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DEBUGASSERT(stack_size <= TLS_MAXSTACK);
|
DEBUGASSERT(stack_size <= TLS_MAXSTACK);
|
||||||
if (stack_size >= TLS_MAXSTACK)
|
if (stack_size >= TLS_MAXSTACK)
|
||||||
{
|
{
|
||||||
stack_size = TLS_MAXSTACK;
|
stack_size = TLS_MAXSTACK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Is there already a stack allocated of a different size? Because of
|
/* Is there already a stack allocated of a different size? Because of
|
||||||
@@ -229,8 +229,10 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
|||||||
* water marks.
|
* water marks.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
stack_base = (uintptr_t)tcb->stack_alloc_ptr + sizeof(struct tls_info_s);
|
stack_base = (uintptr_t)tcb->stack_alloc_ptr +
|
||||||
stack_size = tcb->adj_stack_size - sizeof(struct tls_info_s);
|
sizeof(struct tls_info_s);
|
||||||
|
stack_size = tcb->adj_stack_size -
|
||||||
|
sizeof(struct tls_info_s);
|
||||||
up_stack_color((FAR void *)stack_base, stack_size);
|
up_stack_color((FAR void *)stack_base, stack_size);
|
||||||
|
|
||||||
#endif /* CONFIG_STACK_COLORATION */
|
#endif /* CONFIG_STACK_COLORATION */
|
||||||
|
|||||||
@@ -182,12 +182,12 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
|||||||
|
|
||||||
/* Save the adjusted stack values in the struct tcb_s */
|
/* Save the adjusted stack values in the struct tcb_s */
|
||||||
|
|
||||||
tcb->adj_stack_ptr = (uint32_t*)top_of_stack;
|
tcb->adj_stack_ptr = (uint32_t *)top_of_stack;
|
||||||
tcb->adj_stack_size = size_of_stack;
|
tcb->adj_stack_size = size_of_stack;
|
||||||
|
|
||||||
board_autoled_on(LED_STACKCREATED);
|
board_autoled_on(LED_STACKCREATED);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,12 +182,12 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
|||||||
|
|
||||||
/* Save the adjusted stack values in the struct tcb_s */
|
/* Save the adjusted stack values in the struct tcb_s */
|
||||||
|
|
||||||
tcb->adj_stack_ptr = (uint32_t*)top_of_stack;
|
tcb->adj_stack_ptr = (uint32_t *)top_of_stack;
|
||||||
tcb->adj_stack_size = size_of_stack;
|
tcb->adj_stack_size = size_of_stack;
|
||||||
|
|
||||||
board_autoled_on(LED_STACKCREATED);
|
board_autoled_on(LED_STACKCREATED);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,8 @@
|
|||||||
* Private Function Prototypes
|
* Private Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static btn_buttonset_t btn_supported(FAR const struct btn_lowerhalf_s *lower);
|
static btn_buttonset_t
|
||||||
|
btn_supported(FAR const struct btn_lowerhalf_s *lower);
|
||||||
static btn_buttonset_t btn_buttons(FAR const struct btn_lowerhalf_s *lower);
|
static btn_buttonset_t btn_buttons(FAR const struct btn_lowerhalf_s *lower);
|
||||||
static void btn_enable(FAR const struct btn_lowerhalf_s *lower,
|
static void btn_enable(FAR const struct btn_lowerhalf_s *lower,
|
||||||
btn_buttonset_t press, btn_buttonset_t release,
|
btn_buttonset_t press, btn_buttonset_t release,
|
||||||
|
|||||||
@@ -55,7 +55,8 @@
|
|||||||
* Private Function Prototypes
|
* Private Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static userled_set_t userled_supported(FAR const struct userled_lowerhalf_s *lower);
|
static userled_set_t
|
||||||
|
userled_supported(FAR const struct userled_lowerhalf_s *lower);
|
||||||
static void userled_led(FAR const struct userled_lowerhalf_s *lower,
|
static void userled_led(FAR const struct userled_lowerhalf_s *lower,
|
||||||
int led, bool ledon);
|
int led, bool ledon);
|
||||||
static void userled_ledset(FAR const struct userled_lowerhalf_s *lower,
|
static void userled_ledset(FAR const struct userled_lowerhalf_s *lower,
|
||||||
@@ -86,7 +87,8 @@ static const struct userled_lowerhalf_s g_userled_lower =
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static userled_set_t userled_supported(FAR const struct userled_lowerhalf_s *lower)
|
static userled_set_t
|
||||||
|
userled_supported(FAR const struct userled_lowerhalf_s *lower)
|
||||||
{
|
{
|
||||||
ledinfo("BOARD_NLEDS: %02x\n", BOARD_NLEDS);
|
ledinfo("BOARD_NLEDS: %02x\n", BOARD_NLEDS);
|
||||||
return (userled_set_t)((1 << BOARD_NLEDS) - 1);
|
return (userled_set_t)((1 << BOARD_NLEDS) - 1);
|
||||||
|
|||||||
+2
-2
@@ -239,8 +239,8 @@ FAR struct file_struct *fs_fdopen(int fd, int oflags, FAR struct tcb_s *tcb)
|
|||||||
|
|
||||||
/* Set up pointers */
|
/* Set up pointers */
|
||||||
|
|
||||||
stream->fs_bufend = &stream->fs_bufstart[CONFIG_STDIO_BUFFER_SIZE];
|
stream->fs_bufend = &stream->fs_bufstart[CONFIG_STDIO_BUFFER_SIZE];
|
||||||
stream->fs_bufpos = stream->fs_bufstart;
|
stream->fs_bufpos = stream->fs_bufstart;
|
||||||
stream->fs_bufread = stream->fs_bufstart;
|
stream->fs_bufread = stream->fs_bufstart;
|
||||||
|
|
||||||
#ifdef CONFIG_STDIO_LINEBUFFER
|
#ifdef CONFIG_STDIO_LINEBUFFER
|
||||||
|
|||||||
@@ -51,7 +51,9 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* Configuration ************************************************************/
|
/* Configuration ************************************************************/
|
||||||
|
|
||||||
/* These interfaces are not available to kernel code */
|
/* These interfaces are not available to kernel code */
|
||||||
|
|
||||||
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
|
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
|
||||||
@@ -75,6 +77,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Standard Definitions *****************************************************/
|
/* Standard Definitions *****************************************************/
|
||||||
|
|
||||||
/* aio_cancel return values
|
/* aio_cancel return values
|
||||||
*
|
*
|
||||||
* AIO_ALLDONE - Indicates that none of the requested operations could
|
* AIO_ALLDONE - Indicates that none of the requested operations could
|
||||||
|
|||||||
+13
-11
@@ -49,33 +49,35 @@
|
|||||||
/* How can we access the errno variable? */
|
/* How can we access the errno variable? */
|
||||||
|
|
||||||
#ifdef CONFIG_BUILD_FLAT
|
#ifdef CONFIG_BUILD_FLAT
|
||||||
/* Flat build */
|
/* Flat build */
|
||||||
|
|
||||||
# if defined(CONFIG_LIB_SYSCALL) && !defined(__KERNEL__)
|
# if defined(CONFIG_LIB_SYSCALL) && !defined(__KERNEL__)
|
||||||
/* We still might be using system calls in user code. If so, then
|
/* We still might be using system calls in user code. If so, then
|
||||||
* user code will have no direct access to the errno variable.
|
* user code will have no direct access to the errno variable.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
# undef __DIRECT_ERRNO_ACCESS
|
# undef __DIRECT_ERRNO_ACCESS
|
||||||
|
|
||||||
# else
|
# else
|
||||||
/* Flat build with no system calls OR internal kernel logic... There
|
/* Flat build with no system calls OR internal kernel logic... There
|
||||||
* is direct access.
|
* is direct access.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
# define __DIRECT_ERRNO_ACCESS 1
|
# define __DIRECT_ERRNO_ACCESS 1
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
# if defined(__KERNEL__)
|
# if defined(__KERNEL__)
|
||||||
/* Kernel portion of protected/kernel build. Kernel code has direct access */
|
/* Kernel portion of protected/kernel build. Kernel code has direct
|
||||||
|
* access
|
||||||
|
*/
|
||||||
|
|
||||||
# define __DIRECT_ERRNO_ACCESS 1
|
# define __DIRECT_ERRNO_ACCESS 1
|
||||||
|
|
||||||
# else
|
# else
|
||||||
/* User portion of protected/kernel build. Application code has only indirect
|
/* User portion of protected/kernel build. Application code has only
|
||||||
* access
|
* indirect access
|
||||||
*/
|
*/
|
||||||
|
|
||||||
# undef __DIRECT_ERRNO_ACCESS
|
# undef __DIRECT_ERRNO_ACCESS
|
||||||
# endif
|
# endif
|
||||||
|
|||||||
@@ -436,7 +436,7 @@ int clock_systimespec(FAR struct timespec *ts);
|
|||||||
* Return load measurement data for the select PID.
|
* Return load measurement data for the select PID.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* pid - The task ID of the thread of interest. pid == 0 is the IDLE thread.
|
* pid - The task ID of the thread of interest. pid == 0 is IDLE thread.
|
||||||
* cpuload - The location to return the CPU load
|
* cpuload - The location to return the CPU load
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ EXTERN const int g_builtin_count;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -63,7 +63,7 @@
|
|||||||
# define HAVE_GROUP_MEMBERS 1
|
# define HAVE_GROUP_MEMBERS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* In any event, we don't need group members if support for pthreads is disabled */
|
/* We don't need group members if support for pthreads is disabled */
|
||||||
|
|
||||||
#ifdef CONFIG_DISABLE_PTHREAD
|
#ifdef CONFIG_DISABLE_PTHREAD
|
||||||
# undef HAVE_GROUP_MEMBERS
|
# undef HAVE_GROUP_MEMBERS
|
||||||
|
|||||||
@@ -54,7 +54,9 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* Configuration ************************************************************/
|
/* Configuration ************************************************************/
|
||||||
|
|
||||||
/* If CONFIG_BUILD_PROTECTED, then CONFIG_NUTTX_USERSPACE must be defined to
|
/* If CONFIG_BUILD_PROTECTED, then CONFIG_NUTTX_USERSPACE must be defined to
|
||||||
* provide the address where the user-space header can be found in memory.
|
* provide the address where the user-space header can be found in memory.
|
||||||
*/
|
*/
|
||||||
@@ -73,6 +75,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Helper Macros ************************************************************/
|
/* Helper Macros ************************************************************/
|
||||||
|
|
||||||
/* This macro is used to access the struct userpace_s header that can be
|
/* This macro is used to access the struct userpace_s header that can be
|
||||||
* found at the beginning of the user-space blob.
|
* found at the beginning of the user-space blob.
|
||||||
*/
|
*/
|
||||||
@@ -89,9 +92,9 @@
|
|||||||
|
|
||||||
struct mm_heaps_s; /* Forward reference */
|
struct mm_heaps_s; /* Forward reference */
|
||||||
|
|
||||||
/* Every user-space blob starts with a header that provides information about
|
/* Every user-space blob starts with a header that provides information about
|
||||||
* the blob. The form of that header is provided by struct userspace_s. An
|
* the blob. The form of that header is provided by struct userspace_s. An
|
||||||
* instance of this structure is expected to reside at CONFIG_NUTTX_USERSPACE.
|
* instance of this is expected to reside at CONFIG_NUTTX_USERSPACE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct userspace_s
|
struct userspace_s
|
||||||
@@ -166,7 +169,8 @@ extern "C"
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef __KERNEL__
|
#ifndef __KERNEL__
|
||||||
void task_startup(main_t entrypt, int argc, FAR char *argv[]) noreturn_function;
|
void task_startup(main_t entrypt, int argc, FAR char *argv[])
|
||||||
|
noreturn_function;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
+3
-1
@@ -172,7 +172,9 @@ void setbuf(FAR FILE *stream, FAR char *buf);
|
|||||||
int setvbuf(FAR FILE *stream, FAR char *buffer, int mode, size_t size);
|
int setvbuf(FAR FILE *stream, FAR char *buffer, int mode, size_t size);
|
||||||
int ungetc(int c, FAR FILE *stream);
|
int ungetc(int c, FAR FILE *stream);
|
||||||
|
|
||||||
/* Operations on the stdout stream, buffers, paths, and the whole printf-family */
|
/* Operations on the stdout stream, buffers, paths,
|
||||||
|
* and the whole printf-family
|
||||||
|
*/
|
||||||
|
|
||||||
void perror(FAR const char *s);
|
void perror(FAR const char *s);
|
||||||
int printf(FAR const IPTR char *fmt, ...);
|
int printf(FAR const IPTR char *fmt, ...);
|
||||||
|
|||||||
+6
-6
@@ -45,9 +45,11 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
|
|
||||||
|
#include <nuttx/kmalloc.h>
|
||||||
#include <nuttx/streams.h>
|
#include <nuttx/streams.h>
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -82,9 +84,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
|
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
|
||||||
# include <nuttx/kmalloc.h>
|
|
||||||
|
|
||||||
/* Domain-specific allocations */
|
/* Domain-specific allocations */
|
||||||
|
|
||||||
# define lib_malloc(s) kmm_malloc(s)
|
# define lib_malloc(s) kmm_malloc(s)
|
||||||
# define lib_zalloc(s) kmm_zalloc(s)
|
# define lib_zalloc(s) kmm_zalloc(s)
|
||||||
@@ -92,7 +93,7 @@
|
|||||||
# define lib_memalign(p,s) kmm_memalign(p,s)
|
# define lib_memalign(p,s) kmm_memalign(p,s)
|
||||||
# define lib_free(p) kmm_free(p)
|
# define lib_free(p) kmm_free(p)
|
||||||
|
|
||||||
/* User-accessible allocations */
|
/* User-accessible allocations */
|
||||||
|
|
||||||
# define lib_umalloc(s) kumm_malloc(s)
|
# define lib_umalloc(s) kumm_malloc(s)
|
||||||
# define lib_uzalloc(s) kumm_zalloc(s)
|
# define lib_uzalloc(s) kumm_zalloc(s)
|
||||||
@@ -100,16 +101,15 @@
|
|||||||
# define lib_ufree(p) kumm_free(p)
|
# define lib_ufree(p) kumm_free(p)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
# include <stdlib.h>
|
|
||||||
|
|
||||||
/* Domain-specific allocations */
|
/* Domain-specific allocations */
|
||||||
|
|
||||||
# define lib_malloc(s) malloc(s)
|
# define lib_malloc(s) malloc(s)
|
||||||
# define lib_zalloc(s) zalloc(s)
|
# define lib_zalloc(s) zalloc(s)
|
||||||
# define lib_realloc(p,s) realloc(p,s)
|
# define lib_realloc(p,s) realloc(p,s)
|
||||||
# define lib_free(p) free(p)
|
# define lib_free(p) free(p)
|
||||||
|
|
||||||
/* User-accessible allocations */
|
/* User-accessible allocations */
|
||||||
|
|
||||||
# define lib_umalloc(s) malloc(s)
|
# define lib_umalloc(s) malloc(s)
|
||||||
# define lib_uzalloc(s) zalloc(s)
|
# define lib_uzalloc(s) zalloc(s)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* libs/libc/unistd/lib_libdtoa.c
|
* libs/libc/stdio/lib_libdtoa.c
|
||||||
*
|
*
|
||||||
* This file was ported to NuttX by Yolande Cates.
|
* This file was ported to NuttX by Yolande Cates.
|
||||||
*
|
*
|
||||||
@@ -271,7 +271,9 @@ static void lib_dtoa(FAR struct lib_outstream_s *obj, int fmt, int prec,
|
|||||||
{
|
{
|
||||||
obj->put(obj, '.');
|
obj->put(obj, '.');
|
||||||
|
|
||||||
/* Always print at least one digit to the right of the decimal point. */
|
/* Always print at least one digit to the right of the decimal
|
||||||
|
* point.
|
||||||
|
*/
|
||||||
|
|
||||||
if (notrailing)
|
if (notrailing)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* libs/libc/unistd/lib_gethostname.c
|
* libs/libc/unistd/lib_sethostname.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Stavros Polymenis. All rights reserved.
|
* Copyright (C) 2015 Stavros Polymenis. All rights reserved.
|
||||||
* Copyright (C) 2015, 2016 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2015, 2016 Gregory Nutt. All rights reserved.
|
||||||
@@ -110,7 +110,7 @@ int sethostname(FAR const char *name, size_t size)
|
|||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
|
|
||||||
/* Save the new host name, truncating to HOST_NAME_MAX if necessary. This
|
/* Save the new host name, truncating to HOST_NAME_MAX if necessary. This
|
||||||
* internal copy is always NUL terminated. The hostname is global resource.
|
* internal copy is always NUL terminated. The hostname is global resource.
|
||||||
* There is a microscopic possibility that it could be accessed while we
|
* There is a microscopic possibility that it could be accessed while we
|
||||||
* are setting it.
|
* are setting it.
|
||||||
*/
|
*/
|
||||||
|
|||||||
+11
-12
@@ -45,26 +45,26 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
|
#include <nuttx/kmalloc.h>
|
||||||
#include <nuttx/streams.h>
|
#include <nuttx/streams.h>
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* The NuttX NX library an be build in two modes: (1) as a standard, C-library
|
/* The NuttX NX library can be build in two modes: (1) as a standard, C-
|
||||||
* that can be used by normal, user-space applications, or (2) as a special,
|
* library that can be used by normal, user-space applications, or (2) as
|
||||||
* kernel-mode NX-library only used within the OS. If NuttX is not being
|
* a special, kernel-mode NX-library only used within the OS. If NuttX is
|
||||||
* built as separated kernel- and user-space modules, then only the first
|
* not being built as separated kernel- and user-space modules, then only
|
||||||
* mode is supported.
|
* the first mode is supported.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
|
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
|
||||||
|
|
||||||
# include <nuttx/kmalloc.h>
|
/* Domain-specific allocations */
|
||||||
|
|
||||||
/* Domain-specific allocations */
|
|
||||||
|
|
||||||
# define lib_malloc(s) kmm_malloc(s)
|
# define lib_malloc(s) kmm_malloc(s)
|
||||||
# define lib_zalloc(s) kmm_zalloc(s)
|
# define lib_zalloc(s) kmm_zalloc(s)
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
# define lib_memalign(p,s) kmm_memalign(p,s)
|
# define lib_memalign(p,s) kmm_memalign(p,s)
|
||||||
# define lib_free(p) kmm_free(p)
|
# define lib_free(p) kmm_free(p)
|
||||||
|
|
||||||
/* User-accessible allocations */
|
/* User-accessible allocations */
|
||||||
|
|
||||||
# define lib_umalloc(s) kumm_malloc(s)
|
# define lib_umalloc(s) kumm_malloc(s)
|
||||||
# define lib_uzalloc(s) kumm_zalloc(s)
|
# define lib_uzalloc(s) kumm_zalloc(s)
|
||||||
@@ -80,16 +80,15 @@
|
|||||||
# define lib_ufree(p) kumm_free(p)
|
# define lib_ufree(p) kumm_free(p)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
# include <stdlib.h>
|
|
||||||
|
|
||||||
/* Domain-specific allocations */
|
/* Domain-specific allocations */
|
||||||
|
|
||||||
# define lib_malloc(s) malloc(s)
|
# define lib_malloc(s) malloc(s)
|
||||||
# define lib_zalloc(s) zalloc(s)
|
# define lib_zalloc(s) zalloc(s)
|
||||||
# define lib_realloc(p,s) realloc(p,s)
|
# define lib_realloc(p,s) realloc(p,s)
|
||||||
# define lib_free(p) free(p)
|
# define lib_free(p) free(p)
|
||||||
|
|
||||||
/* User-accessible allocations */
|
/* User-accessible allocations */
|
||||||
|
|
||||||
# define lib_umalloc(s) malloc(s)
|
# define lib_umalloc(s) malloc(s)
|
||||||
# define lib_uzalloc(s) zalloc(s)
|
# define lib_uzalloc(s) zalloc(s)
|
||||||
|
|||||||
@@ -42,6 +42,8 @@
|
|||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <nuttx/addrenv.h>
|
||||||
|
#include <nuttx/userspace.h>
|
||||||
#include <nuttx/mm/mm.h>
|
#include <nuttx/mm/mm.h>
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -56,7 +58,6 @@
|
|||||||
* ARCH_DATA_RESERVE_SIZE
|
* ARCH_DATA_RESERVE_SIZE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
# include <nuttx/addrenv.h>
|
|
||||||
# define USR_HEAP (&ARCH_DATA_RESERVE->ar_usrheap)
|
# define USR_HEAP (&ARCH_DATA_RESERVE->ar_usrheap)
|
||||||
|
|
||||||
#elif defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)
|
#elif defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)
|
||||||
@@ -65,7 +66,6 @@
|
|||||||
* structure from the userspace interface.
|
* structure from the userspace interface.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
# include <nuttx/userspace.h>
|
|
||||||
# define USR_HEAP (USERSPACE->us_heap)
|
# define USR_HEAP (USERSPACE->us_heap)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@@ -74,8 +74,4 @@
|
|||||||
# define USR_HEAP &g_mmheap
|
# define USR_HEAP &g_mmheap
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Public Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#endif /* __MM_UMM_HEAP_UMM_HEAP_H */
|
#endif /* __MM_UMM_HEAP_UMM_HEAP_H */
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ static void group_assign_grpid(FAR struct task_group_s *group)
|
|||||||
|
|
||||||
for (; ; )
|
for (; ; )
|
||||||
{
|
{
|
||||||
/* Increment the ID counter. This is global data so be extra paranoid. */
|
/* Increment the ID counter. It is global data so be extra paranoid. */
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = enter_critical_section();
|
||||||
grpid = ++g_grpid_counter;
|
grpid = ++g_grpid_counter;
|
||||||
@@ -193,8 +193,8 @@ static inline void group_inherit_identity(FAR struct task_group_s *group)
|
|||||||
* function is called as part of the task creation sequence. The structure
|
* function is called as part of the task creation sequence. The structure
|
||||||
* allocated and zeroed, but otherwise uninitialized. The full creation
|
* allocated and zeroed, but otherwise uninitialized. The full creation
|
||||||
* of the group of a two step process: (1) First, this function allocates
|
* of the group of a two step process: (1) First, this function allocates
|
||||||
* group structure early in the task creation sequence in order to provide a
|
* group structure early in the task creation sequence in order to provide
|
||||||
* group container, then (2) group_initialize() is called to set up the
|
* a group container, then (2) group_initialize() is called to set up the
|
||||||
* group membership.
|
* group membership.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
@@ -226,8 +226,8 @@ int group_allocate(FAR struct task_tcb_s *tcb, uint8_t ttype)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_NFILE_STREAMS > 0 && defined(CONFIG_MM_KERNEL_HEAP)
|
#if CONFIG_NFILE_STREAMS > 0 && defined(CONFIG_MM_KERNEL_HEAP)
|
||||||
/* If this group is being created for a privileged thread, then all elements
|
/* If this group is being created for a privileged thread, then all
|
||||||
* of the group must be created for privileged access.
|
* elements of the group must be created for privileged access.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((ttype & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL)
|
if ((ttype & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL)
|
||||||
@@ -337,7 +337,7 @@ int group_initialize(FAR struct task_tcb_s *tcb)
|
|||||||
#ifdef HAVE_GROUP_MEMBERS
|
#ifdef HAVE_GROUP_MEMBERS
|
||||||
/* Allocate space to hold GROUP_INITIAL_MEMBERS members of the group */
|
/* Allocate space to hold GROUP_INITIAL_MEMBERS members of the group */
|
||||||
|
|
||||||
group->tg_members = (FAR pid_t *)kmm_malloc(GROUP_INITIAL_MEMBERS * sizeof(pid_t));
|
group->tg_members = kmm_malloc(GROUP_INITIAL_MEMBERS * sizeof(pid_t));
|
||||||
if (!group->tg_members)
|
if (!group->tg_members)
|
||||||
{
|
{
|
||||||
kmm_free(group);
|
kmm_free(group);
|
||||||
|
|||||||
Reference in New Issue
Block a user