In linux, epoll, EPOLLHUP may happen even if no connection call is made. It
would confuse callers for what is actually happening.
Replaced is_connect_failed, and we detect if connection failed by using the
combination of is_err and is_interrupt, please see the example, tcp_client
HermitOS is a microkernel target aiming to provide a simple OS for
virtualized applications. It recently added support for the poll() and
eventfd() system calls, which means we can target it with our poll()
based backend.
Hermit does not have a traditional libc; instead it uses hermit-abi.
However rustix does not support using hermit-abi as its underlying
layer yet. So we have to build a shim layer until it does.
Closes#177
cc bytecodealliance/rustix#1012
Signed-off-by: John Nunley <dev@notgull.net>
CallOnDrop is no longer used in the Windows IOCP backend, and it wasn't
being flagged as unused until the latest nightly. In order to fix
Windows builds, this commit removes CallOnDrop.
Signed-off-by: John Nunley <dev@notgull.net>
Technically RedoxOS supports the poll syscall, so we already support
RedoxOS. However, this is very slow. This commit ports this code to
epoll, which should be more efficient.
Closes#176
If eventfd isn't initialized, `Polling::new` will fail with an EPERM
error. You need to call the "esp_vfs_eventfd_register" function to
initialize the eventfd subsystem in ESP-IDF. This commit indicates to
the user that this needs to happen.
Signed-off-by: John Nunley <dev@notgull.net>
Previously, if AFD failed to initialize `polling` would return a custom
I/O error with a string error, containing the formatted version of the
underlying system error. However, this means that information about the
underlying system error is lost to the user.
This commit makes it so the returned `io::Error` wraps a user
inaccessible type: `AfdError`. This `AfdError`, when stringified,
returns a similar error message as what was previously returned. In
addition when `.source()` is used it returns the underlying system
error.
Closes#174
Signed-off-by: John Nunley <dev@notgull.net>
This lint does not take into account destructors.
```
error: field `0` is never read
--> src\iocp\mod.rs:1155:13
|
1155 | Waiting(WaitHandle),
| ------- ^^^^^^^^^^
| |
| field in this variant
|
= note: `-D dead-code` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(dead_code)]`
help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field
|
1155 | Waiting(()),
| ~~
```
Previous, `Poller::wait` would bubble signal interruption error to the user.
However, this may be unexpected for simple use cases. Thus, this commit makes
it so, if `ErrorKind::Interrupted` is received by the underlying `wait()` call,
it clears the events and tries to wait again.
This also adds a test for this interruption written by @psychon.
Co-Authored-By: Uli Schlachter <psychon@users.noreply.github.com>
Signed-off-by: John Nunley <dev@notgull.net>
Once upon a time, this got a Vec as an argument, but that was replaced
with the Events struct. Thus, this should link to Events and not Vec.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Thus far, our kqueue implementation has been a relatively thin layer on
top of the OS kqueue. However, kqueue doesn't keep track of when the
same source is inserted twice, or when a source that doesn't exist is
removed. In the interest of keeping consistent behavior between backends
this commit adds a system for tracking when sources are inserted.
Closes#151
Signed-off-by: John Nunley <dev@notgull.net>
Added in 272bb11eaf for reasons that are
unclear to me. It serves no purpose aside from disabling the API of the
entire crate, so it's best to remove it.
Signed-off-by: John Nunley <dev@notgull.net>
This adds documentation to add() describing what happens when a source
is registered in multiple pollers. A test is also added to ensure this
behavior.
Signed-off-by: John Nunley <dev@notgull.net>
In some containers, eventfd is not available as it cannot be implemented
securely in some hosts. This commit adds a fallback notifier that uses
a pipe instead of eventfd.
Closes#122
Signed-off-by: John Nunley <dev@notgull.net>
* Add better documentation for the IOCP module
* Extract Events from Poller
This prevents the need to have an intermediate buffer to read events
from, reducing the need for an allocation and a copy. This is a breaking
change.
* Add event extra information
Foundation for more details later on.
* Add PRI and HUP events
* Fix various failing tests
- Make sure that waitable handles interact properly with the new
infrastructure
- Fix failing doctests
* Review comments
- Make set_* take a boolean for the value of the flag
- Make Events !Sync
- Fix visibility modifiers
- Inline more methods
- Use a better strategy for testing
* Move completion packets into the Events buffer
This removes one of the mutexes that we have to lock.
* Review comments
Signed-off-by: John Nunley <dev@notgull.net>
This means that we only depend on rustix, so all of the system calls
are direct. This should make mustang integration trivial.
Signed-off-by: John Nunley <dev@notgull.net>
* Add support for polling waitable handles
* Add a smoke test
* Fix failing tests
* Rebase on latest master
Signed-off-by: John Nunley <dev@notgull.net>
* Update semantics for new system
Signed-off-by: John Nunley <dev@notgull.net>
* Forgot about doctests
Signed-off-by: John Nunley <dev@notgull.net>
---------
Signed-off-by: John Nunley <dev@notgull.net>
* Support for the ESP-IDF framework
* Restore the spans to work with the raw notify fd
* On Linux eventfd needs PollFlags::IN
* Add cargo check for ESP IDF to the CI
---------
Co-authored-by: imarkov <imarkov@vmware.com>