[DTrace-devel] [PATCH 6/7] Use symbol name for 'not supported' error codes

Kris Van Hees kris.van.hees at oracle.com
Tue Dec 6 21:50:35 UTC 2022


The kernel uprobes implementation uses ENOTSUPP to indicate that a
uprobe could not be enabled, but this error code is not listed with
a symbolic name in userspace header files.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
 include/port.h       | 4 ++++
 libdtrace/dt_error.c | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/port.h b/include/port.h
index 50f81871..64983ac0 100644
--- a/include/port.h
+++ b/include/port.h
@@ -90,4 +90,8 @@ int close_range(unsigned int first, unsigned int last, unsigned int flags);
 #define R_BPF_64_32		10
 #endif
 
+#ifndef ENOTSUPP
+# define ENOTSUPP		524	/* Operation is not supported */
+#endif
+
 #endif
diff --git a/libdtrace/dt_error.c b/libdtrace/dt_error.c
index 576b1199..383e0cde 100644
--- a/libdtrace/dt_error.c
+++ b/libdtrace/dt_error.c
@@ -7,6 +7,7 @@
 
 #include <string.h>
 #include <dt_impl.h>
+#include <port.h>
 
 static const struct {
 	int err;
@@ -119,7 +120,7 @@ dtrace_errmsg(dtrace_hdl_t *dtp, int error)
 				return _dt_errlist[i].msg;
 		}
 		str = NULL;
-	} else if (error == 524) {	/* ENOTSUPP */
+	} else if (error == ENOTSUPP) {
 		/*
 		 * This is an error code that is supposedly specific to NFSv3.
 		 * It is not expected to be known to userspace - except that
-- 
2.37.2




More information about the DTrace-devel mailing list