1*a200c8e5SJean-Sébastien Pédron /*- 2*a200c8e5SJean-Sébastien Pédron * Copyright (c) 2025 The FreeBSD Foundation 3*a200c8e5SJean-Sébastien Pédron * Copyright (c) 2025 Jean-Sébastien Pédron 4*a200c8e5SJean-Sébastien Pédron * 5*a200c8e5SJean-Sébastien Pédron * This software was developed by Jean-Sébastien Pédron under sponsorship 6*a200c8e5SJean-Sébastien Pédron * from the FreeBSD Foundation. 7*a200c8e5SJean-Sébastien Pédron * 8*a200c8e5SJean-Sébastien Pédron * Redistribution and use in source and binary forms, with or without 9*a200c8e5SJean-Sébastien Pédron * modification, are permitted provided that the following conditions 10*a200c8e5SJean-Sébastien Pédron * are met: 11*a200c8e5SJean-Sébastien Pédron * 1. Redistributions of source code must retain the above copyright 12*a200c8e5SJean-Sébastien Pédron * notice, this list of conditions and the following disclaimer. 13*a200c8e5SJean-Sébastien Pédron * 2. Redistributions in binary form must reproduce the above copyright 14*a200c8e5SJean-Sébastien Pédron * notice, this list of conditions and the following disclaimer in the 15*a200c8e5SJean-Sébastien Pédron * documentation and/or other materials provided with the distribution. 16*a200c8e5SJean-Sébastien Pédron * 17*a200c8e5SJean-Sébastien Pédron * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18*a200c8e5SJean-Sébastien Pédron * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19*a200c8e5SJean-Sébastien Pédron * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20*a200c8e5SJean-Sébastien Pédron * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21*a200c8e5SJean-Sébastien Pédron * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22*a200c8e5SJean-Sébastien Pédron * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23*a200c8e5SJean-Sébastien Pédron * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24*a200c8e5SJean-Sébastien Pédron * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25*a200c8e5SJean-Sébastien Pédron * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26*a200c8e5SJean-Sébastien Pédron * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27*a200c8e5SJean-Sébastien Pédron * SUCH DAMAGE. 28*a200c8e5SJean-Sébastien Pédron */ 29*a200c8e5SJean-Sébastien Pédron 30*a200c8e5SJean-Sébastien Pédron #ifndef _LINUXKPI_LINUX_EVENTFD_H_ 31*a200c8e5SJean-Sébastien Pédron #define _LINUXKPI_LINUX_EVENTFD_H_ 32*a200c8e5SJean-Sébastien Pédron 33*a200c8e5SJean-Sébastien Pédron #include <sys/eventfd.h> 34*a200c8e5SJean-Sébastien Pédron 35*a200c8e5SJean-Sébastien Pédron #include <linux/wait.h> 36*a200c8e5SJean-Sébastien Pédron #include <linux/err.h> 37*a200c8e5SJean-Sébastien Pédron #include <linux/percpu-defs.h> 38*a200c8e5SJean-Sébastien Pédron #include <linux/percpu.h> 39*a200c8e5SJean-Sébastien Pédron #include <linux/sched.h> 40*a200c8e5SJean-Sébastien Pédron 41*a200c8e5SJean-Sébastien Pédron /* 42*a200c8e5SJean-Sébastien Pédron * Linux uses `struct eventfd_ctx`, but FreeBSD defines `struct eventfd`. Here, 43*a200c8e5SJean-Sébastien Pédron * we define a synonym to the FreeBSD structure. This allows to keep Linux code 44*a200c8e5SJean-Sébastien Pédron * unmodified. 45*a200c8e5SJean-Sébastien Pédron */ 46*a200c8e5SJean-Sébastien Pédron #define eventfd_ctx eventfd 47*a200c8e5SJean-Sébastien Pédron 48*a200c8e5SJean-Sébastien Pédron #define eventfd_ctx_fdget lkpi_eventfd_ctx_fdget 49*a200c8e5SJean-Sébastien Pédron struct eventfd_ctx *lkpi_eventfd_ctx_fdget(int fd); 50*a200c8e5SJean-Sébastien Pédron 51*a200c8e5SJean-Sébastien Pédron #define eventfd_ctx_put lkpi_eventfd_ctx_put 52*a200c8e5SJean-Sébastien Pédron void lkpi_eventfd_ctx_put(struct eventfd_ctx *ctx); 53*a200c8e5SJean-Sébastien Pédron 54*a200c8e5SJean-Sébastien Pédron #endif /* _LINUXKPI_LINUX_EVENTFD_H_ */ 55