4 #include "pthread_impl.h"
8 pthread_t self = __pthread_self();
9 if (!self->dlerror_flag) return 0;
10 self->dlerror_flag = 0;
11 char *s = self->dlerror_buf;
13 return "Dynamic linker failed to allocate memory for error message";
18 void __dl_thread_cleanup(void)
20 pthread_t self = __pthread_self();
21 if (self->dlerror_buf != (void *)-1)
22 free(self->dlerror_buf);
25 __attribute__((__visibility__("hidden")))
26 void __dl_vseterr(const char *fmt, va_list ap)
30 pthread_t self = __pthread_self();
31 if (self->dlerror_buf != (void *)-1)
32 free(self->dlerror_buf);
33 size_t len = vsnprintf(0, 0, fmt, ap2);
35 char *buf = malloc(len+1);
37 vsnprintf(buf, len+1, fmt, ap);
41 self->dlerror_buf = buf;
42 self->dlerror_flag = 1;
45 __attribute__((__visibility__("hidden")))
46 void __dl_seterr(const char *fmt, ...)
50 __dl_vseterr(fmt, ap);