public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pekka Enberg <penberg@cs.helsinki.fi>
To: Andrew Morton <akpm@osdl.org>
Cc: Manfred Spraul <manfred@colorfullife.com>, linux-kernel@vger.kernel.org
Subject: [PATCH] pipe: remove redundant fifo_poll abstraction
Date: Fri, 26 Aug 2005 20:54:07 +0300	[thread overview]
Message-ID: <1125078847.9403.2.camel@localhost> (raw)
In-Reply-To: <430F4E57.3000001@colorfullife.com>

On Fri, 2005-08-26 at 19:16 +0200, Manfred Spraul wrote:
> I would prefer just to remove the abstraction, together with a comment 
> that Linux fifos behave exactly like pipes, unlike the behavior of most 
> unices.

[PATCH] pipe: remove redundant fifo_poll abstraction

This patch removes a redundant fifo_poll() abstraction from fs/pipe.c and adds
a big fat comment stating we set POLLERR for FIFOs too on Linux unlike most
Unices.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---

 pipe.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Index: 2.6-mm/fs/pipe.c
===================================================================
--- 2.6-mm.orig/fs/pipe.c
+++ 2.6-mm/fs/pipe.c
@@ -419,6 +419,10 @@ pipe_poll(struct file *filp, poll_table 
 
 	if (filp->f_mode & FMODE_WRITE) {
 		mask |= (nrbufs < PIPE_BUFFERS) ? POLLOUT | POLLWRNORM : 0;
+		/*
+		 * Most Unices do not set POLLERR for FIFOs but on Linux they
+		 * behave exactly like pipes for poll().
+		 */
 		if (!PIPE_READERS(*inode))
 			mask |= POLLERR;
 	}
@@ -426,9 +430,6 @@ pipe_poll(struct file *filp, poll_table 
 	return mask;
 }
 
-/* FIXME: most Unices do not set POLLERR for fifos */
-#define fifo_poll pipe_poll
-
 static int
 pipe_release(struct inode *inode, int decr, int decw)
 {
@@ -572,7 +573,7 @@ struct file_operations read_fifo_fops = 
 	.read		= pipe_read,
 	.readv		= pipe_readv,
 	.write		= bad_pipe_w,
-	.poll		= fifo_poll,
+	.poll		= pipe_poll,
 	.ioctl		= pipe_ioctl,
 	.open		= pipe_read_open,
 	.release	= pipe_read_release,
@@ -584,7 +585,7 @@ struct file_operations write_fifo_fops =
 	.read		= bad_pipe_r,
 	.write		= pipe_write,
 	.writev		= pipe_writev,
-	.poll		= fifo_poll,
+	.poll		= pipe_poll,
 	.ioctl		= pipe_ioctl,
 	.open		= pipe_write_open,
 	.release	= pipe_write_release,
@@ -597,7 +598,7 @@ struct file_operations rdwr_fifo_fops = 
 	.readv		= pipe_readv,
 	.write		= pipe_write,
 	.writev		= pipe_writev,
-	.poll		= fifo_poll,
+	.poll		= pipe_poll,
 	.ioctl		= pipe_ioctl,
 	.open		= pipe_rdwr_open,
 	.release	= pipe_rdwr_release,



      reply	other threads:[~2005-08-26 17:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <ilomk8.i0yljb.2ul6sqfgelx5ik5dngkbmbkeu.beaver@cs.helsinki.fi>
     [not found] ` <ilomki.fs3loe.5j02sm6rx63x13ip2d9643lta.beaver@cs.helsinki.fi>
2005-08-26  0:02   ` [PATCH 2/2] pipe: do not return POLLERR for fifo_poll Andrew Morton
2005-08-26  7:03     ` Pekka J Enberg
2005-08-26 17:16       ` Manfred Spraul
2005-08-26 17:54         ` Pekka Enberg [this message]

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=1125078847.9403.2.camel@localhost \
    --to=penberg@cs.helsinki.fi \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manfred@colorfullife.com \
    /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