1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

io_buffer.c: use mremap based resizing only when mremap available

some libc implementations (e.g. wasi-libc) define MREMAP_MAYMOVE, but
don't have mremap itself, so guard the use of mremap by HAVE_MREMAP
This commit is contained in:
Yuta Saito 2022-01-07 00:07:14 +09:00 committed by Yusuke Endoh
parent 5ad507d751
commit ae51f304d2
Notes: git 2022-01-07 02:13:45 +09:00
2 changed files with 2 additions and 1 deletions

View file

@ -2032,6 +2032,7 @@ AC_CHECK_FUNCS(mkfifo)
AC_CHECK_FUNCS(mknod)
AC_CHECK_FUNCS(mktime)
AC_CHECK_FUNCS(mmap)
AC_CHECK_FUNCS(mremap)
AC_CHECK_FUNCS(openat)
AC_CHECK_FUNCS(pipe2)
AC_CHECK_FUNCS(poll)

View file

@ -1239,7 +1239,7 @@ rb_io_buffer_resize(VALUE self, size_t size)
rb_raise(rb_eIOBufferAccessError, "Cannot resize external buffer!");
}
#ifdef MREMAP_MAYMOVE
#if defined(HAVE_MREMAP) && defined(MREMAP_MAYMOVE)
if (data->flags & RB_IO_BUFFER_MAPPED) {
void *base = mremap(data->base, data->size, size, MREMAP_MAYMOVE);