Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt aio to the world of async/await, and fix some potential unsound… #1440

Merged
merged 1 commit into from
May 31, 2021

Conversation

asomers
Copy link
Member

@asomers asomers commented May 30, 2021

…ness.

  • libc::aiocb must not be moved while the kernel has a pointer to it.
    This change enforces that requirement by using std::pin.

  • Split LioCbBuilder out of LioCb. struct LioCb relied on the
    (incorrect) assumption that a Vec's elements have a stable location in
    memory. That's not true; they can be moved during Vec::push. The
    solution is to use a Vec in the new Builder struct, but finalize it to
    a boxed slice (which doesn't support push) before allowing it to be
    submitted to the kernel.

  • Eliminate owned buffer types. mio-aio no longer uses owned buffers
    with nix::aio. There's little need for it in the world of
    async/await. I'm not aware of any other consumers. This
    substantially simplifies the code.

@asomers asomers force-pushed the aio_pin branch 5 times, most recently from 271cf6c to 5281fc8 Compare May 30, 2021 23:15
…ness.

* libc::aiocb must not be moved while the kernel has a pointer to it.
  This change enforces that requirement by using std::pin.

* Split LioCbBuilder out of LioCb.  struct LioCb relied on the
  (incorrect) assumption that a Vec's elements have a stable location in
  memory.  That's not true; they can be moved during Vec::push.  The
  solution is to use a Vec in the new Builder struct, but finalize it to
  a boxed slice (which doesn't support push) before allowing it to be
  submitted to the kernel.

* Eliminate owned buffer types.  mio-aio no longer uses owned buffers
  with nix::aio.  There's little need for it in the world of
  async/await.  I'm not aware of any other consumers.  This
  substantially simplifies the code.
@asomers
Copy link
Member Author

asomers commented May 31, 2021

bors r+

@bors bors bot merged commit 892daf1 into nix-rust:master May 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant