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

Use BorrowedFd for requests/events instead of RawFd #592

Closed
ids1024 opened this issue Dec 20, 2022 · 3 comments
Closed

Use BorrowedFd for requests/events instead of RawFd #592

ids1024 opened this issue Dec 20, 2022 · 3 comments

Comments

@ids1024
Copy link
Member

ids1024 commented Dec 20, 2022

Currently events a client receives with an fd use OwnedFd, while events the client sends use RawFd. In server code it's the same but reversed.

As a result of this, functions like WlShm::create_pool violate IO safety rules since the function takes and operates on a RawFd, but the function is not marked unsafe.

This should instead use a BorrowedFd, but this is complicated from a lifetime perspective. I think wayland_client::Proxy's Request and wayland_server::Resource's Event would need to use GATs generic over a lifetime? This isn't possible as long as wayland-rs targets Rust < 1.65.0 though.

@elinorbgr
Copy link
Member

Yes, this lifetime constraint is the exact reason why I left the RawFd at this place.

@ids1024
Copy link
Member Author

ids1024 commented Dec 29, 2022

I guess this is something for 0.31.0, by which point wayland-rs's Rust MSRV will probably be new enough to use GATs.

ids1024 added a commit to ids1024/wayland-rs that referenced this issue Jul 13, 2023
Implementation of Smithay#592.

This is required for IO safety. Or perhaps `AsFd` generics would be
useful.

This will be a breaking API change, and require Rust 1.65.

Currently `wayland-client` compiles here, but server-side needs the same
changes, and things need to be cleaned up a bit.
ids1024 added a commit to ids1024/wayland-rs that referenced this issue Jul 13, 2023
Implementation of Smithay#592.

This is required for IO safety. Or perhaps `AsFd` generics would be
useful.

This will be a breaking API change, and require Rust 1.65.

Currently `wayland-client` compiles here, but server-side needs the same
changes, and things need to be cleaned up a bit.
ids1024 added a commit to ids1024/wayland-rs that referenced this issue Jul 13, 2023
Implementation of Smithay#592.

This is required for IO safety. Or perhaps `AsFd` generics would be
useful.

This will be a breaking API change, and require Rust 1.65.

Currently `wayland-client` compiles here, but server-side needs the same
changes, and things need to be cleaned up a bit.
ids1024 added a commit to ids1024/wayland-rs that referenced this issue Jul 14, 2023
Implementation of Smithay#592.

This is required for IO safety. Or perhaps `AsFd` generics would be
useful.

This will be a breaking API change, and require Rust 1.65.

Currently `wayland-client` compiles here, but server-side needs the same
changes, and things need to be cleaned up a bit.
ids1024 added a commit to ids1024/wayland-rs that referenced this issue Jul 14, 2023
Implementation of Smithay#592.

This is required for IO safety. Or perhaps `AsFd` generics would be
useful.

This will be a breaking API change, and require Rust 1.65.

Currently `wayland-client` compiles here, but server-side needs the same
changes, and things need to be cleaned up a bit.
ids1024 added a commit to ids1024/wayland-rs that referenced this issue Jul 14, 2023
Implementation of Smithay#592.

This is required for IO safety. Or perhaps `AsFd` generics would be
useful.

This will be a breaking API change, and require Rust 1.65.

Currently `wayland-client` compiles here, but server-side needs the same
changes, and things need to be cleaned up a bit.
ids1024 added a commit to ids1024/wayland-rs that referenced this issue Jul 26, 2023
Implementation of Smithay#592.

This is required for IO safety. Or perhaps `AsFd` generics would be
useful.

This will be a breaking API change, and require Rust 1.65.
ids1024 added a commit to ids1024/wayland-rs that referenced this issue Jul 26, 2023
Implementation of Smithay#592.

This is required for IO safety. Or perhaps `AsFd` generics would be
useful.

This will be a breaking API change, and require Rust 1.65.
ids1024 added a commit to ids1024/wayland-rs that referenced this issue Jul 26, 2023
Implementation of Smithay#592.

This is required for IO safety. Or perhaps `AsFd` generics would be
useful.

This will be a breaking API change, and require Rust 1.65.
ids1024 added a commit to ids1024/wayland-rs that referenced this issue Sep 1, 2023
Implementation of Smithay#592.

This is required for IO safety. Or perhaps `AsFd` generics would be
useful.

This will be a breaking API change, and require Rust 1.65.
elinorbgr pushed a commit that referenced this issue Sep 2, 2023
Implementation of #592.

This is required for IO safety. Or perhaps `AsFd` generics would be
useful.

This will be a breaking API change, and require Rust 1.65.
@elinorbgr
Copy link
Member

This is now done.

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

No branches or pull requests

2 participants