93 { EDT_ERRABORT, "Abort due to error" },
94 { EDT_DROPABORT, "Abort due to drop" },
95 { EDT_DIRABORT, "Abort explicitly directed" },
96 { EDT_BADRVAL, "Invalid return value from callback" },
97 { EDT_BADNORMAL, "Invalid normalization" },
98 { EDT_BUFTOOSMALL, "Enabling exceeds size of buffer" },
99 { EDT_BADTRUNC, "Invalid truncation" },
100 { EDT_BUSY, "DTrace cannot be used when kernel debugger is active" },
101 { EDT_ACCESS, "DTrace requires additional privileges" },
102 { EDT_NOENT, "DTrace device not available on system" },
103 { EDT_BRICKED, "Abort due to systemic unresponsiveness" },
104 { EDT_HARDWIRE, "Failed to load language definitions" },
105 { EDT_ELFVERSION, "libelf is out-of-date with respect to libdtrace" },
106 { EDT_NOBUFFERED, "Attempt to buffer output without handler" },
107 { EDT_UNSTABLE, "Description matched an unstable set of probes" },
108 { EDT_BADSETOPT, "Invalid setopt() library action" },
109 { EDT_BADSTACKPC, "Invalid stack program counter size" },
110 { EDT_BADAGGVAR, "Invalid aggregation variable identifier" },
111 { EDT_OVERSION, "Client requested deprecated version of library" },
112 { EDT_ENABLING_ERR, "Failed to enable probe" },
113 { EDT_NOPROBES, "No probe sites found for declared provider" }
114 };
115
116 static const int _dt_nerr = sizeof (_dt_errlist) / sizeof (_dt_errlist[0]);
117
118 const char *
119 dtrace_errmsg(dtrace_hdl_t *dtp, int error)
120 {
121 const char *str;
122 int i;
123
124 if (error == EDT_COMPILER && dtp != NULL && dtp->dt_errmsg[0] != '\0')
125 str = dtp->dt_errmsg;
126 else if (error == EDT_CTF && dtp != NULL && dtp->dt_ctferr != 0)
127 str = ctf_errmsg(dtp->dt_ctferr);
128 else if (error >= EDT_BASE && (error - EDT_BASE) < _dt_nerr) {
129 for (i = 0; i < _dt_nerr; i++) {
130 if (_dt_errlist[i].err == error)
131 return (_dt_errlist[i].msg);
132 }
133 str = NULL;
|
93 { EDT_ERRABORT, "Abort due to error" },
94 { EDT_DROPABORT, "Abort due to drop" },
95 { EDT_DIRABORT, "Abort explicitly directed" },
96 { EDT_BADRVAL, "Invalid return value from callback" },
97 { EDT_BADNORMAL, "Invalid normalization" },
98 { EDT_BUFTOOSMALL, "Enabling exceeds size of buffer" },
99 { EDT_BADTRUNC, "Invalid truncation" },
100 { EDT_BUSY, "DTrace cannot be used when kernel debugger is active" },
101 { EDT_ACCESS, "DTrace requires additional privileges" },
102 { EDT_NOENT, "DTrace device not available on system" },
103 { EDT_BRICKED, "Abort due to systemic unresponsiveness" },
104 { EDT_HARDWIRE, "Failed to load language definitions" },
105 { EDT_ELFVERSION, "libelf is out-of-date with respect to libdtrace" },
106 { EDT_NOBUFFERED, "Attempt to buffer output without handler" },
107 { EDT_UNSTABLE, "Description matched an unstable set of probes" },
108 { EDT_BADSETOPT, "Invalid setopt() library action" },
109 { EDT_BADSTACKPC, "Invalid stack program counter size" },
110 { EDT_BADAGGVAR, "Invalid aggregation variable identifier" },
111 { EDT_OVERSION, "Client requested deprecated version of library" },
112 { EDT_ENABLING_ERR, "Failed to enable probe" },
113 { EDT_NOPROBES, "No probe sites found for declared provider" },
114 { EDT_CANTLOAD, "Failed to load module" },
115 };
116
117 static const int _dt_nerr = sizeof (_dt_errlist) / sizeof (_dt_errlist[0]);
118
119 const char *
120 dtrace_errmsg(dtrace_hdl_t *dtp, int error)
121 {
122 const char *str;
123 int i;
124
125 if (error == EDT_COMPILER && dtp != NULL && dtp->dt_errmsg[0] != '\0')
126 str = dtp->dt_errmsg;
127 else if (error == EDT_CTF && dtp != NULL && dtp->dt_ctferr != 0)
128 str = ctf_errmsg(dtp->dt_ctferr);
129 else if (error >= EDT_BASE && (error - EDT_BASE) < _dt_nerr) {
130 for (i = 0; i < _dt_nerr; i++) {
131 if (_dt_errlist[i].err == error)
132 return (_dt_errlist[i].msg);
133 }
134 str = NULL;
|