summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread/thr_exit.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libthr/thread/thr_exit.c')
-rw-r--r--lib/libthr/thread/thr_exit.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/lib/libthr/thread/thr_exit.c b/lib/libthr/thread/thr_exit.c
index e76623c..6feb909 100644
--- a/lib/libthr/thread/thr_exit.c
+++ b/lib/libthr/thread/thr_exit.c
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
#ifdef _PTHREAD_FORCED_UNWIND
#include <dlfcn.h>
#endif
+#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
@@ -172,18 +173,31 @@ thread_unwind(void)
#endif
void
-_thread_exit(const char *fname, int lineno, const char *msg)
+_thread_exitf(const char *fname, int lineno, const char *fmt, ...)
{
+ va_list ap;
/* Write an error message to the standard error file descriptor: */
- _thread_printf(2,
- "Fatal error '%s' at line %d in file %s (errno = %d)\n",
- msg, lineno, fname, errno);
+ _thread_printf(STDERR_FILENO, "Fatal error '");
+
+ va_start(ap, fmt);
+ _thread_vprintf(STDERR_FILENO, fmt, ap);
+ va_end(ap);
+
+ _thread_printf(STDERR_FILENO, "' at line %d in file %s (errno = %d)\n",
+ lineno, fname, errno);
abort();
}
void
+_thread_exit(const char *fname, int lineno, const char *msg)
+{
+
+ _thread_exitf(fname, lineno, "%s", msg);
+}
+
+void
_pthread_exit(void *status)
{
_pthread_exit_mask(status, NULL);
OpenPOWER on IntegriCloud