Date: Mon, 26 Jun 2006 05:10:46 GMT From: John Birrell <jb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 100017 for review Message-ID: <200606260510.k5Q5Akmr018568@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=100017 Change 100017 by jb@jb_freebsd2 on 2006/06/26 05:10:14 Save the file name and line number where an errno value is saved for later reporting. Getting a good ol' Unix error message like "no such file" is not terribly helpful when the application is actually doing ioctls on a device. Grrr. Affected files ... .. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_error.c#3 edit .. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_impl.h#9 edit Differences ... ==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_error.c#3 (text) ==== @@ -139,12 +139,29 @@ 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, 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, 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, ==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_impl.h#9 (text) ==== @@ -270,6 +270,10 @@ int dt_version; /* library version requested by client */ int dt_ctferr; /* error resulting from last CTF failure */ int dt_errno; /* error resulting from last failed operation */ +#if !defined(sun) + char *dt_errfile; + int dt_errline; +#endif int dt_fd; /* file descriptor for dtrace pseudo-device */ int dt_ftfd; /* file descriptor for fasttrap pseudo-device */ int dt_fterr; /* saved errno from failed open of dt_ftfd */ @@ -546,7 +550,13 @@ extern char *dt_cpp_add_arg(dtrace_hdl_t *, const char *); extern char *dt_cpp_pop_arg(dtrace_hdl_t *); +#if defined(sun) extern int dt_set_errno(dtrace_hdl_t *, int); +#else +int _dt_set_errno(dtrace_hdl_t *, int, char *, int); +void dt_get_errloc(dtrace_hdl_t *, char **, int *); +#define dt_set_errno(_a,_b) _dt_set_errno(_a,_b,__FILE__,__LINE__) +#endif extern void dt_set_errmsg(dtrace_hdl_t *, const char *, const char *, const char *, int, const char *, va_list);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606260510.k5Q5Akmr018568>