-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
C-bugCategory: bugCategory: bug
Description
The epoll_event type is declared like this in C:
struct epoll_event {
uint32_t events; /* Epoll events */
epoll_data_t data; /* User data variable */
};
union epoll_data {
void *ptr;
int fd;
uint32_t u32;
uint64_t u64;
};
typedef union epoll_data epoll_data_t;
However, the Rust version in libc is different -- it just uses u64 for the data field. That is, unfortunately, not equivalent -- u64 cannot carry pointer provenance, so programs that want to store a pointer in data (which is quite common) need to use exposed-provenance APIs (i.e., ptr/int casts). Tokio carries some funky hacks to avoid that.
Since the C API is actually compatible with strict provenance here, it would be nice to expose that in libc as well. Given this is a breaking change it can only happen for libc 1.0 -- though it would be possible to have a separate event_data type and event_ctl declaration in its own module even in libc 0.2.
Metadata
Metadata
Assignees
Labels
C-bugCategory: bugCategory: bug