diff options
author | Sha Zhengju <handai.szj@taobao.com> | 2012-05-31 19:26:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-31 20:49:32 -0400 |
commit | ee62c6b2dc93c09585b51fad18449dc5edb9977f (patch) | |
tree | 538f5338f6a00d1a4cee9e69ba74082747a452aa /fs | |
parent | 71ca97da9d027009d318d319cbacf54a72f666c1 (diff) |
eventfd: change int to __u64 in eventfd_signal()
eventfd_ctx->count is an __u64 counter which is allowed to reach
ULLONG_MAX. eventfd_write() adds a __u64 value to "count", but the kernel
side eventfd_signal() only adds an int value to it. Make them consistent.
[akpm@linux-foundation.org: update interface documentation]
Signed-off-by: Sha Zhengju <handai.szj@taobao.com>
Cc: Davide Libenzi <davidel@xmailserver.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/eventfd.c | 12 |
1 files changed, 4 insertions, 8 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); |