Cannot include structs with bitfields in linux-api #3270
Labels
Component: Build
Build/install tools and dependencies
Type: Enhancement
New functionality or improved design
Milestone
If you try to add a Linux struct containing bitfields to linux-api, it will cause cbindgen to fail.
For example if you try to add
tcp_info
which contains:bindgen will generate rust bindings like:
The linux-api build script then generates C bindings for this rust code, which fails with:
So cbindgen can't create C bindings for this structure. We also cannot exclude this structure from cbindgen using the "exclude" option since it appears that this mangling occurs before types are excluded: https://github.com/mozilla/cbindgen/blob/6bfc2176187a6fc6fba6315323b0296112330294/src/bindgen/library.rs#L69-L72.
I'm not sure what the best option is. We could either wait until we no longer need to build C bindings for linux-api, but this would require moving more of the shim to rust. We could also split the rust bindings into two files, and only generate C bindings for one of the files, so this could be messy. We could also just manually write rust bindings for
tcp_info
if this is the only struct containing bitfields that we need to deal with.The text was updated successfully, but these errors were encountered: