Insufficient feature-test for fdatasync
Submitted by Daniel Macks
Assigned to Shared Mime Info group
Description
On OS X 10.8...
checking for fdatasync... yes
update-mime-database.c:960:6: warning: implicit declaration of function 'fdatasync' is invalid in C99 [-Wimplicit-function-declaration] if (fdatasync(fd) == -1)
And then linking succeeds with no unresolved symbols. Our libSystem (analogous to linux glibc), that function exists, but it's not declared in any standard header and has no manpage. And the feature does not appear to be implemented: unistd.h defines _POSIX_SYNCHRONIZED_IO as -1, whereas 0 would mean supported. Google says that other OS X recent versions have the same situation (undeclared but present but unsupported) as well. My kernel sys/proto.h does have a declaration of fdatasync, but its prototype might indicate what libSystem does have isn't even what shared-mime-info wants (or at least would need an alternative parameter list):
int fdatasync(struct proc *, struct fdatasync_args *, int *);
3 arguments! Until someone figures out what this function is and how/if it should be used (if it even works), probably better to have autoconf do a more thorough test than just AC_CHECK_FUNCS. Look for it being declared? Look for _POSIX_SYNCHRONIZED_IO being 0 (if it's defined)?