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: Paul Eggert
Subject: Re: [PATCH] fdutimensat: add an atflag parameter
Date: Fri, 17 Sep 2010 13:17:44 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8

> On 09/17/2010 01:40 PM, Eric Blake wrote:

>> not to mention inconsistent with all the other *at functions

On the contrary, the current gnulib name "fdutimens" is inconsistent
with the usual POSIX naming conventions.  In POSIX, functions like
"fdopen" put the fd first.  "fdutimens" (and "fdutimensat") are the
only gnulib functions that violate the POSIX naming conventions in
that way, and this is what I'd like to fix.

Even if POSIX gave no guidance here, it is confusing for function's
name to begin with "fd", but have the fd somewhere later in the
argument list, when the semantics say that the fd is the most
important argument and the first thing that the function looks at.

I realize that there's a long history of confusion in the utimens
family.  This is mainly because I implemented the first versions of
these functions in gnulib, and helped write the POSIX draft for futimens and
utimensat, and the committee process altered the semantics and the
names, leaving a behind backwards-compatibility messes in gnulib.
(I.e. a lot of this is my fault. :-) However, we shouldn't let this
messy history screw up future interfaces like fdchownat etc.  We
shouldn't even let it mess up fdutimensat, as it is a new function
that isn't used much yet.

>> Now you're proposing making fdutimensat have the opposite signature from
>> fdutimens (fd before name, instead of after)

Yes.  fdutimens has the same problem as fdutimensat, and if one is
changed the other should be too.  That's OK, since fdutimens is merely
a gnulib function.

> That said, maybe the easiest thing to do would be adding:
> 
> gl_futimensat (fd, dir, file, times, flag)

Does this mean that we would have two sets of signatures in the
future?  Something like this?

  fdutimensat   (dir, file, fd, [ other args ] )
  gl_futimensat (fd, dir, file, [ other args ] )
  fdchownat     (dir, file, fd, [ other args ] )
  gl_fchownat   (fd, dir, file, [ other args ] )
  fdchmodat     (dir, file, fd, [ other args ] )
  gl_fchmodat   (fd, dir, file, [ other args ] )
  ...

That sounds like more work than it's worth.  Let's just pick one set
of names and go with them.  Nobody else is using these names, so we
can choose the names we like.  I prefer the names without the "gl_"
prefixes but could be talked into the "gl_", I suppose.  The more
important thing from my point of view is to put the fd first.




reply via email to

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