diff options
Diffstat (limited to 'include/linux/eventfd.h')
| -rw-r--r-- | include/linux/eventfd.h | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h index f45a8ae5f828..3b85ba6479f4 100644 --- a/include/linux/eventfd.h +++ b/include/linux/eventfd.h | |||
| @@ -8,10 +8,8 @@ | |||
| 8 | #ifndef _LINUX_EVENTFD_H | 8 | #ifndef _LINUX_EVENTFD_H |
| 9 | #define _LINUX_EVENTFD_H | 9 | #define _LINUX_EVENTFD_H |
| 10 | 10 | ||
| 11 | #ifdef CONFIG_EVENTFD | ||
| 12 | |||
| 13 | /* For O_CLOEXEC and O_NONBLOCK */ | ||
| 14 | #include <linux/fcntl.h> | 11 | #include <linux/fcntl.h> |
| 12 | #include <linux/file.h> | ||
| 15 | 13 | ||
| 16 | /* | 14 | /* |
| 17 | * CAREFUL: Check include/asm-generic/fcntl.h when defining | 15 | * CAREFUL: Check include/asm-generic/fcntl.h when defining |
| @@ -27,16 +25,37 @@ | |||
| 27 | #define EFD_SHARED_FCNTL_FLAGS (O_CLOEXEC | O_NONBLOCK) | 25 | #define EFD_SHARED_FCNTL_FLAGS (O_CLOEXEC | O_NONBLOCK) |
| 28 | #define EFD_FLAGS_SET (EFD_SHARED_FCNTL_FLAGS | EFD_SEMAPHORE) | 26 | #define EFD_FLAGS_SET (EFD_SHARED_FCNTL_FLAGS | EFD_SEMAPHORE) |
| 29 | 27 | ||
| 28 | #ifdef CONFIG_EVENTFD | ||
| 29 | |||
| 30 | struct eventfd_ctx *eventfd_ctx_get(struct eventfd_ctx *ctx); | ||
| 31 | void eventfd_ctx_put(struct eventfd_ctx *ctx); | ||
| 30 | struct file *eventfd_fget(int fd); | 32 | struct file *eventfd_fget(int fd); |
| 31 | int eventfd_signal(struct file *file, int n); | 33 | struct eventfd_ctx *eventfd_ctx_fdget(int fd); |
| 34 | struct eventfd_ctx *eventfd_ctx_fileget(struct file *file); | ||
| 35 | int eventfd_signal(struct eventfd_ctx *ctx, int n); | ||
| 32 | 36 | ||
| 33 | #else /* CONFIG_EVENTFD */ | 37 | #else /* CONFIG_EVENTFD */ |
| 34 | 38 | ||
| 35 | #define eventfd_fget(fd) ERR_PTR(-ENOSYS) | 39 | /* |
| 36 | static inline int eventfd_signal(struct file *file, int n) | 40 | * Ugly ugly ugly error layer to support modules that uses eventfd but |
| 37 | { return 0; } | 41 | * pretend to work in !CONFIG_EVENTFD configurations. Namely, AIO. |
| 42 | */ | ||
| 43 | static inline struct eventfd_ctx *eventfd_ctx_fdget(int fd) | ||
| 44 | { | ||
| 45 | return ERR_PTR(-ENOSYS); | ||
| 46 | } | ||
| 47 | |||
| 48 | static inline int eventfd_signal(struct eventfd_ctx *ctx, int n) | ||
| 49 | { | ||
| 50 | return -ENOSYS; | ||
| 51 | } | ||
| 52 | |||
| 53 | static inline void eventfd_ctx_put(struct eventfd_ctx *ctx) | ||
| 54 | { | ||
| 55 | |||
| 56 | } | ||
| 38 | 57 | ||
| 39 | #endif /* CONFIG_EVENTFD */ | 58 | #endif |
| 40 | 59 | ||
| 41 | #endif /* _LINUX_EVENTFD_H */ | 60 | #endif /* _LINUX_EVENTFD_H */ |
| 42 | 61 | ||
