diff options
-rw-r--r-- | fs/eventfd.c | 12 | ||||
-rw-r--r-- | include/linux/eventfd.h | 2 |
2 files changed, 5 insertions, 9 deletions
diff --git a/fs/eventfd.c b/fs/eventfd.c index dba15fecf23e..d81b9f654086 100644 --- a/fs/eventfd.c +++ b/fs/eventfd.c | |||
@@ -46,20 +46,16 @@ struct eventfd_ctx { | |||
46 | * value, and we signal this as overflow condition by returining a POLLERR | 46 | * value, and we signal this as overflow condition by returining a POLLERR |
47 | * to poll(2). | 47 | * to poll(2). |
48 | * | 48 | * |
49 | * Returns @n in case of success, a non-negative number lower than @n in case | 49 | * Returns the amount by which the counter was incrememnted. This will be less |
50 | * of overflow, or the following error codes: | 50 | * than @n if the counter has overflowed. |
51 | * | ||
52 | * -EINVAL : The value of @n is negative. | ||
53 | */ | 51 | */ |
54 | int eventfd_signal(struct eventfd_ctx *ctx, int n) | 52 | __u64 eventfd_signal(struct eventfd_ctx *ctx, __u64 n) |
55 | { | 53 | { |
56 | unsigned long flags; | 54 | unsigned long flags; |
57 | 55 | ||
58 | if (n < 0) | ||
59 | return -EINVAL; | ||
60 | spin_lock_irqsave(&ctx->wqh.lock, flags); | 56 | spin_lock_irqsave(&ctx->wqh.lock, flags); |
61 | if (ULLONG_MAX - ctx->count < n) | 57 | if (ULLONG_MAX - ctx->count < n) |
62 | n = (int) (ULLONG_MAX - ctx->count); | 58 | n = ULLONG_MAX - ctx->count; |
63 | ctx->count += n; | 59 | ctx->count += n; |
64 | if (waitqueue_active(&ctx->wqh)) | 60 | if (waitqueue_active(&ctx->wqh)) |
65 | wake_up_locked_poll(&ctx->wqh, POLLIN); | 61 | wake_up_locked_poll(&ctx->wqh, POLLIN); |
diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h index 91bb4f27238c..3c3ef19a625a 100644 --- a/include/linux/eventfd.h +++ b/include/linux/eventfd.h | |||
@@ -34,7 +34,7 @@ void eventfd_ctx_put(struct eventfd_ctx *ctx); | |||
34 | struct file *eventfd_fget(int fd); | 34 | struct file *eventfd_fget(int fd); |
35 | struct eventfd_ctx *eventfd_ctx_fdget(int fd); | 35 | struct eventfd_ctx *eventfd_ctx_fdget(int fd); |
36 | struct eventfd_ctx *eventfd_ctx_fileget(struct file *file); | 36 | struct eventfd_ctx *eventfd_ctx_fileget(struct file *file); |
37 | int eventfd_signal(struct eventfd_ctx *ctx, int n); | 37 | __u64 eventfd_signal(struct eventfd_ctx *ctx, __u64 n); |
38 | ssize_t eventfd_ctx_read(struct eventfd_ctx *ctx, int no_wait, __u64 *cnt); | 38 | ssize_t eventfd_ctx_read(struct eventfd_ctx *ctx, int no_wait, __u64 *cnt); |
39 | int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, wait_queue_t *wait, | 39 | int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, wait_queue_t *wait, |
40 | __u64 *cnt); | 40 | __u64 *cnt); |