move fd, fd2, pid fields before the bitfield flags while keeping
the pointer field last. this preserves the 24-byte struct size
(same as 3.4.0) while restoring fd to offset 0 (same as 3.3.0).
some external gems (e.g. mruby-polarssl) pass struct mrb_io
pointers directly to libraries like mbedtls that expect an int fd
at offset 0. the 3.4.0 reorder moved bitfield flags to offset 0,
causing these gems to read garbage instead of the file descriptor.
fixes#6713
Co-authored-by: Claude <noreply@anthropic.com>
rename all HAL functions from mrb_<feature>_hal_<name>() to
mrb_hal_<feature>_<name>() for better grouping and clarity. this makes all
HAL functions immediately identifiable with the mrb_hal_* prefix.
affected gems:
- mruby-task: mrb_task_hal_* -> mrb_hal_task_*
- mruby-io: mrb_io_hal_* -> mrb_hal_io_*
- mruby-socket: mrb_socket_hal_* -> mrb_hal_socket_*
- mruby-dir: mrb_dir_hal_* -> mrb_hal_dir_*
Co-authored-by: Claude <noreply@anthropic.com>
separates platform-specific code into hal-posix-io and hal-win-io gems,
making mruby-io platform-independent. HAL interface defined in
mrbgems/mruby-io/include/io_hal.h covers file operations, I/O operations,
and process operations. follows mruby-task dependency pattern where HAL
gems depend on feature gem. ws2_32 library linked in hal-win-io gem.
Co-authored-by: Claude <noreply@anthropic.com>
Change to `MRB_USE_IO_PREAD_PWRITE` for consistency with mruby configuration macros.
Similarly, `MRB_WITHOUT_IO_PREAD_PWRITE` is changed to `MRB_NO_IO_PREAD_PWRITE`.
The previous names are available for compatibility but are deprecated.
The original implementations used plain Ruby strings referenced from
instance variable (`@buf`) as buffers. We replaced those buffers by C
structure (`struct mrb_io_buf`) referenced directly from `fptr`.
The result is significant improvement of both performance and memory
consumption. Our simple benchmarks (reading `README.md` 10,000 times)
runs 5+ times faster, and `mrbtest` test suites consumes 85% less
memory.
Recent changes on `mruby-io` is preparation for this improvement.
In addition, update the documents referring `build_config.rb` which is
no longer used. The new `build_config.rb` describes the new configuration
structure in the comment.
The comment is for messages when `MRB_INT16` and `MRB_WITHOUT_FLOAT` are
specified at the same time.
The comment itself is no longer needed now that `MRB_INT16` is gone.
It is available by default in environments where `__unix__` is defined.
Other environments are enabled by defining `MRB_WITH_IO_PREAD_PWRITE`
(requires an implementation of `pread()` and `pwrite()` functions).
In any case, you can disable it by defining
`MRB_WITHOUT_IO_PREAD_PWRITE`.