Merge pull request #511 from ourairquality/newlib-locks
Newlib: implement locks
This commit is contained in:
commit
c3ae04c93f
24 changed files with 3442 additions and 44 deletions
|
@ -97,6 +97,9 @@
|
||||||
#ifndef configCHECK_FOR_STACK_OVERFLOW
|
#ifndef configCHECK_FOR_STACK_OVERFLOW
|
||||||
#define configCHECK_FOR_STACK_OVERFLOW 2
|
#define configCHECK_FOR_STACK_OVERFLOW 2
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef configUSE_RECURSIVE_MUTEXES
|
||||||
|
#define configUSE_RECURSIVE_MUTEXES 1
|
||||||
|
#endif
|
||||||
#ifndef configUSE_MUTEXES
|
#ifndef configUSE_MUTEXES
|
||||||
#define configUSE_MUTEXES 1
|
#define configUSE_MUTEXES 1
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -134,6 +134,8 @@ static void IRAM default_putc(char c) {
|
||||||
uart_putc(0, c);
|
uart_putc(0, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void init_newlib_locks(void);
|
||||||
|
|
||||||
// .text+0x258
|
// .text+0x258
|
||||||
void IRAM sdk_user_start(void) {
|
void IRAM sdk_user_start(void) {
|
||||||
uint32_t buf32[sizeof(struct sdk_g_ic_saved_st) / 4];
|
uint32_t buf32[sizeof(struct sdk_g_ic_saved_st) / 4];
|
||||||
|
@ -223,6 +225,7 @@ void IRAM sdk_user_start(void) {
|
||||||
status = sysparam_init(sysparam_addr, 0);
|
status = sysparam_init(sysparam_addr, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
init_newlib_locks();
|
||||||
if (status != SYSPARAM_OK) {
|
if (status != SYSPARAM_OK) {
|
||||||
printf("WARNING: Could not initialize sysparams (%d)!\n", status);
|
printf("WARNING: Could not initialize sysparams (%d)!\n", status);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ extern "C"
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef long _WriteFunction(struct _reent *r, int fd, const char *ptr, int len );
|
typedef ssize_t _WriteFunction(struct _reent *r, int fd, const void *ptr, size_t len);
|
||||||
|
|
||||||
/** Set implementation of write syscall for stdout.
|
/** Set implementation of write syscall for stdout.
|
||||||
*
|
*
|
||||||
|
|
|
@ -15,6 +15,10 @@
|
||||||
#include <stdout_redirect.h>
|
#include <stdout_redirect.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <lwip/sockets.h>
|
#include <lwip/sockets.h>
|
||||||
|
#include <sys/lock.h>
|
||||||
|
#include <FreeRTOS.h>
|
||||||
|
#include <semphr.h>
|
||||||
|
#include <esp/hwrand.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The file descriptor index space is allocated in blocks. The first block of 3
|
* The file descriptor index space is allocated in blocks. The first block of 3
|
||||||
|
@ -32,7 +36,7 @@
|
||||||
|
|
||||||
extern void *xPortSupervisorStackPointer;
|
extern void *xPortSupervisorStackPointer;
|
||||||
|
|
||||||
IRAM caddr_t _sbrk_r (struct _reent *r, int incr)
|
IRAM void *_sbrk_r (struct _reent *r, ptrdiff_t incr)
|
||||||
{
|
{
|
||||||
extern char _heap_start; /* linker script defined */
|
extern char _heap_start; /* linker script defined */
|
||||||
static char * heap_end;
|
static char * heap_end;
|
||||||
|
@ -58,15 +62,15 @@ IRAM caddr_t _sbrk_r (struct _reent *r, int incr)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* syscall implementation for stdio write to UART */
|
/* syscall implementation for stdio write to UART */
|
||||||
__attribute__((weak)) long _write_stdout_r(struct _reent *r, int fd, const char *ptr, int len )
|
__attribute__((weak)) ssize_t _write_stdout_r(struct _reent *r, int fd, const void *ptr, size_t len )
|
||||||
{
|
{
|
||||||
for(int i = 0; i < len; i++) {
|
for(int i = 0; i < len; i++) {
|
||||||
/* Auto convert CR to CRLF, ignore other LFs (compatible with Espressif SDK behaviour) */
|
/* Auto convert CR to CRLF, ignore other LFs (compatible with Espressif SDK behaviour) */
|
||||||
if(ptr[i] == '\r')
|
if(((char *)ptr)[i] == '\r')
|
||||||
continue;
|
continue;
|
||||||
if(ptr[i] == '\n')
|
if(((char *)ptr)[i] == '\n')
|
||||||
uart_putc(0, '\r');
|
uart_putc(0, '\r');
|
||||||
uart_putc(0, ptr[i]);
|
uart_putc(0, ((char *)ptr)[i]);
|
||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
@ -88,13 +92,13 @@ _WriteFunction *get_write_stdout()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* default implementation, replace in a filesystem */
|
/* default implementation, replace in a filesystem */
|
||||||
__attribute__((weak)) long _write_filesystem_r(struct _reent *r, int fd, const char *ptr, int len )
|
__attribute__((weak)) ssize_t _write_filesystem_r(struct _reent *r, int fd, const void *ptr, size_t len)
|
||||||
{
|
{
|
||||||
r->_errno = EBADF;
|
r->_errno = EBADF;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((weak)) long _write_r(struct _reent *r, int fd, const char *ptr, int len )
|
__attribute__((weak)) ssize_t _write_r(struct _reent *r, int fd, const void *ptr, size_t len)
|
||||||
{
|
{
|
||||||
if (fd >= FILE_DESCRIPTOR_OFFSET) {
|
if (fd >= FILE_DESCRIPTOR_OFFSET) {
|
||||||
return _write_filesystem_r(r, fd, ptr, len);
|
return _write_filesystem_r(r, fd, ptr, len);
|
||||||
|
@ -110,26 +114,26 @@ __attribute__((weak)) long _write_r(struct _reent *r, int fd, const char *ptr, i
|
||||||
}
|
}
|
||||||
|
|
||||||
/* syscall implementation for stdio read from UART */
|
/* syscall implementation for stdio read from UART */
|
||||||
__attribute__((weak)) long _read_stdin_r(struct _reent *r, int fd, char *ptr, int len)
|
__attribute__((weak)) ssize_t _read_stdin_r(struct _reent *r, int fd, void *ptr, size_t len)
|
||||||
{
|
{
|
||||||
int ch, i;
|
int ch, i;
|
||||||
uart_rxfifo_wait(0, 1);
|
uart_rxfifo_wait(0, 1);
|
||||||
for(i = 0; i < len; i++) {
|
for(i = 0; i < len; i++) {
|
||||||
ch = uart_getc_nowait(0);
|
ch = uart_getc_nowait(0);
|
||||||
if (ch < 0) break;
|
if (ch < 0) break;
|
||||||
ptr[i] = ch;
|
((char *)ptr)[i] = ch;
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* default implementation, replace in a filesystem */
|
/* default implementation, replace in a filesystem */
|
||||||
__attribute__((weak)) long _read_filesystem_r( struct _reent *r, int fd, char *ptr, int len )
|
__attribute__((weak)) ssize_t _read_filesystem_r( struct _reent *r, int fd, void *ptr, size_t len )
|
||||||
{
|
{
|
||||||
r->_errno = EBADF;
|
r->_errno = EBADF;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((weak)) long _read_r( struct _reent *r, int fd, char *ptr, int len )
|
__attribute__((weak)) ssize_t _read_r( struct _reent *r, int fd, void *ptr, size_t len )
|
||||||
{
|
{
|
||||||
if (fd >= FILE_DESCRIPTOR_OFFSET) {
|
if (fd >= FILE_DESCRIPTOR_OFFSET) {
|
||||||
return _read_filesystem_r(r, fd, ptr, len);
|
return _read_filesystem_r(r, fd, ptr, len);
|
||||||
|
@ -173,10 +177,10 @@ __attribute__((weak, alias("syscall_returns_enosys")))
|
||||||
int _unlink_r(struct _reent *r, const char *path);
|
int _unlink_r(struct _reent *r, const char *path);
|
||||||
|
|
||||||
__attribute__((weak, alias("syscall_returns_enosys")))
|
__attribute__((weak, alias("syscall_returns_enosys")))
|
||||||
int _fstat_r(struct _reent *r, int fd, void *buf);
|
int _fstat_r(struct _reent *r, int fd, struct stat *buf);
|
||||||
|
|
||||||
__attribute__((weak, alias("syscall_returns_enosys")))
|
__attribute__((weak, alias("syscall_returns_enosys")))
|
||||||
int _stat_r(struct _reent *r, const char *pathname, void *buf);
|
int _stat_r(struct _reent *r, const char *pathname, struct stat *buf);
|
||||||
|
|
||||||
__attribute__((weak, alias("syscall_returns_enosys")))
|
__attribute__((weak, alias("syscall_returns_enosys")))
|
||||||
off_t _lseek_r(struct _reent *r, int fd, off_t offset, int whence);
|
off_t _lseek_r(struct _reent *r, int fd, off_t offset, int whence);
|
||||||
|
@ -197,3 +201,99 @@ static int syscall_returns_enosys(struct _reent *r)
|
||||||
r->_errno=ENOSYS;
|
r->_errno=ENOSYS;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getentropy(void *ptr, size_t n)
|
||||||
|
{
|
||||||
|
hwrand_fill(ptr, n);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _arc4random_getentropy_fail(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void _exit(int status)
|
||||||
|
{
|
||||||
|
while(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Newlib lock implementation. Some newlib locks are statically allocated, but
|
||||||
|
* can not be statically initialized so are set to NULL and initialized at
|
||||||
|
* startup. The malloc lock is used before it can be initialized so there are
|
||||||
|
* runtime checks on the functions that use it early.
|
||||||
|
*/
|
||||||
|
static int locks_initialized = 0;
|
||||||
|
|
||||||
|
extern _lock_t __arc4random_mutex;
|
||||||
|
extern _lock_t __at_quick_exit_mutex;
|
||||||
|
//extern _lock_t __dd_hash_mutex;
|
||||||
|
extern _lock_t __tz_mutex;
|
||||||
|
|
||||||
|
extern _lock_t __atexit_recursive_mutex;
|
||||||
|
extern _lock_t __env_recursive_mutex;
|
||||||
|
extern _lock_t __malloc_recursive_mutex;
|
||||||
|
extern _lock_t __sfp_recursive_mutex;
|
||||||
|
extern _lock_t __sinit_recursive_mutex;
|
||||||
|
|
||||||
|
void init_newlib_locks()
|
||||||
|
{
|
||||||
|
_lock_init(&__arc4random_mutex);
|
||||||
|
_lock_init(&__at_quick_exit_mutex);
|
||||||
|
//_lock_init(&__dd_hash_mutex);
|
||||||
|
_lock_init(&__tz_mutex);
|
||||||
|
|
||||||
|
_lock_init_recursive(&__atexit_recursive_mutex);
|
||||||
|
_lock_init_recursive(&__env_recursive_mutex);
|
||||||
|
_lock_init_recursive(&__malloc_recursive_mutex);
|
||||||
|
_lock_init_recursive(&__sfp_recursive_mutex);
|
||||||
|
_lock_init_recursive(&__sinit_recursive_mutex);
|
||||||
|
|
||||||
|
locks_initialized = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _lock_init(_lock_t *lock) {
|
||||||
|
*lock = (_lock_t)xSemaphoreCreateMutex();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _lock_init_recursive(_lock_t *lock) {
|
||||||
|
*lock = (_lock_t)xSemaphoreCreateRecursiveMutex();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _lock_close(_lock_t *lock) {
|
||||||
|
vSemaphoreDelete((QueueHandle_t)*lock);
|
||||||
|
*lock = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _lock_close_recursive(_lock_t *lock) {
|
||||||
|
vSemaphoreDelete((QueueHandle_t)*lock);
|
||||||
|
*lock = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _lock_acquire(_lock_t *lock) {
|
||||||
|
xSemaphoreTake((QueueHandle_t)*lock, portMAX_DELAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _lock_acquire_recursive(_lock_t *lock) {
|
||||||
|
if (locks_initialized) {
|
||||||
|
xSemaphoreTakeRecursive((QueueHandle_t)*lock, portMAX_DELAY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int _lock_try_acquire(_lock_t *lock) {
|
||||||
|
return xSemaphoreTake((QueueHandle_t)*lock, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int _lock_try_acquire_recursive(_lock_t *lock) {
|
||||||
|
return xSemaphoreTakeRecursive((QueueHandle_t)*lock, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _lock_release(_lock_t *lock) {
|
||||||
|
xSemaphoreGive((QueueHandle_t)*lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _lock_release_recursive(_lock_t *lock) {
|
||||||
|
if (locks_initialized) {
|
||||||
|
xSemaphoreGiveRecursive((QueueHandle_t)*lock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -21,20 +21,6 @@ MEMORY
|
||||||
pvPortMalloc = malloc;
|
pvPortMalloc = malloc;
|
||||||
vPortFree = free;
|
vPortFree = free;
|
||||||
|
|
||||||
/* FreeRTOS lock functions.
|
|
||||||
|
|
||||||
Rely on a patch to libc that produces weak linked versions of the
|
|
||||||
below symbols. Currently treating locking primitives like universal
|
|
||||||
global critical section rather than individual locks, but this seems
|
|
||||||
OK from the use cases in newlib.
|
|
||||||
*/
|
|
||||||
_lock_acquire = vPortEnterCritical;
|
|
||||||
_lock_acquire_recursive = vPortEnterCritical;
|
|
||||||
_lock_try_acquire = vPortEnterCritical;
|
|
||||||
_lock_try_acquire_recursive = vPortEnterCritical;
|
|
||||||
_lock_release = vPortExitCritical;
|
|
||||||
_lock_release_recursive = vPortExitCritical;
|
|
||||||
|
|
||||||
/* SDK compatibility */
|
/* SDK compatibility */
|
||||||
ets_printf = printf;
|
ets_printf = printf;
|
||||||
|
|
||||||
|
|
BIN
lib/libpp.a
BIN
lib/libpp.a
Binary file not shown.
3147
libc/xtensa-lx106-elf/include/elf.h
Normal file
3147
libc/xtensa-lx106-elf/include/elf.h
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1 +1,32 @@
|
||||||
/* Use default implementation, see arc4random.h */
|
/*
|
||||||
|
* Copyright (c) 2017
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice appear in all copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
void _arc4random_getentropy_fail(void);
|
||||||
|
|
||||||
|
#define _ARC4RANDOM_DATA
|
||||||
|
|
||||||
|
#define _ARC4RANDOM_GETENTROPY_FAIL() _arc4random_getentropy_fail()
|
||||||
|
|
||||||
|
#define _ARC4RANDOM_ALLOCATE(rsp, rsxp) \
|
||||||
|
do { *rsp = malloc(sizeof(**rsp)); \
|
||||||
|
*rsxp = malloc(sizeof(**rsxp)); } \
|
||||||
|
while (0)
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
|
@ -48,6 +48,23 @@
|
||||||
This represents what type a float arg is passed as. It is used when the type is
|
This represents what type a float arg is passed as. It is used when the type is
|
||||||
not promoted to double.
|
not promoted to double.
|
||||||
|
|
||||||
|
|
||||||
|
__OBSOLETE_MATH_DEFAULT
|
||||||
|
|
||||||
|
Default value for __OBSOLETE_MATH if that's not set by the user.
|
||||||
|
It should be set here based on predefined feature macros.
|
||||||
|
|
||||||
|
__OBSOLETE_MATH
|
||||||
|
|
||||||
|
If set to 1 then some new math code will be disabled and older libm
|
||||||
|
code will be used instead. This is necessary because the new math
|
||||||
|
code does not support all targets, it assumes that the toolchain has
|
||||||
|
ISO C99 support (hexfloat literals, standard fenv semantics), the
|
||||||
|
target has IEEE-754 conforming binary32 float and binary64 double
|
||||||
|
(not mixed endian) representation, standard SNaN representation,
|
||||||
|
double and single precision arithmetics has similar latency and it
|
||||||
|
has no legacy SVID matherr support, only POSIX errno and fenv
|
||||||
|
exception based error handling.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if (defined(__arm__) || defined(__thumb__)) && !defined(__MAVERICK__)
|
#if (defined(__arm__) || defined(__thumb__)) && !defined(__MAVERICK__)
|
||||||
|
@ -61,6 +78,7 @@
|
||||||
# else
|
# else
|
||||||
# define __IEEE_BIG_ENDIAN
|
# define __IEEE_BIG_ENDIAN
|
||||||
# endif
|
# endif
|
||||||
|
# define __OBSOLETE_MATH_DEFAULT 0
|
||||||
#else
|
#else
|
||||||
# define __IEEE_BIG_ENDIAN
|
# define __IEEE_BIG_ENDIAN
|
||||||
# ifdef __ARMEL__
|
# ifdef __ARMEL__
|
||||||
|
@ -75,6 +93,7 @@
|
||||||
#else
|
#else
|
||||||
#define __IEEE_BIG_ENDIAN
|
#define __IEEE_BIG_ENDIAN
|
||||||
#endif
|
#endif
|
||||||
|
#define __OBSOLETE_MATH_DEFAULT 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __epiphany__
|
#ifdef __epiphany__
|
||||||
|
@ -435,6 +454,14 @@
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __OBSOLETE_MATH_DEFAULT
|
||||||
|
/* Use old math code by default. */
|
||||||
|
#define __OBSOLETE_MATH_DEFAULT 1
|
||||||
|
#endif
|
||||||
|
#ifndef __OBSOLETE_MATH
|
||||||
|
#define __OBSOLETE_MATH __OBSOLETE_MATH_DEFAULT
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __IEEE_BIG_ENDIAN
|
#ifndef __IEEE_BIG_ENDIAN
|
||||||
#ifndef __IEEE_LITTLE_ENDIAN
|
#ifndef __IEEE_LITTLE_ENDIAN
|
||||||
#error Endianess not declared!!
|
#error Endianess not declared!!
|
||||||
|
|
|
@ -171,9 +171,9 @@ int _EXFUN(pthread_setschedprio, (pthread_t thread, int prio));
|
||||||
#endif /* defined(_POSIX_THREAD_PRIORITY_SCHEDULING) */
|
#endif /* defined(_POSIX_THREAD_PRIORITY_SCHEDULING) */
|
||||||
|
|
||||||
#if __GNU_VISIBLE
|
#if __GNU_VISIBLE
|
||||||
int pthread_getname_np(pthread_t, char *, size_t) __nonnull(2);
|
int pthread_getname_np(pthread_t, char *, size_t) __nonnull((2));
|
||||||
|
|
||||||
int pthread_setname_np(pthread_t, const char *) __nonnull(2);
|
int pthread_setname_np(pthread_t, const char *) __nonnull((2));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_POSIX_THREAD_PRIO_INHERIT) || defined(_POSIX_THREAD_PRIO_PROTECT)
|
#if defined(_POSIX_THREAD_PRIO_INHERIT) || defined(_POSIX_THREAD_PRIO_PROTECT)
|
||||||
|
|
|
@ -796,4 +796,8 @@ _putchar_unlocked(int _c)
|
||||||
|
|
||||||
_END_STD_C
|
_END_STD_C
|
||||||
|
|
||||||
|
#if __SSP_FORTIFY_LEVEL > 0
|
||||||
|
#include <ssp/stdio.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* _STDIO_H_ */
|
#endif /* _STDIO_H_ */
|
||||||
|
|
|
@ -294,7 +294,7 @@ int _EXFUN(_unsetenv_r,(struct _reent *, const char *__string));
|
||||||
#endif /* !__CYGWIN__ */
|
#endif /* !__CYGWIN__ */
|
||||||
|
|
||||||
#if __POSIX_VISIBLE >= 200112
|
#if __POSIX_VISIBLE >= 200112
|
||||||
int _EXFUN(__nonnull (1) posix_memalign,(void **, size_t, size_t));
|
int _EXFUN(__nonnull ((1)) posix_memalign,(void **, size_t, size_t));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char * _EXFUN(_dtoa_r,(struct _reent *, double, int, int, int *, int*, char**));
|
char * _EXFUN(_dtoa_r,(struct _reent *, double, int, int, int *, int*, char**));
|
||||||
|
@ -346,4 +346,8 @@ _Noreturn void
|
||||||
|
|
||||||
_END_STD_C
|
_END_STD_C
|
||||||
|
|
||||||
|
#if __SSP_FORTIFY_LEVEL > 0
|
||||||
|
#include <ssp/stdlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* _STDLIB_H_ */
|
#endif /* _STDLIB_H_ */
|
||||||
|
|
|
@ -169,11 +169,15 @@ int _EXFUN(strverscmp,(const char *, const char *));
|
||||||
sure here. */
|
sure here. */
|
||||||
#if __GNU_VISIBLE && !defined(basename)
|
#if __GNU_VISIBLE && !defined(basename)
|
||||||
# define basename basename
|
# define basename basename
|
||||||
char *_EXFUN(__nonnull (1) basename,(const char *)) __asm__(__ASMNAME("__gnu_basename"));
|
char *_EXFUN(__nonnull ((1)) basename,(const char *)) __asm__(__ASMNAME("__gnu_basename"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/string.h>
|
#include <sys/string.h>
|
||||||
|
|
||||||
_END_STD_C
|
_END_STD_C
|
||||||
|
|
||||||
|
#if __SSP_FORTIFY_LEVEL > 0
|
||||||
|
#include <ssp/string.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* _STRING_H_ */
|
#endif /* _STRING_H_ */
|
||||||
|
|
|
@ -53,11 +53,9 @@ void explicit_bzero(void *, size_t);
|
||||||
#if __MISC_VISIBLE || __POSIX_VISIBLE < 200809 || __XSI_VISIBLE >= 700
|
#if __MISC_VISIBLE || __POSIX_VISIBLE < 200809 || __XSI_VISIBLE >= 700
|
||||||
int ffs(int) __pure2;
|
int ffs(int) __pure2;
|
||||||
#endif
|
#endif
|
||||||
#if __GNU_VISIBLE
|
#if __BSD_VISIBLE
|
||||||
int ffsl(long) __pure2;
|
int ffsl(long) __pure2;
|
||||||
int ffsll(long long) __pure2;
|
int ffsll(long long) __pure2;
|
||||||
#endif
|
|
||||||
#if __BSD_VISIBLE
|
|
||||||
int fls(int) __pure2;
|
int fls(int) __pure2;
|
||||||
int flsl(long) __pure2;
|
int flsl(long) __pure2;
|
||||||
int flsll(long long) __pure2;
|
int flsll(long long) __pure2;
|
||||||
|
@ -75,4 +73,8 @@ int strncasecmp_l (const char *, const char *, size_t, locale_t);
|
||||||
#endif
|
#endif
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
#if __SSP_FORTIFY_LEVEL > 0
|
||||||
|
#include <ssp/strings.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* _STRINGS_H_ */
|
#endif /* _STRINGS_H_ */
|
||||||
|
|
|
@ -52,17 +52,29 @@ extern "C" {
|
||||||
#define _FNOFOLLOW 0x100000
|
#define _FNOFOLLOW 0x100000
|
||||||
#define _FDIRECTORY 0x200000
|
#define _FDIRECTORY 0x200000
|
||||||
#define _FEXECSRCH 0x400000
|
#define _FEXECSRCH 0x400000
|
||||||
|
#define _FTMPFILE 0x800000
|
||||||
|
#define _FNOATIME 0x1000000
|
||||||
|
|
||||||
#define O_BINARY _FBINARY
|
#define O_BINARY _FBINARY
|
||||||
#define O_TEXT _FTEXT
|
#define O_TEXT _FTEXT
|
||||||
#define O_CLOEXEC _FNOINHERIT
|
|
||||||
#define O_DIRECT _FDIRECT
|
|
||||||
#define O_NOFOLLOW _FNOFOLLOW
|
|
||||||
#define O_DSYNC _FSYNC
|
#define O_DSYNC _FSYNC
|
||||||
#define O_RSYNC _FSYNC
|
#define O_RSYNC _FSYNC
|
||||||
#define O_DIRECTORY _FDIRECTORY
|
|
||||||
#define O_EXEC _FEXECSRCH
|
#define O_EXEC _FEXECSRCH
|
||||||
#define O_SEARCH _FEXECSRCH
|
#define O_SEARCH _FEXECSRCH
|
||||||
|
|
||||||
|
/* POSIX-1.2008 specific flags */
|
||||||
|
#if __POSIX_VISIBLE >= 200809
|
||||||
|
#define O_CLOEXEC _FNOINHERIT
|
||||||
|
#define O_NOFOLLOW _FNOFOLLOW
|
||||||
|
#define O_DIRECTORY _FDIRECTORY
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Linux-specific flags */
|
||||||
|
#if __GNU_VISIBLE
|
||||||
|
#define O_DIRECT _FDIRECT
|
||||||
|
#define O_TMPFILE _FTMPFILE
|
||||||
|
#define O_NOATIME _FNOATIME
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __MISC_VISIBLE
|
#if __MISC_VISIBLE
|
||||||
|
|
|
@ -397,7 +397,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __GNUC_PREREQ__(3, 3)
|
#if __GNUC_PREREQ__(3, 3)
|
||||||
#define __nonnull(x) __attribute__((__nonnull__(x)))
|
#define __nonnull(x) __attribute__((__nonnull__ x))
|
||||||
#define __nonnull_all __attribute__((__nonnull__))
|
#define __nonnull_all __attribute__((__nonnull__))
|
||||||
#else
|
#else
|
||||||
#define __nonnull(x)
|
#define __nonnull(x)
|
||||||
|
|
|
@ -100,6 +100,9 @@ extern "C" {
|
||||||
* _SVID_SOURCE (deprecated by _DEFAULT_SOURCE)
|
* _SVID_SOURCE (deprecated by _DEFAULT_SOURCE)
|
||||||
* _DEFAULT_SOURCE (or none of the above)
|
* _DEFAULT_SOURCE (or none of the above)
|
||||||
* POSIX-1.2008 with BSD and SVr4 extensions
|
* POSIX-1.2008 with BSD and SVr4 extensions
|
||||||
|
*
|
||||||
|
* _FORTIFY_SOURCE = 1 or 2
|
||||||
|
* Object Size Checking function wrappers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef _GNU_SOURCE
|
#ifdef _GNU_SOURCE
|
||||||
|
@ -233,9 +236,11 @@ extern "C" {
|
||||||
* __GNU_VISIBLE
|
* __GNU_VISIBLE
|
||||||
* GNU extensions; enabled with _GNU_SOURCE.
|
* GNU extensions; enabled with _GNU_SOURCE.
|
||||||
*
|
*
|
||||||
|
* __SSP_FORTIFY_LEVEL
|
||||||
|
* Object Size Checking; defined to 0 (off), 1, or 2.
|
||||||
|
*
|
||||||
* In all cases above, "enabled by default" means either by defining
|
* In all cases above, "enabled by default" means either by defining
|
||||||
* _DEFAULT_SOURCE, or by not defining any of the public feature test macros.
|
* _DEFAULT_SOURCE, or by not defining any of the public feature test macros.
|
||||||
* Defining _GNU_SOURCE makes all of the above avaliable.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef _ATFILE_SOURCE
|
#ifdef _ATFILE_SOURCE
|
||||||
|
@ -314,6 +319,17 @@ extern "C" {
|
||||||
#define __XSI_VISIBLE 0
|
#define __XSI_VISIBLE 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if _FORTIFY_SOURCE > 0 && !defined(__cplusplus) && !defined(__lint__) && \
|
||||||
|
(__OPTIMIZE__ > 0 || defined(__clang__)) && __GNUC_PREREQ__(4, 1)
|
||||||
|
# if _FORTIFY_SOURCE > 1
|
||||||
|
# define __SSP_FORTIFY_LEVEL 2
|
||||||
|
# else
|
||||||
|
# define __SSP_FORTIFY_LEVEL 1
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# define __SSP_FORTIFY_LEVEL 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/* RTEMS adheres to POSIX -- 1003.1b with some features from annexes. */
|
/* RTEMS adheres to POSIX -- 1003.1b with some features from annexes. */
|
||||||
|
|
||||||
#ifdef __rtems__
|
#ifdef __rtems__
|
||||||
|
@ -448,7 +464,7 @@ extern "C" {
|
||||||
#define _POSIX_THREAD_SAFE_FUNCTIONS 200809L
|
#define _POSIX_THREAD_SAFE_FUNCTIONS 200809L
|
||||||
/* #define _POSIX_THREAD_SPORADIC_SERVER -1 */
|
/* #define _POSIX_THREAD_SPORADIC_SERVER -1 */
|
||||||
#define _POSIX_THREADS 200809L
|
#define _POSIX_THREADS 200809L
|
||||||
/* #define _POSIX_TIMEOUTS -1 */
|
#define _POSIX_TIMEOUTS 200809L
|
||||||
#define _POSIX_TIMERS 200809L
|
#define _POSIX_TIMERS 200809L
|
||||||
/* #define _POSIX_TRACE -1 */
|
/* #define _POSIX_TRACE -1 */
|
||||||
/* #define _POSIX_TRACE_EVENT_FILTER -1 */
|
/* #define _POSIX_TRACE_EVENT_FILTER -1 */
|
||||||
|
|
|
@ -22,8 +22,17 @@ typedef _lock_t _LOCK_T;
|
||||||
Lock functions all take a pointer to the _lock_t entry, so the
|
Lock functions all take a pointer to the _lock_t entry, so the
|
||||||
value stored there can be manipulated.
|
value stored there can be manipulated.
|
||||||
*/
|
*/
|
||||||
|
#if 0
|
||||||
#define __LOCK_INIT(CLASS,NAME) CLASS _lock_t NAME = 0;
|
#define __LOCK_INIT(CLASS,NAME) CLASS _lock_t NAME = 0;
|
||||||
#define __LOCK_INIT_RECURSIVE(CLASS,NAME) CLASS _lock_t NAME = 0;
|
#define __LOCK_INIT_RECURSIVE(CLASS,NAME) CLASS _lock_t NAME = 0;
|
||||||
|
#else
|
||||||
|
/*
|
||||||
|
* Skip a 'static' class definition, so they are all visible and can
|
||||||
|
* be initialize at startup.
|
||||||
|
*/
|
||||||
|
#define __LOCK_INIT(CLASS,NAME) _lock_t NAME = 0;
|
||||||
|
#define __LOCK_INIT_RECURSIVE(CLASS,NAME) _lock_t NAME = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
void _lock_init(_lock_t *lock);
|
void _lock_init(_lock_t *lock);
|
||||||
void _lock_init_recursive(_lock_t *lock);
|
void _lock_init_recursive(_lock_t *lock);
|
||||||
|
|
|
@ -73,13 +73,17 @@ int _EXFUN(execvpe, (const char *__file, char * const __argv[], char * const
|
||||||
#if __ATFILE_VISIBLE
|
#if __ATFILE_VISIBLE
|
||||||
int _EXFUN(faccessat, (int __dirfd, const char *__path, int __mode, int __flags));
|
int _EXFUN(faccessat, (int __dirfd, const char *__path, int __mode, int __flags));
|
||||||
#endif
|
#endif
|
||||||
#if __BSD_VISIBLE || __XSI_VISIBLE >= 4
|
#if __BSD_VISIBLE || __XSI_VISIBLE >= 4 || __POSIX_VISIBLE >= 200809
|
||||||
int _EXFUN(fchdir, (int __fildes));
|
int _EXFUN(fchdir, (int __fildes));
|
||||||
#endif
|
#endif
|
||||||
|
#if __POSIX_VISIBLE >= 199309
|
||||||
int _EXFUN(fchmod, (int __fildes, mode_t __mode ));
|
int _EXFUN(fchmod, (int __fildes, mode_t __mode ));
|
||||||
|
#endif
|
||||||
#if !defined(__INSIDE_CYGWIN__)
|
#if !defined(__INSIDE_CYGWIN__)
|
||||||
|
#if __BSD_VISIBLE || __XSI_VISIBLE >= 4 || __POSIX_VISIBLE >= 200809
|
||||||
int _EXFUN(fchown, (int __fildes, uid_t __owner, gid_t __group ));
|
int _EXFUN(fchown, (int __fildes, uid_t __owner, gid_t __group ));
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#if __ATFILE_VISIBLE
|
#if __ATFILE_VISIBLE
|
||||||
int _EXFUN(fchownat, (int __dirfd, const char *__path, uid_t __owner, gid_t __group, int __flags));
|
int _EXFUN(fchownat, (int __dirfd, const char *__path, uid_t __owner, gid_t __group, int __flags));
|
||||||
#endif
|
#endif
|
||||||
|
@ -89,7 +93,9 @@ int _EXFUN(fexecve, (int __fd, char * const __argv[], char * const __envp[] ));
|
||||||
pid_t _EXFUN(fork, (void ));
|
pid_t _EXFUN(fork, (void ));
|
||||||
long _EXFUN(fpathconf, (int __fd, int __name ));
|
long _EXFUN(fpathconf, (int __fd, int __name ));
|
||||||
int _EXFUN(fsync, (int __fd));
|
int _EXFUN(fsync, (int __fd));
|
||||||
|
#if __POSIX_VISIBLE >= 199309
|
||||||
int _EXFUN(fdatasync, (int __fd));
|
int _EXFUN(fdatasync, (int __fd));
|
||||||
|
#endif
|
||||||
#if __GNU_VISIBLE
|
#if __GNU_VISIBLE
|
||||||
char * _EXFUN(get_current_dir_name, (void));
|
char * _EXFUN(get_current_dir_name, (void));
|
||||||
#endif
|
#endif
|
||||||
|
@ -113,12 +119,16 @@ char * _EXFUN(getlogin, (void ));
|
||||||
#if defined(_POSIX_THREAD_SAFE_FUNCTIONS)
|
#if defined(_POSIX_THREAD_SAFE_FUNCTIONS)
|
||||||
int _EXFUN(getlogin_r, (char *name, size_t namesize) );
|
int _EXFUN(getlogin_r, (char *name, size_t namesize) );
|
||||||
#endif
|
#endif
|
||||||
|
#if __BSD_VISIBLE || (__XSI_VISIBLE && __POSIX_VISIBLE < 200112)
|
||||||
char * _EXFUN(getpass, (const char *__prompt));
|
char * _EXFUN(getpass, (const char *__prompt));
|
||||||
int _EXFUN(getpagesize, (void));
|
int _EXFUN(getpagesize, (void));
|
||||||
|
#endif
|
||||||
#if __BSD_VISIBLE
|
#if __BSD_VISIBLE
|
||||||
int _EXFUN(getpeereid, (int, uid_t *, gid_t *));
|
int _EXFUN(getpeereid, (int, uid_t *, gid_t *));
|
||||||
#endif
|
#endif
|
||||||
|
#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 4
|
||||||
pid_t _EXFUN(getpgid, (pid_t));
|
pid_t _EXFUN(getpgid, (pid_t));
|
||||||
|
#endif
|
||||||
pid_t _EXFUN(getpgrp, (void ));
|
pid_t _EXFUN(getpgrp, (void ));
|
||||||
pid_t _EXFUN(getpid, (void ));
|
pid_t _EXFUN(getpid, (void ));
|
||||||
pid_t _EXFUN(getppid, (void ));
|
pid_t _EXFUN(getppid, (void ));
|
||||||
|
@ -142,13 +152,17 @@ int _EXFUN(isatty, (int __fildes ));
|
||||||
int _EXFUN(issetugid, (void));
|
int _EXFUN(issetugid, (void));
|
||||||
#endif
|
#endif
|
||||||
#if !defined(__INSIDE_CYGWIN__)
|
#if !defined(__INSIDE_CYGWIN__)
|
||||||
|
#if __BSD_VISIBLE || __XSI_VISIBLE >= 4 || __POSIX_VISIBLE >= 200809
|
||||||
int _EXFUN(lchown, (const char *__path, uid_t __owner, gid_t __group ));
|
int _EXFUN(lchown, (const char *__path, uid_t __owner, gid_t __group ));
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
int _EXFUN(link, (const char *__path1, const char *__path2 ));
|
int _EXFUN(link, (const char *__path1, const char *__path2 ));
|
||||||
#if __ATFILE_VISIBLE
|
#if __ATFILE_VISIBLE
|
||||||
int _EXFUN(linkat, (int __dirfd1, const char *__path1, int __dirfd2, const char *__path2, int __flags ));
|
int _EXFUN(linkat, (int __dirfd1, const char *__path1, int __dirfd2, const char *__path2, int __flags ));
|
||||||
#endif
|
#endif
|
||||||
|
#if __MISC_VISIBLE || __XSI_VISIBLE
|
||||||
int _EXFUN(nice, (int __nice_value ));
|
int _EXFUN(nice, (int __nice_value ));
|
||||||
|
#endif
|
||||||
#if !defined(__INSIDE_CYGWIN__)
|
#if !defined(__INSIDE_CYGWIN__)
|
||||||
off_t _EXFUN(lseek, (int __fildes, off_t __offset, int __whence ));
|
off_t _EXFUN(lseek, (int __fildes, off_t __offset, int __whence ));
|
||||||
#endif
|
#endif
|
||||||
|
@ -168,8 +182,10 @@ int _EXFUN(pipe, (int __fildes[2] ));
|
||||||
#if __GNU_VISIBLE
|
#if __GNU_VISIBLE
|
||||||
int _EXFUN(pipe2, (int __fildes[2], int flags));
|
int _EXFUN(pipe2, (int __fildes[2], int flags));
|
||||||
#endif
|
#endif
|
||||||
|
#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 500
|
||||||
ssize_t _EXFUN(pread, (int __fd, void *__buf, size_t __nbytes, off_t __offset));
|
ssize_t _EXFUN(pread, (int __fd, void *__buf, size_t __nbytes, off_t __offset));
|
||||||
ssize_t _EXFUN(pwrite, (int __fd, const void *__buf, size_t __nbytes, off_t __offset));
|
ssize_t _EXFUN(pwrite, (int __fd, const void *__buf, size_t __nbytes, off_t __offset));
|
||||||
|
#endif
|
||||||
_READ_WRITE_RETURN_TYPE _EXFUN(read, (int __fd, void *__buf, size_t __nbyte ));
|
_READ_WRITE_RETURN_TYPE _EXFUN(read, (int __fd, void *__buf, size_t __nbyte ));
|
||||||
#if __BSD_VISIBLE
|
#if __BSD_VISIBLE
|
||||||
int _EXFUN(rresvport, (int *__alport));
|
int _EXFUN(rresvport, (int *__alport));
|
||||||
|
@ -179,7 +195,9 @@ int _EXFUN(rmdir, (const char *__path ));
|
||||||
#if __BSD_VISIBLE
|
#if __BSD_VISIBLE
|
||||||
int _EXFUN(ruserok, (const char *rhost, int superuser, const char *ruser, const char *luser));
|
int _EXFUN(ruserok, (const char *rhost, int superuser, const char *ruser, const char *luser));
|
||||||
#endif
|
#endif
|
||||||
|
#if __BSD_VISIBLE || (__XSI_VISIBLE >= 4 && __POSIX_VISIBLE < 200112)
|
||||||
void * _EXFUN(sbrk, (ptrdiff_t __incr));
|
void * _EXFUN(sbrk, (ptrdiff_t __incr));
|
||||||
|
#endif
|
||||||
#if !defined(__INSIDE_CYGWIN__)
|
#if !defined(__INSIDE_CYGWIN__)
|
||||||
#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112
|
#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112
|
||||||
int _EXFUN(setegid, (gid_t __gid ));
|
int _EXFUN(setegid, (gid_t __gid ));
|
||||||
|
@ -194,7 +212,9 @@ int _EXFUN(setgroups, (int ngroups, const gid_t *grouplist ));
|
||||||
int _EXFUN(sethostname, (const char *, size_t));
|
int _EXFUN(sethostname, (const char *, size_t));
|
||||||
#endif
|
#endif
|
||||||
int _EXFUN(setpgid, (pid_t __pid, pid_t __pgid ));
|
int _EXFUN(setpgid, (pid_t __pid, pid_t __pgid ));
|
||||||
|
#if __SVID_VISIBLE || __XSI_VISIBLE >= 500
|
||||||
int _EXFUN(setpgrp, (void ));
|
int _EXFUN(setpgrp, (void ));
|
||||||
|
#endif
|
||||||
#if (__BSD_VISIBLE || __XSI_VISIBLE >= 4) && !defined(__INSIDE_CYGWIN__)
|
#if (__BSD_VISIBLE || __XSI_VISIBLE >= 4) && !defined(__INSIDE_CYGWIN__)
|
||||||
int _EXFUN(setregid, (gid_t __rgid, gid_t __egid));
|
int _EXFUN(setregid, (gid_t __rgid, gid_t __egid));
|
||||||
int _EXFUN(setreuid, (uid_t __ruid, uid_t __euid));
|
int _EXFUN(setreuid, (uid_t __ruid, uid_t __euid));
|
||||||
|
@ -567,4 +587,9 @@ int _EXFUN(unlinkat, (int, const char *, int));
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if __SSP_FORTIFY_LEVEL > 0
|
||||||
|
#include <ssp/unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* _SYS_UNISTD_H */
|
#endif /* _SYS_UNISTD_H */
|
||||||
|
|
|
@ -189,6 +189,10 @@ int _EXFUN(wmemcmp, (const wchar_t *, const wchar_t *, size_t));
|
||||||
wchar_t *_EXFUN(wmemcpy, (wchar_t *__restrict, const wchar_t *__restrict,
|
wchar_t *_EXFUN(wmemcpy, (wchar_t *__restrict, const wchar_t *__restrict,
|
||||||
size_t));
|
size_t));
|
||||||
wchar_t *_EXFUN(wmemmove, (wchar_t *, const wchar_t *, size_t));
|
wchar_t *_EXFUN(wmemmove, (wchar_t *, const wchar_t *, size_t));
|
||||||
|
#if __GNU_VISIBLE
|
||||||
|
wchar_t *_EXFUN(wmempcpy, (wchar_t *__restrict, const wchar_t *__restrict,
|
||||||
|
size_t));
|
||||||
|
#endif
|
||||||
wchar_t *_EXFUN(wmemset, (wchar_t *, wchar_t, size_t));
|
wchar_t *_EXFUN(wmemset, (wchar_t *, wchar_t, size_t));
|
||||||
|
|
||||||
long _EXFUN(wcstol, (const wchar_t *__restrict, wchar_t **__restrict, int));
|
long _EXFUN(wcstol, (const wchar_t *__restrict, wchar_t **__restrict, int));
|
||||||
|
@ -331,4 +335,8 @@ int _EXFUN(_wscanf_r, (struct _reent *, const wchar_t *, ...));
|
||||||
|
|
||||||
_END_STD_C
|
_END_STD_C
|
||||||
|
|
||||||
|
#if __SSP_FORTIFY_LEVEL > 0
|
||||||
|
#include <ssp/wchar.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* _WCHAR_H_ */
|
#endif /* _WCHAR_H_ */
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -4,6 +4,23 @@
|
||||||
BSD Licensed as described in the file LICENSE
|
BSD Licensed as described in the file LICENSE
|
||||||
*/
|
*/
|
||||||
#include "open_esplibs.h"
|
#include "open_esplibs.h"
|
||||||
|
#include "stdlib.h"
|
||||||
|
#include "stdint.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This replaces a dynamic allocation, a call to zalloc(), from within a
|
||||||
|
* critical section in the ppTask. The allocation aquired the malloc lock and
|
||||||
|
* doing so withing a critical section is not safe because it might preempt
|
||||||
|
* another task which is not possible from within a critical section. The data
|
||||||
|
* is written to the rtc memory, and was then freed. The freeing has been
|
||||||
|
* patched to be a nop.
|
||||||
|
*/
|
||||||
|
static const uint32_t pp_zeros[8];
|
||||||
|
void *_ppz20(size_t n)
|
||||||
|
{
|
||||||
|
return &pp_zeros;
|
||||||
|
}
|
||||||
|
|
||||||
#if OPEN_LIBPP_PP
|
#if OPEN_LIBPP_PP
|
||||||
// The contents of this file are only built if OPEN_LIBPHY_PHY_CHIP_SLEEP is set to true
|
// The contents of this file are only built if OPEN_LIBPHY_PHY_CHIP_SLEEP is set to true
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue