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:
parent
79673c5671
commit
768c574fc0
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user