aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorDavide Libenzi <davidel@xmailserver.org>2010-01-13 12:34:36 -0500
committerMarcelo Tosatti <mtosatti@redhat.com>2010-01-25 09:26:38 -0500
commitcb289d6244a37cf932c571d6deb0daa8030f931b (patch)
tree05bea15a25c9d9a4dcc0658a6a8bf845daca535a /include/linux
parenta6085fbaf65ab09bfb5ec8d902d6d21680fe1895 (diff)
eventfd - allow atomic read and waitqueue remove
KVM needs a wait to atomically remove themselves from the eventfd ->poll() wait queue head, in order to handle correctly their IRQfd deassign operation. This patch introduces such API, plus a way to read an eventfd from its context. Signed-off-by: Davide Libenzi <davidel@xmailserver.org> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/eventfd.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h
index 94dd10366a78..91bb4f27238c 100644
--- a/include/linux/eventfd.h
+++ b/include/linux/eventfd.h
@@ -10,6 +10,7 @@
10 10
11#include <linux/fcntl.h> 11#include <linux/fcntl.h>
12#include <linux/file.h> 12#include <linux/file.h>
13#include <linux/wait.h>
13 14
14/* 15/*
15 * CAREFUL: Check include/asm-generic/fcntl.h when defining 16 * CAREFUL: Check include/asm-generic/fcntl.h when defining
@@ -34,6 +35,9 @@ struct file *eventfd_fget(int fd);
34struct eventfd_ctx *eventfd_ctx_fdget(int fd); 35struct eventfd_ctx *eventfd_ctx_fdget(int fd);
35struct eventfd_ctx *eventfd_ctx_fileget(struct file *file); 36struct eventfd_ctx *eventfd_ctx_fileget(struct file *file);
36int eventfd_signal(struct eventfd_ctx *ctx, int n); 37int eventfd_signal(struct eventfd_ctx *ctx, int n);
38ssize_t eventfd_ctx_read(struct eventfd_ctx *ctx, int no_wait, __u64 *cnt);
39int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, wait_queue_t *wait,
40 __u64 *cnt);
37 41
38#else /* CONFIG_EVENTFD */ 42#else /* CONFIG_EVENTFD */
39 43
@@ -61,6 +65,18 @@ static inline void eventfd_ctx_put(struct eventfd_ctx *ctx)
61 65
62} 66}
63 67
68static inline ssize_t eventfd_ctx_read(struct eventfd_ctx *ctx, int no_wait,
69 __u64 *cnt)
70{
71 return -ENOSYS;
72}
73
74static inline int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx,
75 wait_queue_t *wait, __u64 *cnt)
76{
77 return -ENOSYS;
78}
79
64#endif 80#endif
65 81
66#endif /* _LINUX_EVENTFD_H */ 82#endif /* _LINUX_EVENTFD_H */