[DTrace-devel] [PATCH] bpf, perf: helper functions should return -errno on failure

Eugene Loh eugene.loh at oracle.com
Fri Dec 1 05:01:59 UTC 2023


On 11/30/23 22:06, Kris Van Hees wrote:

> On Thu, Nov 30, 2023 at 06:09:10PM -0500, Eugene Loh via DTrace-devel wrote:
>> As for bpf(), how about just renaming it to be dt_bpf().  That indicates
>> that it's something new.  I would think that would handle both what you're
>> trying to do with the patch as well as my concerns about changing something
>> that is familiar to very many people.
> I don't really see the concern given that this is a change that is entirely
> isolated to DTrace itself, in a function that is not exported outside of
> libdtrace.  So there shouldn't be users that are caught unaware.

Just in case someday there are Linux developers who are looking at 
working on DTrace.

> But I can rename them to be dt_bpf() and dt_perf_event_open() - makes no real
> difference to me.
>
>> BTW, if you're trying to get rid of callers looking at errno, there seem to
>> be other places where this change still needs to be made. I'm not sure,
>> though, since I don't at what point this patch will be applied.
> I am not trying to change all uses of errno - I am changing the way those two
> functions behave because they are functions we implement - they are not C lib
> system call functions.  So there is no need to make them behave as such.

Just in case we're talking about different things here, what I meant was 
sites where bpf() fed an error back up the call stack and some caller 
extracts the error code from errno rather than the value fed back up the 
call stack.

> Are we ok now for Reviewed-by?

The dt_bpf()/dt_perf_event_open() approach sounds fine by me.
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>



More information about the DTrace-devel mailing list