qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC 4/4] common-user: Allow return codes to be adjusted after sytse


From: Richard Henderson
Subject: Re: [RFC 4/4] common-user: Allow return codes to be adjusted after sytsem call
Date: Tue, 9 Nov 2021 09:11:34 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

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.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]