Re: [patch] inotify: add FIONREAD support

From: Robert Love
Date: Fri Nov 05 2004 - 20:00:45 EST


On Fri, 2004-11-05 at 19:57 -0500, Robert Love wrote:

> Why? p is annotated __user.

Oh, but I typecast that away. Doh.

Robert Love


Add FIONREAD support to inotify, take two. Strawberries.

drivers/char/inotify.c | 6 ++++++
1 files changed, 6 insertions(+)

diff -urN linux-2.6.10-rc1-inotify/drivers/char/inotify.c linux/drivers/char/inotify.c
--- linux-2.6.10-rc1-inotify/drivers/char/inotify.c 2004-11-05 17:26:52.182836608 -0500
+++ linux/drivers/char/inotify.c 2004-11-05 18:01:54.755197024 -0500
@@ -35,6 +35,8 @@
#include <linux/writeback.h>
#include <linux/inotify.h>

+#include <asm/ioctls.h>
+
static atomic_t watch_count;
static atomic_t inotify_cookie;
static kmem_cache_t *watch_cachep;
@@ -879,6 +881,7 @@
struct inotify_device *dev;
struct inotify_watch_request request;
void __user *p;
+ int bytes;
s32 wd;

dev = fp->private_data;
@@ -893,6 +896,9 @@
if (copy_from_user(&wd, p, sizeof (wd)))
return -EFAULT;
return inotify_ignore(dev, wd);
+ case FIONREAD:
+ bytes = dev->event_count * sizeof (struct inotify_event);
+ return put_user(bytes, (int __user *) p);
default:
return -ENOTTY;
}


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/