[DTrace-devel] [PATCH 4/4] rawfbt: selectively allow return() in clauses
Nick Alcock
nick.alcock at oracle.com
Wed Jul 16 11:08:26 UTC 2025
On 15 Jul 2025, Kris Van Hees uttered the following:
> On Tue, Jul 15, 2025 at 11:50:21AM +0100, Nick Alcock wrote:
>> On 15 Jul 2025, Kris Van Hees via DTrace-devel verbalised:
>> > +static int
>> > +fun_cmp(const allowed_fun_t *p, const allowed_fun_t *q) {
>> > + int rc;
>> > +
>> > + if (p->mod != NULL) {
>> > + if (q->mod == NULL)
>> > + return 1;
>> > + else {
>> > + rc = strcmp(p->mod, q->mod);
>> > + if (rc != 0)
>> > + return rc;
>> > + }
>> > + } else if (q->mod != NULL)
>> > + return -1;
>>
>> Ugh, that's quite tangled for how little it does :( can't think of a
>> nicer approach though.
>
> I am hoping that perhaps in time a lot more functions may allow this, plus if
> someone is going to make use of this feature for error injection they are
> likely to use it for multiple functions and then being able to use a hashtable
> rather than scanning the list multiple times is nicer.
It's not the hashtable I was whining about, just the comparison
function. The hashtable absolutely makes sense.
--
NULL && (void)
More information about the DTrace-devel
mailing list