[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dirfd prototype
From: |
Jim Meyering |
Subject: |
Re: dirfd prototype |
Date: |
Sun, 20 Dec 2009 16:15:29 +0100 |
Eric Blake wrote:
> According to Jim Meyering on 12/19/2009 5:46 PM:
>>> -extern int dirfd (DIR const *dir) _GL_ARG_NONNULL ((1));
>>> +extern int dirfd (DIR *dir) _GL_ARG_NONNULL ((1));
>>
>> Do you know of any dirfd implementation that actually modifies the
>> pointed-to buffer? I do not, and cannot imagine one that would.
>> I would prefer to leave it "const" and to consider lobbying POSIX
>> to permit the "const" declaration.
>
> I don't know of any existing implementation that modifies the DIR struct.
> However, POSIX is explicit that DIR need not have a backing fd when
> diropen() is first called; therefore, I can see the feasibility of an
> implementation that only opens the fd if dirfd() is called, and hence
> needs to modify the struct as part of dirfd. I'm afraid we would lose
> that battle to change POSIX.
>
> At any rate, the problem came because I got a compilation error due to the
> conflict in declarations between the system <dirent.h> and the gnulib
> replacement, when testing out my warn-on-use macro. Basically, any
> configure.ac that uses both the dirfd module and
> AC_CHECK_DECLS_ONCE([dirfd]) will encounter the declaration clash, if we
> revert that patch.
Ok then. Given that there is an actual motivation for the change,
then I won't make a fuss ;-)