mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fix compile-time check for copy_file_range(2)
* close fds properly * define USE_COPY_FILE_RANGE if HAVE_COPY_FILE_RANGE is defined * avoid errors on cross-compiling environments
This commit is contained in:
parent
012785ef35
commit
0ac185be40
1 changed files with 6 additions and 3 deletions
|
|
@ -2418,6 +2418,8 @@ main()
|
||||||
fd_in = open("/tmp", O_TMPFILE|O_RDWR, S_IRUSR);
|
fd_in = open("/tmp", O_TMPFILE|O_RDWR, S_IRUSR);
|
||||||
fd_out = open("/tmp", O_TMPFILE|O_WRONLY, S_IWUSR);
|
fd_out = open("/tmp", O_TMPFILE|O_WRONLY, S_IWUSR);
|
||||||
ret = syscall(__NR_copy_file_range, fd_in, NULL, fd_out, NULL, 0, 0);
|
ret = syscall(__NR_copy_file_range, fd_in, NULL, fd_out, NULL, 0, 0);
|
||||||
|
close(fd_in);
|
||||||
|
close(fd_out);
|
||||||
if (ret == -1) { return 1; }
|
if (ret == -1) { return 1; }
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
|
|
@ -2426,10 +2428,11 @@ main()
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[rb_cv_use_copy_file_range=yes],
|
[rb_cv_use_copy_file_range=yes],
|
||||||
|
[rb_cv_use_copy_file_range=no],
|
||||||
[rb_cv_use_copy_file_range=no])])
|
[rb_cv_use_copy_file_range=no])])
|
||||||
AS_IF([test "$rb_cv_use_copy_file_range" = yes], [
|
|
||||||
AC_DEFINE(USE_COPY_FILE_RANGE)
|
|
||||||
])
|
])
|
||||||
|
AS_CASE(["$ac_cv_func_copy_file_range:$rb_cv_use_copy_file_range"], [*yes*], [
|
||||||
|
AC_DEFINE(USE_COPY_FILE_RANGE)
|
||||||
])
|
])
|
||||||
|
|
||||||
AS_CASE(["$ac_cv_func_gettimeofday:$ac_cv_func_clock_gettime"],
|
AS_CASE(["$ac_cv_func_gettimeofday:$ac_cv_func_clock_gettime"],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue