mirror of
https://github.com/samba-team/samba.git
synced 2025-02-03 13:47:25 +03:00
b328e99065
Backends may require to map individual tevent_fd instances to a single low level kernel state (e.g. for epoll). This generic infrastructure adds helper functions using a generic (sub)part of struct tevent_fd. The new code will allow us to support more than 2 tevent_fd instances per fd, which makes sure all backends can provide a similar behavior. This will be important when we add TEVENT_FD_ERROR as a 3rd kind of fd event. The aim is to use this in order to replace the limited implementation we already have in tevent_epoll.c. As these helpers are typically called from within 'void tevent_fd_set_flags(struct tevent_fd *fde, uint16_t flags)' there's no way to report errors. So in order avoid additional error handling complexity the helpers try to avoid any allocations which may fail. It also means the logic in tevent_epoll.c doesn't have to change much. These are implemented as static line functions in order to avoid the function call overhead, which showed up in profiles of the early implementation. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>