From owner-p4-projects@FreeBSD.ORG Mon Jun 26 05:10:47 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 8850016A402; Mon, 26 Jun 2006 05:10:47 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 489E216A400 for ; Mon, 26 Jun 2006 05:10:47 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id ED18B43D68 for ; Mon, 26 Jun 2006 05:10:46 +0000 (GMT) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k5Q5AkhW018571 for ; Mon, 26 Jun 2006 05:10:46 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k5Q5Akmr018568 for perforce@freebsd.org; Mon, 26 Jun 2006 05:10:46 GMT (envelope-from jb@freebsd.org) Date: Mon, 26 Jun 2006 05:10:46 GMT Message-Id: <200606260510.k5Q5Akmr018568@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jb@freebsd.org using -f From: John Birrell To: Perforce Change Reviews Cc: Subject: PERFORCE change 100017 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jun 2006 05:10:47 -0000 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);