Page
Library
Module
Module type
Parameter
Class
Class type
Source
Breaking changes:
Net.getaddrinfo (@talex5 @haesbaert @avsm #866 #900). Before, Net.getaddrinfo returned [] on error. It now raises an exception with the actual error.New features:
Eio.Net.Sockopt for setting/getting socket options (@avsm @talex5 @anmonteiro #858 #575 #859 #874 #876 #889 #891). This includes all the options from OCaml's Unix module, plus many more (e.g. TCP_KEEPINTVL).TCP_KEEPIDLE socket option on macOS (@avsm @talex5 #890).Path.chmod (@patricoferris @webbunivAdmin @avsm @talex5 #785 #872).Path.chown (@patricoferris @avsm @talex5 #781 #864 #877).Path.with_dir_entries for incremental directory reading (@patricoferris @talex5 @avsm #821 #897). This also provides the type of each entry, saving one stat per entry in most cases.Eio_unix.Pty for pseudoterminal support (@avsm @talex5 @patricoferris @RyanGibb #531). The Pty module can be used to create and configure pseudoterminals, Eio_unix.Process.spawn_unix ?login_tty ... allows connecting them up when spawning a child process.missing_ok to Eio.Path.unlink (#828) (@vog @patricoferris #833).Flow.null sink/source (@avsm @talex5 #894, suggested by @jonsterling). This can be used as sink that consumes and discards all data written to it until end-of-file, and as a source that immediately returns end-of-file.Eio_unix.Process.spawn_unix ?uid ?gid ?pgid options (@patricoferris @talex5 #802 #803). Allows setting the user ID, group ID and process group of the child.Eio_unix.Stdenv.override for updating environments (@patricoferris @talex5 #823).Eio_unix.Err module (@talex5 #887). This is convenient whenever wrapping a function that raises Unix_error.Linux backend:
Eio_main.run will use eio_posix instead.Low_level.{socket,bind,listen} with uring support (@avsm @talex5 #884).ftruncate/fdatasync and use uring for fsync/shutdown (@avsm @talex5 #850).fstat to statx on linux and fetch blksize (@avsm @talex5 #865).Eio_linux.Low_level.Fixed (@talex5 #848). This replaces the Uring.Region API.IORING_SETUP_SINGLE_ISSUER (@talex5 #841). This hints to uring to do some locking optimisations assuming that each ring is only written by one thread.IORING_SETUP_DEFER_TASKRUN for performance (@talex5 #842).Bug fixes:
Eio.Path.load to handle files with zero size (@patricoferris @talex5 #869 #878, reported by @copy and @vog). This is useful for loading files in /proc/ on Linux.Eio.Process: match Unix search behaviour (@talex5 #820). Don't search $PATH if the name contains a /.select() for FDs where poll() fails (@avsm @talex5 #893, reported by @aaronjeline). macOS poll() returns POLLNVAL for some device FDs such as /dev/tty or /dev/null.fs were opened in non-blocking mode, but paths opened with cwd were not. This probably only affects FIFOs.MSG_CMSG_CLOEXEC when receiving file descriptors (@talex5 @avsm #843).read_upto and write_single didn't hold the FD open (@avsm #871). This could be a problem if another fiber closed the FD before the operation was submitted.io_uring_queue_init (@talex5 #852). We would already fall back to eio_posix if there wasn't enough lockable memory to add a fixed buffer, but didn't cope with not having enough memory for the ring itself.EINTR when writing to pipe (@avsm #870).unix_cstruct.ml file (@talex5 #817, reported by @dijkstracula). Caused an error if linking with -linkall.Minor changes:
errno back from fork_actions into Eio.Process (@Innf107 @avsm @talex5 #854). Report Unix fork_action failures as Eio exceptions instead of Failure. This allows matching on specific errors (e.g. Argument_list_too_long).Path.open_dir to open_subtree (@talex5 @avsm #853). This more accurately describes what it's for.Fiber.any value over cancelling quickly (@adamchol @talex5 #806). This works better with the new combine option.Eio.Process.Pipe (@Arogbonlo @patricoferris @talex5 #775, requested by @rizo).Eio.Pool.use: move never_block argument (@talex5 #747).Documentation:
Unix_error docstring (@avsm #888).without_binding (@patricoferris #822).Code cleanups:
Uring.Res module for safer error handling (@talex5 @avsm #868).net.ml, process.ml, fs.ml and time.ml (@talex5 #886). This more closely matches the layout in eio_posix.[@@@alert "-unstable"] (@talex5 #885). This was needed a long time ago to work around a bug in Merlin.CAMLextern (@avsm @dra27 #881). This is necessary under Windows to prevent flexdll errors.show_backend_exceptions flag (@talex5 #880).test_alloc_fixed_or_wait if no fixed buffers are available (@talex5 #815). Prevents spurious CI failures.eio_unix_fork_error call _exit automatically (@talex5 #896).Bug fixes:
spawn_unix wraps errors when calling openat (@dijkstracula #809).O_RESOLVE_BENEATH on FreeBSD (@talex5 #810, reported by @dijkstracula). FreeBSD needs -D__BSD_VISIBLE to be able to see this. Fixed the CI bug this revealed, which had started also affecting macos.ECONNRESET on close (@talex5 #787). FreeBSD returns ECONNRESET in certain (unclear) circumstances, but it does still close the FD successfully. If you care about this case, you should probably use shutdown instead and check for it there. Python and Ruby at least both explicitly check for and ignore this error too.On Windows, fix stdin broken-pipe and blocked domains (@bdodrem @talex5 #795).
eio_windows_cstruct_stubs.c by Unix functions added in OCaml 5.2, which correctly handle Window's strange use of EPIPE.Documentation:
Build fixes:
dune subst (@talex5 #789).Changes:
fork_action.h a public header (@patricoferris #769, reviewed by @talex5). Allows other libraries to add new actions.Bug fixes:
fork_daemon (@talex5 #779).Linux backend:
alloc_fixed_or_wait to be cancelled (@talex5 #753).Windows backend:
exception Unix.Unix_error(Unix.ENOTSOCK, "select", "").Unix.getaddrinfo (@talex5 #780). Fixes e.g. No addresses found for host name "127.0.0.1".ECONNABORTED with other connection reset errors (@talex5 #783).has_symlink for tests (@create2000 #771, reviewed by @patricoferris and @talex5).openat error handling (@talex5 #742, reported by @kentookura). Fixes exception Unix.Unix_error(Unix.ENOENT, "openat", "").Documentation:
Buf_read.seq documentation (@talex5 #739, requested by @darrenldl and @rizo).Build and test:
struct clone_args for linux-lts versions that don't have it (@copy #741, reviewed by @talex5).New features:
Eio.Path.symlink (@patricoferris #715, reviewed by @talex5).Eio.Pool.use ~never_block (@SGrondin #657, reviewed by @talex5).Eio_unix.Net.import_socket_listening (@alyssais #733).Eio.Time.Timeout.sleep (@talex5 #726).Documentation:
examples/fs showing how to walk a directory tree (@talex5 #730).read_all reads until shutdown (@talex5 #717, reported by @Wenke-D).Linux backend:
POSIX backend:
_BSD_SOURCE flag to fix build on OpenBSD (@prgbln #722).ELOOP when opening a symlink with O_NOFOLLOW.Build and test:
New features:
Eio_unix.Cap module to enable Capsicum mode (@talex5 #697, reviewed by @SGrondin).eio_linux: expose more functions in the Low_level module (@talex5 #705, reviewed by @SGrondin). Add all the functions used by other parts of eio_linux (openat, mkdir, read_link, unlink, rename and pipe). Tidied the API up a bit too:
mkdir_beneath is now just mkdir.statx_confined is now just statx.open_dir is gone; the single user now calls openat directly.Documentation:
Eio.Executor_pool (@SGrondin @talex5 #707, reviewed by @Sudha247).Build:
open_beneath test idempotent (@SGrondin #703).New features:
Switch.on_release thread-safe (@talex5 #684, requested by @art-w and @clecat). This allows resource pools to be shared between domains easily.Eio.Path.read_link (@talex5 #686).Eio_unix.Fd.is_open (@talex5 #690).Eio.Exn.empty_backtrace as a convenience.run_in_systhread, close, submit, traceln, cancellation and domain spawning).Documentation:
Bug fixes:
openat2 on EAGAIN (@talex5 #693, reviewed by @SGrondin).Build and tests:
Eio_unix.run_in_systhread (@talex5 #678, reviewed by @SGrondin).Eio_unix.Private too (@talex5 #689).New features / API changes:
Eio.Executor_pool (@SGrondin #639, reviewed by @talex5). Provides an easy way to distribute jobs across domains.Fiber.first ~combine and Fiber.n_any (@SGrondin @talex5 #587). Allows keeping both results in the case where multiple fibers succeed.Eio_mock.Backend.run_full with auto-advancing mock clock (@talex5 #644, reviewed by @SGrondin). Simplifies testing of code using clocks.Buf_write.printf (@SGrondin @talex5 #655).Net.listening_addr (@mefyl #555, reviewed by @patricoferris @talex5). Useful to get the socket's address if the OS assigns it.Promise.try_resolve (@talex5 #646).Cancel_hook_failed exception (@talex5 #640). Didn't seem to be used and broke dscheck.Tracing:
Fiber.all: use the parent fiber (@talex5 #665, reviewed by @SGrondin). Cleans up the traces a bit.Performance:
Lf_queue (@talex5 #647, based on work by @polytypic).Flow.copy with Buf_read.as_flow (@talex5 #663, reviewed by @SGrondin, reported by @leostera).Bug fixes:
caml_enter_blocking_section in more places (@talex5 #654, reviewed by @SGrondin).caml_unix_alloc_sockaddr bug (@talex5 #651).Switch.fail (@talex5 #664).Documentation:
Build / internals:
New features / API changes:
Flow.read_all (@SGrondin #596, reviewed by @talex5 @rbjorklin).Path.stat (@patricoferris @talex5 @avsm #617 #618 #624 #620, reviewed by @SGrondin).Path.rmtree (@talex5 #627 #628, reviewed by @SGrondin).Path.mkdirs and Path.split (@patricoferris @talex5 #625).Eio.File.{seek,sync,truncate} (@talex5 #626).Eio.Path.{kind,is_file,is_directory} (@patricoferris @talex5 #623, reviewed by @avsm).Documentation:
File.Stat record fields (@avsm @talex5 #621).env (@talex5 #614, reported by @jonsterling).Build and test changes:
File.stat benchmark (@talex5 #616).Path.stat benchmark (@patricoferris @talex5 #630).New features / API changes:
Replace objects with variants (@talex5 @patricoferris #553 #605 #608, reviewed by @avsm). Some potential users found object types confusing, so we now use an alternative scheme for OS resources. For users of the resources, the only thing that changes is the types:
#foo, you should now take _ foo.foo, you should now return foo_ty Eio.Resource.t.To provide your own implementation of an interface, you now provide a module rather than an object. For example, to provide your own source flow, use Eio.Flow.Pi.source (module My_source).
If you want to define your own interfaces, see the Eio.Resource module documentation.
Eio.Pool (@talex5 @darrenldl #602, reviewed by @patricoferris). A lock-free pool of resources. This is similar to Lwt_pool.Eio.Lazy (@talex5 #609, reviewed by @SGrondin). If one fiber tries to force a lazy value while another is already doing it, this will wait for the first one to finish rather than raising an exception (as Stdlib.Lazy does).Eio.Path.native (@talex5 #603, reviewed by @patricoferris). This is useful when interacting with non-Eio libraries, for spawning sub-processes, and for displaying paths to users.Flow.single_write (@talex5 #598).Eio.Flow.Pi.simple_copy (@talex5 #611). Provides an easy way to implement the copy operation when making your own sink.Process.run ?is_success to control definition of success (@SGrondin #586, reviewed by @talex5).Eio_mock.Domain_manager (@talex5 #610). This mock domain manager runs everything in a single domain, allowing tests to remain deterministic.Eio.Debug.with_trace_prefix (@talex5 #610). Allows prefixing all traceln output. The mock domain manager uses this to indicate which fake domain is running.Bug fixes:
Build/test fixes:
New features / API changes:
Extend Eio.Condition API (@talex5 #563).
loop_no_mutex is a simpler and more efficient way to way for a condition.register_immediate allows integration with other IO libraries.Eio.Stdenv.backend_id (@bord-o #560, reviewed by @talex5). Useful in tests to report which backend is being used.Remove deprecated features (@talex5 #552, reviewed by @avsm). These were all already marked as deprecated in v0.10 and are now gone completely:
Fiber.fork_subEio_unix.{FD,Ipaddr,socketpair,getnameinfo}Eio_linux.{FD,get_fd,get_fd_opt}Eio_posix.Low_level.Fdclose more than once (@talex5 #547, requested by @anmonteiro, reviewed by @patricoferris, @avsm).close to socket type (@talex5 #549). Simplifies the type signatures a bit by avoiding having to mention this everywhere.Bug fixes:
poll, which could result in constant wake-ups.pread at end-of-file (@talex5 #581, reported by @SGrondin). It tried to return 0 instead of End_of_file, triggering an assertion.Domain_manager.run (@talex5 #571). See https://github.com/ocaml/ocaml/issues/12362.eio_posix, not eio_windows in this case.Other changes:
build_if (@talex5 #582).Waiters from Eio_core (@talex5 #567). Eio.Switch no longer uses this so it can finally be removed.Fmt.Dump.signal to format signals (@talex5, @MisterDA #543).Documentation:
New features / API changes:
Eio.Process for cross-platform subprocess support (@patricoferris @talex5 #499, reviewed by @anmonteiro @avsm @haesbaert).Eio_unix.Net module (@talex5 #516, reviewed by @avsm). The Unix network APIs have been cleaned up and moved here, and some missing datagram operations have been added. send now takes an iovec, not just a single buffer.Eio_linux.FD and Eio_posix.Fd as Eio_unix.Fd (@talex5 #491). Now that eio_luv is gone, there is no need for different backends to have different types for wrapped file descriptors.Eio.Stdenv.t to Eio_unix.Stdenv.base (@talex5 #498). Note that the rest of Eio.Stdenv is still there; only the definition of a full Unix-like environment has moved.Bug fixes:
fork if clone3 is unavailable (@talex5 #524, reported by @smondet, reviewed by @avsm). Docker's default security policy blocks clone3.accept_fork's error handler on cancellation (@talex5 #520). This isn't an error and should not be reported.eio_unix_is_blocking C stub (@patricoferris #505, reviewed by @talex5).Condition.await bug when cancelling (@polytypic @talex5 #487).ENOTCONN errors on socket shutdown (@avsm #533, reported by @patricoferris, reviewed by @talex5).Documentation:
Ipaddr conversion (@RyanGibb @patricoferris @talex5 #492).Other changes:
Eio.Process.pp_status should be polymorphic (@talex5 #518).O_DSYNC. Also, add O_RESOLVE_BENEATH and O_PATH if available.New features:
openat), and can safely share OS resources between domains.Fiber.fork_seq (@talex5 #460, reviewed by @avsm). This is a light-weight alternative to using a single-producer, single-consumer, 0-capacity stream, similar to a Python generator function.Bug fixes:
EIO_BACKEND handling more uniform (@talex5 #447). Previously this environment variable was only used on Linux. Now all platforms check it.EIO_BACKEND (@talex5 #442). If this changes, dune needs to re-run the tests.read_exactly fails to update file offset (@talex5 #438).enabled_if bug on non-Linux systems (@polytypic #475, reviewed by @talex5).getrandom for glibc versions before 2.25 (@zenfey #482).Documentation:
HACKING.md with hints for working on Eio (@talex5 #443, reviewed by @avsm @polytypic).Performance:
/dev/zero (@talex5 #439).Other changes:
pread, pwrite and readdir (@talex5 #451).Some build fixes:
Fix build on various architectures (@talex5 #432).
%{system} bug.max_luv_buffer_size on 32-bit platforms.New features:
Eio.Net.run_server (@bikallem @talex5 #408). Runs an accept loop in one or more domains, with cancellation and graceful shutdown, and an optional maximum number of concurrent connections.Buf_read.BE and LE parsers (@Cjen1 #399). Parse numbers in various binary formats.Eio.Buf_read.uint8 (@talex5 #418).Performance:
Eio.Condition lock-free (@talex5 #397 #381). In addition to being faster, this allows using conditions in signal handlers.Eio.Semaphore lock-free (@talex5 @polytypic #398).Eio.Stream lock-free when the capacity is zero (@talex5 #413 #411).Eio.Promise lock-free (@talex5 #401).Bug fixes:
Uring.submit as needed (@talex5 @bikallem #428). Previously, we could fail to submit a job promptly because the SQE queue was full.libuv automatically retries polling if it gets EINTR, without giving OCaml signal handlers a chance to run.Buf_write.BE.uint48 and LE.uint48 (@adatario #418).Documentation:
run_server (@talex5 #417).Fiber.first (@talex5 #394).Eio.Time.now (@bikallem #395).secure_random as an infinite source (@patricoferris #426).Other changes:
SIGPIPE handler until the run function is called (@talex5 #420).process.md test (@smondet #414).Mtime.Spand.to_s has been deprecated in mtime 2.0.0 (@bikallem #385).API changes:
Eio.Io (@talex5 #378). This makes it easy to catch and log all IO errors if desired. The exception payload gives the type and can be used for matching specific errors. It also allows attaching extra information to exceptions, and various functions were updated to do this.Time.Mono for monotonic clocks (@bikallem @talex5 #338). Using the system clock for timeouts, etc can fail if the system time is changed during the wait.reuse_addr and reuse_port options.File.stat and improve Path.load (@haesbaert @talex5 #339). Path.load now uses the file size as the initial buffer size.Eio_unix.pipe (@patricoferris #350). This replaces Eio_linux.pipe.getrandom(2) (@haesbaert #344). Guards against buggy user code that might not handle this correctly.Flow.read to Flow.single_read (@talex5 #353). This is a low-level function and it is easy to use it incorrectly by ignoring the possibility of short reads.Bug fixes:
Socket_of_fd and Socketpair effects.Eio_mock.Backend: preserve backtraces from main (@talex5 #349).Switch.run_internal (@talex5 #369).Documentation:
Fiber.first (@talex5 #358, reported by @iitalics).Backend-specific changes:
Eio_luv.Low_level.Stream.write (@patricoferris #359).Eio_luv.Low_level.get_loop (@talex5 #371). This is needed if you want to create resources directly and then use them with Eio_luv.Eio_linux.Low_level.openfile is gone (@talex5 #378). It was just left-over test code.Changes:
Flow.write (@haesbaert #318). This provides an optimised alternative to copy in the case where you are writing from a buffer.Net.with_tcp_connect (@bikallem #302). Convenience function for opening a TCP connection.Eio.Time.Timeout (@talex5 #320). Makes it easier to pass timeouts around.Eio_mock.Clock (@talex5 #328). Control time in tests.Buf_read.take_while1 and skip_while1 (@bikallem #309). These fail if no characters match.Promise.t covariant (@anmonteiro #300).Flow.source_string (@c-cube #317). Slightly faster.Bug fixes:
Condition.broadcast must interlock as well (@haesbaert #324).Net.connect to be cancelled (@talex5 @nojb #311).Documentation:
New features:
Eio.Condition (@TheLortex @talex5 #277). Allows a fiber to wait for some condition to become true.Eio.Net.getaddrinfo and getnameinfo (@bikallem @talex5 #278 #288 #291). Convert between host names and addresses.Eio.Debug (@talex5 #276). Currently, this allows overriding the traceln function.Buf_write.create: make switch optional (@talex5 #283). This makes things easier for people porting code from Faraday.Bug fixes:
Other changes:
Mutex, Semaphore and Condition in the README (@talex5 #281).Note: Eio 0.4 drops compatibility with OCaml 4.12+domains. Use OCaml 5.0.0~alpha1 instead.
API changes:
Eio.Dir has gone. Use Eio.Path instead (@talex5 #266 #270).Eio_unix.FD.{take,peek} were renamed to take_opt/peek_opt to make way for non-optional versions.New features:
Eio.Path.{unlink,rmdir,rename} (@talex5 #264 #265).Eio_main.run can now return a value (@talex5 #263). This is useful for e.g. cmdliner.Eio_unix.socketpair (@talex5 #260).Fiber.fork_daemon (@talex5 #252). Create a helper fiber that does not prevent the switch from exiting.Fiber.{iter,map,filter,fiter_map} (@talex5 #248 #250). These are concurrent versions of the corresponding operations in List.Bug fixes:
Eio.Net.Connection_reset exception in more places (@talex5 #257).Buf_write still flushes if an exception is raised (@talex5 #246).accept_fork socket (@talex5 #245).Documentation:
API changes:
Net.accept_sub is deprecated in favour of accept_fork (@talex5 #240). Fiber.fork_on_accept, which it used internally, has been removed.Read_source_buffer (@talex5 #239). The reader is no longer required to consume all the data in one go. Also, add Linux_eio.Low_level.writev_single to expose this behaviour directly.Eio.Unix_perm is now Eio.Dir.Unix_perm.New features:
Eio.Mutex (@TheLortex @talex5 #223).Eio.Buf_write (@talex5 #235). This is a buffered writer for Eio sinks, based on Faraday.Eio_mock library for testing (@talex5 #228). At the moment it has mock flows and networks.Eio_mock.Backend (@talex5 #237 #238). Allows running tests without needing a dependency on eio_main. Also, as it is single-threaded, it can detect deadlocks in test code instead of just hanging.Buf_read.{of_buffer, of_string, parse_string{,_exn}, return} (@talex5 #225).<*> combinator to Buf_read.Syntax (@talex5 #227).Eio.Dir.read_dir (@patricoferris @talex5 #207 #218 #219)Performance:
Buf_read benchmark and optimise it a bit (@talex5 #230).Buf_read.consume to improve performance (@talex5 #232).Bug fixes / minor changes:
traceln without an effect handler (@talex5 #226). traceln now works outside of an event loop too.getrandom (@bikallem #212).Eio_linux: cope with lack of fixed chunks (@talex5 #200).
Eio_unix.FD.as_socket (@talex5 #193). Useful for working with existing libraries that provide a Unix.file_descr, or for receiving FDs from elsewhere (e.g. socket activation). Also, the Luv.{File,Handle}.of_luv functions now allow controlling whether to close the wrapped FD.Eio_unix.sleep (@talex5 #188). Based on feedback that some people don't want to treat time as a capability. Possibly also useful for debugging race conditions.Eio_null backend (@talex5 #189). This supports creating fibers, promises and cancellation, but provides no IO operations.Effect.eff is now Effect.t in OCaml trunk (@talex5 #201).