rb: add cbindgen config for sys_timerfd

sys_timerfd was fully implemented in Rust (timerfd_create,
timerfd_settime, timerfd_gettime, itimerspec support) but lacked
the cbindgen.toml needed to generate the <sys/timerfd.h> C header.
Qt6's QSocketNotifier and many other C programs depend on this header.
Without it, cbindgen skips the directory entirely.

This adds the cbindgen config + trailer with all function prototypes,
matching the pattern used by sys_signalfd.
This commit is contained in:
Red Bear OS
2026-07-12 19:19:35 +03:00
parent d8ced461fa
commit e47a604197
+38
View File
@@ -0,0 +1,38 @@
# Linux kernel timerfd_create/timerfd_settime/timerfd_gettime
# See <https://man7.org/linux/man-pages/man2/timerfd_create.2.html>.
#
# This header is non-POSIX (a Linux/glibc extension) but fully implemented
# in relibc. It is required by Qt6 for QSocketNotifier and many other
# C programs that use timer file descriptors.
#
# Includes the itimerspec from <time.h>.
sys_includes = ["signal.h", "stdint.h", "stddef.h"]
include_guard = "_SYS_TIMERFD_H"
trailer = """
#ifndef TFD_CLOEXEC
#define TFD_CLOEXEC 0x80000
#endif
#ifndef TFD_NONBLOCK
#define TFD_NONBLOCK 0x800
#endif
#ifndef TFD_TIMER_ABSTIME
#define TFD_TIMER_ABSTIME 0x1
#endif
#ifndef TFD_TIMER_CANCEL_ON_SET
#define TFD_TIMER_CANCEL_ON_SET 0x2
#endif
int timerfd_create(int clockid, int flags);
int timerfd_settime(int fd, int flags, const struct itimerspec *new_value, struct itimerspec *old_value);
int timerfd_gettime(int fd, struct itimerspec *curr_value);
"""
language = "C"
style = "Tag"
no_includes = true
cpp_compat = true
[enum]
prefix_with_name = true