Skip to content

Instantly share code, notes, and snippets.

@izabera
Created August 21, 2018 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save izabera/7f9c639f6f03e94f2a77080a3c4ef7f8 to your computer and use it in GitHub Desktop.
Save izabera/7f9c639f6f03e94f2a77080a3c4ef7f8 to your computer and use it in GitHub Desktop.
musl-gcc -shared -fPIC sys_errlist.c -o libsys_errlist.so
#include <string.h>
const char *sys_errlist[132];
int sys_nerr = 132;
__attribute__((constructor)) static void f() {
for (int i = 0; i < sys_nerr; i++)
sys_errlist[i] = strdup(strerror(i));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment