bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] fdutimensat: add an atflag parameter


From: Eric Blake
Subject: Re: [PATCH] fdutimensat: add an atflag parameter
Date: Fri, 17 Sep 2010 13:40:02 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100907 Fedora/3.1.3-1.fc13 Mnenhy/0.8.3 Thunderbird/3.1.3

On 09/17/2010 12:14 PM, Paul Eggert wrote:
Thanks for adding that functionality to gnulib.  I prepared a patch
to have GNU tar use it, but found one more problem.  fdutimensat
uses this signature:

fdutimensat (int dir, char const *file, int fd, [ other args ] )

whereas the similar function in GNU tar uses the following
order instead.

fdutimensat (int fd, int dir, char const *file, [ other args ] )

The GNU tar convention is clearer, since it reflects the
semantics better: try FD first, and use that if it works;
otherwise fall back on DIR+FILE.  Could we please switch to
this order, while we're changing the API anyway?

Hmm; I'm reluctant to make the change. Look at the history of utimensat.h: originally, we declared futimens (fd, name, times), but that conflicted with the POSIX naming, so it was renamed gl_futimens (fd, name, times). But when it came time to extend it to the *at calling conventions, all of our macros for quickly implementing openat on top of open, mkdirat on top of mkdir, and so forth, all expected that the wrapped function have name be first. So I added fdutimens (name, fd, times), at which point I rewrote gl_futimens to be a thin wrapper around fdutimens that swapped arguments, and added utimensat using the *at implementation that had fdutimens with name first.

Now you're proposing making fdutimensat have the opposite signature from fdutimens (fd before name, instead of after), not to mention inconsistent with all the other *at functions (fd before dir, instead of dir first). I'm leaning towards keeping the signature we have, and change fchmodat and friends to have the same style as the current fdutimensat (dir first, because it is a *at function, then name/fd in that order, because that is the order in which it is easiest to wrap a non-at function to turn it in an at function).

--
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]