There are many places in libdtrace where errno can be set. When an

error is returned all the way back to the dtrace app, it's hard to
figure out where that error came from.

Add a couple of functions to get and set the error location which can
be optionally compiled into the library.
This commit is contained in:
John Birrell 2008-04-26 04:43:19 +00:00
parent 79673c5671
commit 768c574fc0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=178561

View File

@ -25,6 +25,7 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <string.h>
#include <strings.h>
#include <dt_impl.h>
@ -138,12 +139,29 @@ dtrace_errno(dtrace_hdl_t *dtp)
return (dtp->dt_errno);
}
#if defined(sun)
int
dt_set_errno(dtrace_hdl_t *dtp, int err)
{
dtp->dt_errno = err;
return (-1);
}
#else
int
_dt_set_errno(dtrace_hdl_t *dtp, int err, const char *errfile, int errline)
{
dtp->dt_errno = err;
dtp->dt_errfile = errfile;
dtp->dt_errline = errline;
return (-1);
}
void dt_get_errloc(dtrace_hdl_t *dtp, const char **p_errfile, int *p_errline)
{
*p_errfile = dtp->dt_errfile;
*p_errline = dtp->dt_errline;
}
#endif
void
dt_set_errmsg(dtrace_hdl_t *dtp, const char *errtag, const char *region,