Jasper Siepkes
null+****@clear*****
Fri Jul 20 22:10:18 JST 2018
Jasper Siepkes 2018-07-20 22:10:18 +0900 (Fri, 20 Jul 2018) New Revision: 23280c1d66fee996ba43a8d7522e23d4932a2ced https://github.com/groonga/groonga/commit/23280c1d66fee996ba43a8d7522e23d4932a2ced Merged 7e63e74: Merge pull request #859 from siepkes/futimens-posix-compatibility Message: Use POSIX compatible futimens function When not available fallback to the (non POSIX compliant) futimes function which is available on some platforms (primarily Linux, some of the BSD's and macOS). Modified files: build/ac_macros/check_functions.m4 config.h.cmake lib/io.c Modified: build/ac_macros/check_functions.m4 (+2 -0) =================================================================== --- build/ac_macros/check_functions.m4 2018-07-20 16:13:25 +0900 (a0b424b31) +++ build/ac_macros/check_functions.m4 2018-07-20 22:10:18 +0900 (8c2081dbb) @@ -3,6 +3,8 @@ AC_CHECK_FUNCS(_gmtime64_s) AC_CHECK_FUNCS(_localtime64_s) AC_CHECK_FUNCS(_strtoui64) +AC_CHECK_FUNCS(futimens) +AC_CHECK_FUNCS(futimes) AC_CHECK_FUNCS(gmtime_r) AC_CHECK_FUNCS(localtime_r) AC_CHECK_FUNCS(mkstemp) Modified: config.h.cmake (+2 -0) =================================================================== --- config.h.cmake 2018-07-20 16:13:25 +0900 (5ee382357) +++ config.h.cmake 2018-07-20 22:10:18 +0900 (e899f3444) @@ -139,6 +139,8 @@ #cmakedefine HAVE_CLOCK #cmakedefine HAVE_CLOCK_GETTIME #cmakedefine HAVE_FPCLASSIFY +#cmakedefine HAVE_FUTIMENS +#cmakedefine HAVE_FUTIMES #cmakedefine HAVE_GMTIME_R #cmakedefine HAVE_LOCALTIME_R #cmakedefine HAVE_MKSTEMP Modified: lib/io.c (+14 -2) =================================================================== --- lib/io.c 2018-07-20 16:13:25 +0900 (b3171c2e9) +++ lib/io.c 2018-07-20 22:10:18 +0900 (40ea2fb25) @@ -49,6 +49,18 @@ # define GRN_IO_FILE_SIZE_V0 GRN_IO_FILE_SIZE_V1 #endif /* WIN32 */ +#ifndef WIN32 +# ifdef HAVE_FUTIMENS +# define grn_futimens(fd, times) futimens((fd), (times)) +# define grn_futimens_name "futimens" +# elif defined(HAVE_FUTIMES) /* HAVE_FUTIMENS */ +# define grn_futimens(fd, times) futimes((fd), (times)) +# define grn_futimens_name "futimes" +# else /* HAVE_FUTIMENS */ +# error Support for either the futimens() or futimens() function is required +# endif /* HAVE_FUTIMENS */ +#endif /* WIN32 */ + typedef struct _grn_io_fileinfo { #ifdef WIN32 HANDLE fh; @@ -2141,9 +2153,9 @@ grn_msync(grn_ctx *ctx, fileinfo *fi, void *start, size_t length) struct timeval times[2]; gettimeofday(&(times[0]), NULL); times[1] = times[0]; - r = futimes(fi->fd, times); + r = grn_futimens(fi->fd, times); if (r == -1) { - SERR("futimes failed: <%d>", fi->fd); + SERR("%s failed: <%d>", grn_futimens_name, fi->fd); } } -------------- next part -------------- HTML����������������������������... URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180720/a267592b/attachment-0001.htm