Skip to content

Commit

Permalink
newlib: add definitions of system, raise
Browse files Browse the repository at this point in the history
Closes IDF-1220
Closes IDFGH-1811
Closes #4020
  • Loading branch information
igrr committed Dec 11, 2019
1 parent 20742db commit 08286ac
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions components/newlib/syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,23 @@
#include <sys/reent.h>


int system(const char* str)
{
errno = ENOSYS;
return -1;
}

int _system_r(struct _reent *r, const char *str)
{
__errno_r(r) = ENOSYS;
return -1;
}

int raise(int sig)
{
abort();
}

int _raise_r(struct _reent *r, int sig)
{
abort();
Expand Down
5 changes: 5 additions & 0 deletions components/newlib/test/test_newlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,8 @@ TEST_CASE("fmod and fmodf work as expected", "[newlib]")
TEST_ASSERT_EQUAL(0.1, fmod(10.1, 2.0));
TEST_ASSERT_EQUAL(0.1f, fmodf(10.1f, 2.0f));
}

TEST_CASE("newlib: can link 'system', 'raise'", "[newlib]")
{
printf("system: %p, raise: %p\n", &system, &raise);
}

0 comments on commit 08286ac

Please sign in to comment.