This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 4/4] posix: Implement preadv2 and pwritev2
On 28/04/2017 11:14, Zack Weinberg wrote:
> On Thu, Apr 27, 2017 at 5:30 PM, Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
>>
>> On default 'posix' implementation trying to emulate the Linux supported
>> flags is troublesome:
>>
>> * We can not temporary change the file state of the O_DSYNC and O_SYNC
>> flags to emulate RWF_{D}SYNC (attempts to change the state of using
>> fcntl are silently ignored).
>>
>> * IOCB_HIPRI requires the file opened in O_DIRECT and uses an internal
>> semantic not provided by any other flag (O_NONBLOCK for instance).
>>
>> So default implementation just ignore the flag argument and calls generic
>> preadv/pwritev.
>
> Wouldn't it be better for the default implementation to fail if the
> flags argument is nonzero? Especially for sync operations - if it
> fails, applications can fall back to fsync or whatever, but if it
> succeeds without actually performing a sync, that's asking for data
> loss.
>
> zw
I think it is a reasonable change, although I think it will make preadv2
fallback fails in all the usable scenarios. However it is might be a
hint to programmer that libc does not actually supports it. Would be
better to just return ENOSYS then?