1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
3 * include/linux/eventpoll.h ( Efficient event polling implementation )
4 * Copyright (C) 2001,...,2006 Davide Libenzi
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
15 #ifndef _UAPI_LINUX_EVENTPOLL_H
16 #define _UAPI_LINUX_EVENTPOLL_H
19 #include <linux/fcntl.h>
20 #include <linux/types.h>
22 /* Flags for epoll_create1. */
23 #define EPOLL_CLOEXEC O_CLOEXEC
25 /* Valid opcodes to issue to sys_epoll_ctl() */
26 #define EPOLL_CTL_ADD 1
27 #define EPOLL_CTL_DEL 2
28 #define EPOLL_CTL_MOD 3
30 /* Epoll event masks */
31 #define EPOLLIN 0x00000001
32 #define EPOLLPRI 0x00000002
33 #define EPOLLOUT 0x00000004
34 #define EPOLLERR 0x00000008
35 #define EPOLLHUP 0x00000010
36 #define EPOLLRDNORM 0x00000040
37 #define EPOLLRDBAND 0x00000080
38 #define EPOLLWRNORM 0x00000100
39 #define EPOLLWRBAND 0x00000200
40 #define EPOLLMSG 0x00000400
41 #define EPOLLRDHUP 0x00002000
43 /* Set exclusive wakeup mode for the target file descriptor */
44 #define EPOLLEXCLUSIVE (1U << 28)
47 * Request the handling of system wakeup events so as to prevent system suspends
48 * from happening while those events are being processed.
50 * Assuming neither EPOLLET nor EPOLLONESHOT is set, system suspends will not be
51 * re-allowed until epoll_wait is called again after consuming the wakeup
54 * Requires CAP_BLOCK_SUSPEND
56 #define EPOLLWAKEUP (1U << 29)
58 /* Set the One Shot behaviour for the target file descriptor */
59 #define EPOLLONESHOT (1U << 30)
61 /* Set the Edge Triggered behaviour for the target file descriptor */
62 #define EPOLLET (1U << 31)
65 * On x86-64 make the 64bit structure have the same alignment as the
66 * 32bit structure. This makes 32bit emulation easier.
68 * UML/x86_64 needs the same packing as x86_64
71 #define EPOLL_PACKED __attribute__((packed))
81 #ifdef CONFIG_PM_SLEEP
82 static inline void ep_take_care_of_epollwakeup(struct epoll_event *epev)
84 if ((epev->events & EPOLLWAKEUP) && !capable(CAP_BLOCK_SUSPEND))
85 epev->events &= ~EPOLLWAKEUP;
88 static inline void ep_take_care_of_epollwakeup(struct epoll_event *epev)
90 epev->events &= ~EPOLLWAKEUP;
93 #endif /* _UAPI_LINUX_EVENTPOLL_H */