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

Possibly add other header-only functions #4

Closed
withoutboats opened this issue Nov 28, 2019 · 1 comment · Fixed by #7
Closed

Possibly add other header-only functions #4

withoutboats opened this issue Nov 28, 2019 · 1 comment · Fixed by #7

Comments

@withoutboats
Copy link
Collaborator

withoutboats commented Nov 28, 2019

liburing contains a number of header-only functions. Because they are header-only, they cannot be called from Rust.

One of these, io_uring_cq_advance in particular, contains atomic operations necessary to coordinate with the kernel. Since one of the goals of binding to liburing is to let the authors of liburing handle that sort of thing for us, we "re-export" that function through rusturing.c, hence exposing a rust_io_uring_cq_advance function. We don't do this for any other header-only functions.

Maybe we should do this re-export for all header only functions, so uring-sys will be more API-equivalent to liburing.

@withoutboats
Copy link
Collaborator Author

withoutboats commented Nov 29, 2019

In doing this I think it would also be good to rename them to match the liburing names. To do this the extern declaration would change to use the link_name attribute like so:

#[link(name = "rusturing")]
extern {
    #[link_name = "rust_io_uring_cq_advance"] // the name of the function in `rusturing.c`
    pub fn io_uring_cq_advance(ring: *mut io_uring, nr: libc::c_uint);

    // etc
}

niklasf pushed a commit to niklasf/uring-sys that referenced this issue Oct 10, 2022
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 a pull request may close this issue.

1 participant