From e8a7b9699925f3f650593d07eb382155e9374ae6 Mon Sep 17 00:00:00 2001 From: rsc Date: Mon, 27 Dec 2004 17:01:23 +0000 Subject: more features --- src/libmach/pthread.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/libmach/pthread.c (limited to 'src/libmach/pthread.c') diff --git a/src/libmach/pthread.c b/src/libmach/pthread.c new file mode 100644 index 00000000..46eca4f2 --- /dev/null +++ b/src/libmach/pthread.c @@ -0,0 +1,49 @@ +#include +#include +#include +#include +#include /* psaddr_t */ +#include +#include + +static char *tderrstr[] = +{ +[TD_OK] "no error", +[TD_ERR] "some error", +[TD_NOTHR] "no matching thread found", +[TD_NOSV] "no matching synchronization handle found", +[TD_NOLWP] "no matching light-weight process found", +[TD_BADPH] "invalid process handle", +[TD_BADTH] "invalid thread handle", +[TD_BADSH] "invalid synchronization handle", +[TD_BADTA] "invalid thread agent", +[TD_BADKEY] "invalid key", +[TD_NOMSG] "no event available", +[TD_NOFPREGS] "no floating-point register content available", +[TD_NOLIBTHREAD] "application not linked with thread library", +[TD_NOEVENT] "requested event is not supported", +[TD_NOEVENT] "requested event is not supported", +[TD_NOCAPAB] "capability not available", +[TD_DBERR] "internal debug library error", +[TD_NOAPLIC] "operation is not applicable", +[TD_NOTSD] "no thread-specific data available", +[TD_MALLOC] "out of memory", +[TD_PARTIALREG] "not entire register set was read or written", +[TD_NOXREGS] "X register set not available for given threads", +[TD_TLSDEFER] "thread has not yet allocated TLS for given module", +[TD_VERSION] "version mismatch twixt libpthread and libthread_db", +[TD_NOTLS] "there is no TLS segment in the given module", +}; + +static char* +terr(int e) +{ + static char buf[50]; + + if(e < 0 || e >= nelem(tderrstr) || tderrstr[e] == nil){ + snprint(buf, sizeof buf, "thread err %d", e); + return buf; + } + return tderrstr[e]; +} + -- cgit v1.2.3