This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 2/6] Optimize i386 syscall inlining
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: Zack Weinberg <zackw at panix dot com>, GNU C Library <libc-alpha at sourceware dot org>
- Date: Fri, 21 Aug 2015 07:01:52 -0700
- Subject: Re: [PATCH 2/6] Optimize i386 syscall inlining
- Authentication-results: sourceware.org; auth=none
- References: <20150812192001 dot GA12730 at intel dot com> <20150812221203 dot GA4224 at intel dot com> <CAKCAbMi1e9CniEZVRbgb7W=m0=zFrBes8=h+ev1e_Ofg8GnzCw at mail dot gmail dot com> <20150814120309 dot GB28610 at gmail dot com> <CAMe9rOqD+RRytcgn-Vbe95ULpNL=Nv1DCg1Td4rCuDVWn-gNXw at mail dot gmail dot com> <CAMe9rOoAPEVAAuZUex0xqF3KNw+++We6wxpD=qiDA0Ey261XTA at mail dot gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1508211225350 dot 2039 at digraph dot polyomino dot org dot uk> <CAMe9rOr_XZSCDcDrhpGkfWqy=p32APFyphg19qf=-3w1qEamXQ at mail dot gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1508211233040 dot 2039 at digraph dot polyomino dot org dot uk> <CAMe9rOrMuhzZX23r9prjNjQeEHue7P1hbYwe606+jZqV53An9A at mail dot gmail dot com>
On Fri, Aug 21, 2015 at 5:55 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Fri, Aug 21, 2015 at 5:35 AM, Joseph Myers <joseph@codesourcery.com> wrote:
>> You define INLINE_SYSCALL_ERROR_RETURN to ignore the specified return
>> value. There is nothing in the comments on the default version of that
>> macro in sysdeps/unix/sysdep.h to say that it is OK to ignore the return
>> value. If the return value must always be -1, I think the macro should
>> take one fewer argument rather than having specified semantics that the
>> last argument must always be -1, or that the macro may return -1 and
>> ignore the last argument.
>
> __syscall_error is for tail call from system call error and it has been used
> this way in glibc. It is OK to tail call __syscall_error and ignore the user
> provided return value for syscall error. I can add a comment to i386
> INLINE_SYSCALL_ERROR_RETURN.
>
Like this:
/* Set error number and return value. It should only be used with
function return. __syscall_error is for tail call from syscall error.
It is OK to tail call __syscall_error and ignore the user provided
return value for syscall error. */
#undef INLINE_SYSCALL_ERROR_RETURN
#define INLINE_SYSCALL_ERROR_RETURN(resultvar, type, value) \
({ \
_Static_assert ((type) -1 == (type) (value), \
"syscall error return is not -1"); \
return (type) __syscall_error (resultvar); \
(type) -1; \
})
--
H.J.