public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Love <rml@novell.com>
To: Greg KH <greg@kroah.com>
Cc: John McCutchan <ttb@tentacle.dhs.org>, linux-kernel@vger.kernel.org
Subject: Re: [patch] inotify: add FIONREAD support
Date: Fri, 05 Nov 2004 20:00:14 -0500	[thread overview]
Message-ID: <1099702814.6034.273.camel@localhost> (raw)
In-Reply-To: <1099702663.6034.270.camel@localhost>

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;
 	}



  reply	other threads:[~2004-11-06  0:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-05 23:14 [patch] inotify: add FIONREAD support Robert Love
2004-11-06  0:47 ` Greg KH
2004-11-06  0:57   ` Robert Love
2004-11-06  1:00     ` Robert Love [this message]
2004-11-07 23:41       ` John McCutchan
2004-11-06  1:00     ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1099702814.6034.273.camel@localhost \
    --to=rml@novell.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ttb@tentacle.dhs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox