On 01/13/2015 06:50 AM, Anoop Sharma wrote:
> Thanks Eric.

[please don't top-post on technical lists]

> 
> What if touch follows following steps:
> 1. Try same steps as in "touch -c" in an attempt to update timestamp of the
> file.
> 2. If this attempt fails due to errno indicating file was not present
> (ENOENT?), then it uses the same filefd (of step 1) and openat() to create
> the new file.

Because that costs more syscalls.  Step 1 involves an open(); if that
fails, then step 2 requires a second open, AND an additional futimens()
(three calls); the existing code only requires two calls.

> Why it bothers me? - Because "touch existing_file" and "touch -c
> existing_file" raise different file system events.

Sorry, but that's not a reason to change the implementation.  You'll
just have to adjust your code to check for different syscalls.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to