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

Extending eio from the outside #725

Open
xeniarose opened this issue Apr 27, 2024 · 1 comment
Open

Extending eio from the outside #725

xeniarose opened this issue Apr 27, 2024 · 1 comment

Comments

@xeniarose
Copy link

i'm interested in implementing support for serial ports on eio, but after spending a lot of time trying to get this started and exploring the eio codebase it seems like the current state of eio makes this unreasonably difficult

for example:

  • given a path, it would be nice to be able to manually call openat on linux and posix platforms with the O_NOCTTY flag. however, at least with Eio_linux the platform doesn't make the Dir_fd resource handler public so there is basically no way to call Eio_linux.Low_level.openat from an arbitrary Path.t -- the only workaround i found was to convert the Path into its native string and then use that, but i don't really like that approach
  • assuming we are somehow able to manually call openat, obtain the fd, execute the setup ioctls, it would then be nice to be able to wrap this in a Flow, but there doesn't seem to be a way to do that either

what's the recommended approach here? would a hypothetical tty/serial subsystem be better served being part of eio directly? or could eio just expose a bit more of the platform-specific internals to outside libraries?

@talex5
Copy link
Collaborator

talex5 commented Apr 27, 2024

It's not very obvious, but you can use import_socket_stream to wrap an FD as a flow.

Exposing Eio_linux.get_dir_fd_opt seems reasonable to me. Possibly we should always pass O_NOCTTY when opening things (there's a Rust issue for this at rust-lang/rust#24307 but it got closed with no clear conclusion).

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