powerpc/hugetlb: Don't do runtime allocation of 16G pages in LPAR configuration
[linux-2.6-block.git] / include / linux / eventfd.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
e1ad7468
DL
2/*
3 * include/linux/eventfd.h
4 *
5 * Copyright (C) 2007 Davide Libenzi <davidel@xmailserver.org>
6 *
7 */
8
9#ifndef _LINUX_EVENTFD_H
10#define _LINUX_EVENTFD_H
11
b087498e 12#include <linux/fcntl.h>
cb289d62 13#include <linux/wait.h>
fa3fc2ad 14#include <linux/err.h>
b087498e 15
bcd0b235 16/*
1d730c49 17 * CAREFUL: Check include/uapi/asm-generic/fcntl.h when defining
bcd0b235
DL
18 * new flags, since they might collide with O_* ones. We want
19 * to re-use O_* flags that couldn't possibly have a meaning
20 * from eventfd, in order to leave a free define-space for
21 * shared O_* flags.
22 */
23#define EFD_SEMAPHORE (1 << 0)
b087498e 24#define EFD_CLOEXEC O_CLOEXEC
e7d476df 25#define EFD_NONBLOCK O_NONBLOCK
b087498e 26
bcd0b235
DL
27#define EFD_SHARED_FCNTL_FLAGS (O_CLOEXEC | O_NONBLOCK)
28#define EFD_FLAGS_SET (EFD_SHARED_FCNTL_FLAGS | EFD_SEMAPHORE)
29
105f2b70 30struct eventfd_ctx;
4e10f3c9
AV
31struct file;
32
13389010
DL
33#ifdef CONFIG_EVENTFD
34
13389010 35void eventfd_ctx_put(struct eventfd_ctx *ctx);
e1ad7468 36struct file *eventfd_fget(int fd);
13389010
DL
37struct eventfd_ctx *eventfd_ctx_fdget(int fd);
38struct eventfd_ctx *eventfd_ctx_fileget(struct file *file);
ee62c6b2 39__u64 eventfd_signal(struct eventfd_ctx *ctx, __u64 n);
ac6424b9 40int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, wait_queue_entry_t *wait,
cb289d62 41 __u64 *cnt);
e1ad7468
DL
42
43#else /* CONFIG_EVENTFD */
44
13389010
DL
45/*
46 * Ugly ugly ugly error layer to support modules that uses eventfd but
47 * pretend to work in !CONFIG_EVENTFD configurations. Namely, AIO.
48 */
562787a5 49
13389010
DL
50static inline struct eventfd_ctx *eventfd_ctx_fdget(int fd)
51{
52 return ERR_PTR(-ENOSYS);
53}
54
55static inline int eventfd_signal(struct eventfd_ctx *ctx, int n)
56{
57 return -ENOSYS;
58}
59
60static inline void eventfd_ctx_put(struct eventfd_ctx *ctx)
61{
62
63}
e1ad7468 64
cb289d62 65static inline int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx,
ac6424b9 66 wait_queue_entry_t *wait, __u64 *cnt)
cb289d62
DL
67{
68 return -ENOSYS;
69}
70
13389010 71#endif
e1ad7468 72
e1ad7468
DL
73#endif /* _LINUX_EVENTFD_H */
74