Fix warnings from kill and getpid not being implemented (#183)

* Fix warnings from kill and getpid not being implemented

* Fix comments
pull/15494/head
Jamie Smith 2023-09-20 21:52:30 -07:00 committed by GitHub
parent 264dbe219f
commit 36506c9d61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 4 deletions

View File

@ -1464,6 +1464,10 @@ extern "C" WEAK void __cxa_pure_virtual(void)
// SP. This make it compatible with RTX RTOS thread stacks.
#if defined(TOOLCHAIN_GCC_ARM)
// Turn off the errno macro and use actual global variable instead.
#undef errno
extern "C" int errno;
#if defined(MBED_SPLIT_HEAP)
// Default RAM memory used for heap
@ -1506,10 +1510,6 @@ extern "C" WEAK caddr_t _sbrk(int incr)
extern "C" uint32_t __end__;
extern "C" uint32_t __HeapLimit;
// Turn off the errno macro and use actual global variable instead.
#undef errno
extern "C" int errno;
// Weak attribute allows user to override, e.g. to use external RAM for dynamic memory.
extern "C" WEAK caddr_t _sbrk(int incr)
{
@ -1529,6 +1529,27 @@ extern "C" WEAK caddr_t _sbrk(int incr)
#endif
#endif
#if defined(TOOLCHAIN_GCC_ARM)
// Implementation of getpid for Newlib, following signature here:
// https://github.com/bminor/newlib/blob/55485616ba2afedca05da40f5cde59ee336b9f28/newlib/libc/sys/arm/syscalls.c#L32
extern "C" pid_t _getpid()
{
// Since PIDs aren't a thing on embedded, just return 0
return 0;
}
// Implementation of kill for Newlib, following signature here:
// https://github.com/bminor/newlib/blob/55485616ba2afedca05da40f5cde59ee336b9f28/newlib/libc/sys/arm/syscalls.c#L33
extern "C" int _kill(int pid, int signal)
{
// Always return error
errno = ENOSYS;
return -1;
}
#endif
#if defined(TOOLCHAIN_GCC_ARM)
extern "C" void _exit(int return_code)
{