[DTrace-devel] [PATCH] Improve BPF-map-create error message for E2BIG

eugene.loh at oracle.com eugene.loh at oracle.com
Mon Aug 8 23:02:36 UTC 2022


From: Eugene Loh <eugene.loh at oracle.com>

When syscall bpf(BPF_MAP_CREATE) fails due to too big a map, an E2BIG
is returned.  Meanwhile, strerror(E2BIG) is "Argument list too long",
which is not very helpful.  Simply say, "Too big".

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
 libdtrace/dt_bpf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libdtrace/dt_bpf.c b/libdtrace/dt_bpf.c
index de6735ae..7209e920 100644
--- a/libdtrace/dt_bpf.c
+++ b/libdtrace/dt_bpf.c
@@ -143,6 +143,8 @@ create_gmap(dtrace_hdl_t *dtp, const char *name, enum bpf_map_type type,
 
 		snprintf(msg, sizeof(msg),
 			 "failed to create BPF map '%s'", name);
+		if (errno == E2BIG)
+			return dt_bpf_error(dtp, "%s: Too big\n", msg);
 		if (errno == EPERM)
 			return dt_bpf_lockmem_error(dtp, msg);
 		return dt_bpf_error(dtp, "%s: %s\n", msg, strerror(errno));
-- 
2.18.4




More information about the DTrace-devel mailing list