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

Handle file descriptors more transparently #61

Open
oskardrums opened this issue Feb 28, 2021 · 0 comments
Open

Handle file descriptors more transparently #61

oskardrums opened this issue Feb 28, 2021 · 0 comments
Labels
enhancement New feature or request userspace Related to using eBPF from userspace
Milestone

Comments

@oskardrums
Copy link
Owner

Currently it is the users responsibility to close(2) eBPF map and program file descriptors via ebpf_{maps,user}:close/1.
It would be safer and more convenient if these FDs were to close automatically when no longer needed.
There easiest solution would be to use Erlang NIF "resources" for maps/programs instead just passing an integer FD back to BEAM.
NIF resources can have a destructor-like callback that is called from the garbage collector when the resource is no longer in use, which is where we can close the FD.

Another path would be to drop the NIFs entirely and use an Erlang port driver to represent maps/programs. That would allow for closing the FDs when the owner Erlang process of the map/program dies.

@oskardrums oskardrums added this to the Version 0.3.0 milestone Feb 28, 2021
@oskardrums oskardrums added enhancement New feature or request userspace Related to using eBPF from userspace labels Feb 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request userspace Related to using eBPF from userspace
Projects
None yet
Development

No branches or pull requests

1 participant