This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v3 2/2] posix: Implement preadv2 and pwritev2


On 06/03/2017 07:27 AM, H.J. Lu wrote:
> On Sat, Jun 3, 2017 at 4:23 AM, Florian Weimer <fweimer@redhat.com> wrote:
>> On 06/03/2017 01:04 PM, H.J. Lu wrote:
>>> On Sat, Jun 3, 2017 at 1:22 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
>>>> On Jun 02 2017, "H.J. Lu" <hjl.tools@gmail.com> wrote:
>>>>
>>>>> The x86-64 LO_HI_LONG can't be used for p{readv,writev}{64}v2.  Add a
>>>>> new macro, LO_HI_LONG_FLAGS, to pass the off{64}_t and flags arguments.
>>>>
>>>> Why can't LO_HI_LONG just pass the padding unconditionally on x86_64?
>>>>
>>>
>>> To avoid the unnecessary (long) (((uint64_t) (val)) >> 32).
>>
>> I think the question is why you can't define it like this:
>>
>>    (val), 0
>>
>> ?  Are you concerned about the additional overhead of passing that
>> unnecessary zero at the end of the parameter list for other system
>> calls?  Or would this result in an observable kernel interface
>> difference and break stuff?
> 
> My patch has
> 
> ndex 7b8bd79..a3fe2fa 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
> @@ -389,4 +389,9 @@
>  #undef LO_HI_LONG
>  #define LO_HI_LONG(val) (val)
> 
> +/* Provide a macro to pass the off{64}_t and flags arguments on
> +   p{readv,writev}{64}v2.  */
> +#undef LO_HI_LONG_FLAGS
> +#define LO_HI_LONG_FLAGS(val, flags) (val), 0, (flags)
> +
>  #endif /* linux/x86_64/sysdep.h */
> 
> For LO_HI_LONG, it doesn't mater what the second one is.  It makes
> no difference if -1 is passed.  Why bother with 0?

If nothing else, always passing the unused argument as 0 will reduce
confusion when people inspect these syscalls, e.g. through the debugger
interface or the seccomp filter interface.  I think that's a sufficient
reason to do it.  These are all I/O syscalls that can block, it's the
wrong place to be shaving cycles.

zw


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]