check if fdatasync is available and return ENOSYS if not

This commit is contained in:
Antonio SJ Musumeci 2016-10-22 23:14:50 -04:00
parent f954be60a4
commit 6d6fb45a3b

View File

@ -16,6 +16,7 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <errno.h>
#include <unistd.h>
namespace fs
@ -33,6 +34,10 @@ namespace fs
int
fdatasync(const int fd)
{
#if _POSIX_SYNCHRONIZED_IO > 0
return ::fdatasync(fd);
#else
return (errno=ENOSYS,-1);
#endif
}
}