1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ 2607ca46eSDavid Howells /* 3607ca46eSDavid Howells * include/linux/eventpoll.h ( Efficient event polling implementation ) 4607ca46eSDavid Howells * Copyright (C) 2001,...,2006 Davide Libenzi 5607ca46eSDavid Howells * 6607ca46eSDavid Howells * This program is free software; you can redistribute it and/or modify 7607ca46eSDavid Howells * it under the terms of the GNU General Public License as published by 8607ca46eSDavid Howells * the Free Software Foundation; either version 2 of the License, or 9607ca46eSDavid Howells * (at your option) any later version. 10607ca46eSDavid Howells * 11607ca46eSDavid Howells * Davide Libenzi <davidel@xmailserver.org> 12607ca46eSDavid Howells * 13607ca46eSDavid Howells */ 14607ca46eSDavid Howells 15607ca46eSDavid Howells #ifndef _UAPI_LINUX_EVENTPOLL_H 16607ca46eSDavid Howells #define _UAPI_LINUX_EVENTPOLL_H 17607ca46eSDavid Howells 18607ca46eSDavid Howells /* For O_CLOEXEC */ 19607ca46eSDavid Howells #include <linux/fcntl.h> 20607ca46eSDavid Howells #include <linux/types.h> 21607ca46eSDavid Howells 22607ca46eSDavid Howells /* Flags for epoll_create1. */ 23607ca46eSDavid Howells #define EPOLL_CLOEXEC O_CLOEXEC 24607ca46eSDavid Howells 25607ca46eSDavid Howells /* Valid opcodes to issue to sys_epoll_ctl() */ 26607ca46eSDavid Howells #define EPOLL_CTL_ADD 1 27607ca46eSDavid Howells #define EPOLL_CTL_DEL 2 28607ca46eSDavid Howells #define EPOLL_CTL_MOD 3 29607ca46eSDavid Howells 307e040726SGreg KH /* Epoll event masks */ 3165aaf87bSAl Viro #define EPOLLIN (__force __poll_t)0x00000001 3265aaf87bSAl Viro #define EPOLLPRI (__force __poll_t)0x00000002 3365aaf87bSAl Viro #define EPOLLOUT (__force __poll_t)0x00000004 3465aaf87bSAl Viro #define EPOLLERR (__force __poll_t)0x00000008 3565aaf87bSAl Viro #define EPOLLHUP (__force __poll_t)0x00000010 3665aaf87bSAl Viro #define EPOLLNVAL (__force __poll_t)0x00000020 3765aaf87bSAl Viro #define EPOLLRDNORM (__force __poll_t)0x00000040 3865aaf87bSAl Viro #define EPOLLRDBAND (__force __poll_t)0x00000080 3965aaf87bSAl Viro #define EPOLLWRNORM (__force __poll_t)0x00000100 4065aaf87bSAl Viro #define EPOLLWRBAND (__force __poll_t)0x00000200 4165aaf87bSAl Viro #define EPOLLMSG (__force __poll_t)0x00000400 4265aaf87bSAl Viro #define EPOLLRDHUP (__force __poll_t)0x00002000 437e040726SGreg KH 44caf1aeafSJens Axboe /* 45caf1aeafSJens Axboe * Internal flag - wakeup generated by io_uring, used to detect recursion back 46caf1aeafSJens Axboe * into the io_uring poll handler. 47caf1aeafSJens Axboe */ 48caf1aeafSJens Axboe #define EPOLL_URING_WAKE ((__force __poll_t)(1U << 27)) 49caf1aeafSJens Axboe 50df0108c5SJason Baron /* Set exclusive wakeup mode for the target file descriptor */ 5145cd74cbSGreg Kroah-Hartman #define EPOLLEXCLUSIVE ((__force __poll_t)(1U << 28)) 52df0108c5SJason Baron 53607ca46eSDavid Howells /* 54607ca46eSDavid Howells * Request the handling of system wakeup events so as to prevent system suspends 55607ca46eSDavid Howells * from happening while those events are being processed. 56607ca46eSDavid Howells * 57607ca46eSDavid Howells * Assuming neither EPOLLET nor EPOLLONESHOT is set, system suspends will not be 58607ca46eSDavid Howells * re-allowed until epoll_wait is called again after consuming the wakeup 59607ca46eSDavid Howells * event(s). 60607ca46eSDavid Howells * 61607ca46eSDavid Howells * Requires CAP_BLOCK_SUSPEND 62607ca46eSDavid Howells */ 6345cd74cbSGreg Kroah-Hartman #define EPOLLWAKEUP ((__force __poll_t)(1U << 29)) 64607ca46eSDavid Howells 65607ca46eSDavid Howells /* Set the One Shot behaviour for the target file descriptor */ 6645cd74cbSGreg Kroah-Hartman #define EPOLLONESHOT ((__force __poll_t)(1U << 30)) 67607ca46eSDavid Howells 68607ca46eSDavid Howells /* Set the Edge Triggered behaviour for the target file descriptor */ 6945cd74cbSGreg Kroah-Hartman #define EPOLLET ((__force __poll_t)(1U << 31)) 70607ca46eSDavid Howells 71607ca46eSDavid Howells /* 72607ca46eSDavid Howells * On x86-64 make the 64bit structure have the same alignment as the 73607ca46eSDavid Howells * 32bit structure. This makes 32bit emulation easier. 74607ca46eSDavid Howells * 75607ca46eSDavid Howells * UML/x86_64 needs the same packing as x86_64 76607ca46eSDavid Howells */ 77607ca46eSDavid Howells #ifdef __x86_64__ 78607ca46eSDavid Howells #define EPOLL_PACKED __attribute__((packed)) 79607ca46eSDavid Howells #else 80607ca46eSDavid Howells #define EPOLL_PACKED 81607ca46eSDavid Howells #endif 82607ca46eSDavid Howells 83607ca46eSDavid Howells struct epoll_event { 8465aaf87bSAl Viro __poll_t events; 85607ca46eSDavid Howells __u64 data; 86607ca46eSDavid Howells } EPOLL_PACKED; 87607ca46eSDavid Howells 88*18e2bf0eSJoe Damato struct epoll_params { 89*18e2bf0eSJoe Damato __u32 busy_poll_usecs; 90*18e2bf0eSJoe Damato __u16 busy_poll_budget; 91*18e2bf0eSJoe Damato __u8 prefer_busy_poll; 92*18e2bf0eSJoe Damato 93*18e2bf0eSJoe Damato /* pad the struct to a multiple of 64bits */ 94*18e2bf0eSJoe Damato __u8 __pad; 95*18e2bf0eSJoe Damato }; 96*18e2bf0eSJoe Damato 97*18e2bf0eSJoe Damato #define EPOLL_IOC_TYPE 0x8A 98*18e2bf0eSJoe Damato #define EPIOCSPARAMS _IOW(EPOLL_IOC_TYPE, 0x01, struct epoll_params) 99*18e2bf0eSJoe Damato #define EPIOCGPARAMS _IOR(EPOLL_IOC_TYPE, 0x02, struct epoll_params) 100*18e2bf0eSJoe Damato 101607ca46eSDavid Howells #endif /* _UAPI_LINUX_EVENTPOLL_H */ 102