git: aadc14bceb4e - main - linux(4): Convert flags in timerfd_create
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 05 Sep 2023 08:53:55 UTC
The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=aadc14bceb4e94f5b75a05de96cd9619b877b030 commit aadc14bceb4e94f5b75a05de96cd9619b877b030 Author: Vico Chen <vico.chern_qq.com> AuthorDate: 2023-09-05 08:53:02 +0000 Commit: Dmitry Chagin <dchagin@FreeBSD.org> CommitDate: 2023-09-05 08:53:02 +0000 linux(4): Convert flags in timerfd_create The timerfd is introduced in FreeBSD 14, and the Linux ABI timerfd is also moved to FreeBSD native timerfd, but it can't work well as Linux TFD_CLOEXEC and TFD_NONBLOCK haven't been converted to FreeBSD TFD_CLOEXEC and TFD_NONBLOCK. Reviewed by: dchagin, jfree Differential revision: https://reviews.freebsd.org/D41708 MFC after: 1 week --- sys/compat/linux/linux_event.c | 9 +++++++-- sys/compat/linux/linux_event.h | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/compat/linux/linux_event.c b/sys/compat/linux/linux_event.c index 816c68a90f1d..e88791659f1f 100644 --- a/sys/compat/linux/linux_event.c +++ b/sys/compat/linux/linux_event.c @@ -611,13 +611,18 @@ int linux_timerfd_create(struct thread *td, struct linux_timerfd_create_args *args) { clockid_t clockid; - int error; + int error, flags; error = linux_to_native_clockid(&clockid, args->clockid); if (error != 0) return (error); + flags = 0; + if ((args->flags & LINUX_TFD_CLOEXEC) != 0) + flags |= O_CLOEXEC; + if ((args->flags & LINUX_TFD_NONBLOCK) != 0) + flags |= TFD_NONBLOCK; - return (kern_timerfd_create(td, clockid, args->flags)); + return (kern_timerfd_create(td, clockid, flags)); } int diff --git a/sys/compat/linux/linux_event.h b/sys/compat/linux/linux_event.h index fa63371b5170..8c6758fefcc9 100644 --- a/sys/compat/linux/linux_event.h +++ b/sys/compat/linux/linux_event.h @@ -54,4 +54,7 @@ #define LINUX_EFD_SEMAPHORE (1 << 0) +#define LINUX_TFD_CLOEXEC LINUX_O_CLOEXEC +#define LINUX_TFD_NONBLOCK LINUX_O_NONBLOCK + #endif /* !_LINUX_EVENT_H_ */