On Tue, Nov 9, 2021 at 1:11 AM Richard Henderson <
richard.hender...@linaro.org> wrote:

> On 11/8/21 7:49 PM, Warner Losh wrote:
> >      >       /* code path for having successfully executed the syscall */
> >      > +     ADJUST_SYSCALL_RETCODE
> >      >       ret
> >      >
> >      >   0:
> >
> >     Not sure about this, really.  Is it really that much cleaner to
> insert this than create
> >     separate 10-line files, with the adjustment included?
> ...
> > The adjustments have all been 3 lines (gmail seems to hate my
> formatting):
> >
> > +#define        ADJUST_SYSCALL_RETCODE \
> > +    jnb 2f;                    \
> > +    neg %rax;                  \
> > +    2:
> >
> > which is significantly easier to maintain than having to monitor these
> files for changes
> > and copying over the changes that happen.
> ...
> > The other alternative I considered was having a #ifdef __FreeBSD__ ..
> #endif in all those
> > files, but I thought that even more intrusive.
>
> Actually, the ifdef sounds surprisingly attractive to me.  Is it ENOCOFFEE?
>
> What I find awkward about ADJUST_SYSCALL_RETCODE is that when you're
> looking at the
> definition, you have no reference to the context, and vice versa.  Not
> that it can't be
> worked out, but it seems like the same amount of code either way, and
> clearer when it's
> together.
>
> We've already split the host cpu apart, which is the major point of
> ifdeffery, so it
> doesn't seem like we'll wind up with a large amount of ifdefs here; we're
> not likely to
> see mynewos-user wanting to share this code any time soon.
>
> I feel sufficiently fuzzy on this to solicit other opinions though.
>

I'm OK with #ifdef. The macro hides the ifdef in a general way... but
there's
always a problem generalizing from one example...

If nobody has a better idea, I'll respin with the #ifdefs in a day or two.
That would also
give good sharing and be a couple of steps down the road towards getting a
series of
signals patches queued up...

Warner

Reply via email to