[PATCH 1/6] Add INLINE_SYSCALL_ERROR_RETURN_VALUE

H.J. Lu hjl.tools@gmail.com
Tue Oct 13 15:56:00 GMT 2015


On Tue, Oct 13, 2015 at 6:52 AM, Florian Weimer <fweimer@redhat.com> wrote:
> On 10/13/2015 03:43 PM, Andreas Schwab wrote:
>> "H.J. Lu" <hjl.tools@gmail.com> writes:
>>
>>> On Tue, Oct 13, 2015 at 5:38 AM, Florian Weimer <fweimer@redhat.com> wrote:
>>>> On 10/13/2015 01:19 AM, H.J. Lu wrote:
>>>>> +/* Set error number and return -1.  A target may choose to return the
>>>>> +   internal function, __syscall_error, which sets errno and returns -1.  */
>>>>> +#define INLINE_SYSCALL_ERROR_RETURN(err) \
>>>>> +  ({                                         \
>>>>> +    __set_errno (err);                               \
>>>>> +    -1;                                              \
>>>>> +  })
>>>>
>>>> I think the name is unfortunate because it the macro does not contain a
>>>> return statement.
>>>>
>>>> Perhaps INLINE_SYSCALL_SET_ERRNO would be a better name?
>>>>
>>>> Florian
>>>
>>> i386 defines it as
>>>
>>> /* Set error number and return -1.  Return the internal function,
>>>    __syscall_error, which sets errno from the negative error number
>>>    and returns -1, to avoid PIC.  */
>>> #undef INLINE_SYSCALL_ERROR_RETURN
>>> #define INLINE_SYSCALL_ERROR_RETURN(resultvar) \
>>>   __syscall_error (-(resultvar))
>>>
>>> This macro should only be used with "return".
>>> INLINE_SYSCALL_SET_ERRNO may be misleading.
>>> How about INLINE_SYSCALL_SET_ERRNO_AND_RETURN?
>>
>> INLINE_SYSCALL_ERROR_RETURN_VALUE
>
> This name is fine with me.
>

Here is the updated patch.  There is no change in libc.so on
x86-64.  OK for master?

Thanks.


-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-INLINE_SYSCALL_ERROR_RETURN_VALUE.patch
Type: text/x-patch
Size: 23545 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20151013/65590daa/attachment.bin>


More information about the Libc-alpha mailing list