mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-25 03:22:39 +00:00
tools/nolibc: implement strerror()
strerror() is commonly used. For example in kselftest which currently needs to do an #ifdef NOLIBC to handle the lack of strerror(). Keep it simple and reuse the output format of perror() for strerror(). Acked-by: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
This commit is contained in:
@@ -376,6 +376,16 @@ int setvbuf(FILE *stream __attribute__((unused)),
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __attribute__((unused))
|
||||
const char *strerror(int errno)
|
||||
{
|
||||
static char buf[18] = "errno=";
|
||||
|
||||
i64toa_r(errno, &buf[6]);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
/* make sure to include all global symbols */
|
||||
#include "nolibc.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user