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

Kris Van Hees kris.van.hees at oracle.com
Wed Dec 7 03:17:22 UTC 2022


On Tue, Dec 06, 2022 at 05:24:07PM -0500, Eugene Loh via DTrace-devel wrote:
> Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
> 
> Extremely minor comments:
> 
> *)  The commit message could point out that more uses of ENOTSUPP will
> arise.

I think that would be a bit confusing becayse it is not that we are introducing
more uses per se but rather that we encounter the error code because we are
using one of the use cases where it can be returned from kernel code.

> *)  port.h has a block comment before each set of defines, so one before the
> new define might make sense.

True.

> *)  The #define indentation style (indenting the "define") is okay but a
> change of style for port.h.
> 
> On 12/6/22 16:50, Kris Van Hees via DTrace-devel wrote:
> > 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
> 
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel



More information about the DTrace-devel mailing list