Re: [PATCH 2/2] pipe: do not return POLLERR for fifo_poll
From: Andrew Morton
Date: Thu Aug 25 2005 - 19:06:15 EST
Pekka Enberg <penberg@xxxxxxxxxxxxxx> wrote:
>
> This patch changes fifo_poll not to return POLLERR to take care of a FIXME
> in fs/pipe.c stating that "Most unices do not set POLLERR for fifos." The
> comment has been there since 2.3.99-pre3 so either apply this patch or
> alternatively, I can send a new one removing the unnecessary abstraction.
>
> ...
> --- 2.6-mm.orig/fs/pipe.c
> +++ 2.6-mm/fs/pipe.c
> @@ -399,8 +399,8 @@ pipe_ioctl(struct inode *pino, struct fi
> }
>
> /* No kernel lock held - fine */
> -static unsigned int
> -pipe_poll(struct file *filp, poll_table *wait)
> +static inline unsigned int
> +__pipe_poll(struct file *filp, poll_table *wait, int can_err)
> {
> unsigned int mask;
> struct inode *inode = filp->f_dentry->d_inode;
> @@ -420,15 +420,24 @@ pipe_poll(struct file *filp, poll_table
>
> if (filp->f_mode & FMODE_WRITE) {
> mask |= (nrbufs < PIPE_BUFFERS) ? POLLOUT | POLLWRNORM : 0;
> - if (!info->readers)
> + if (can_err && !info->readers)
> mask |= POLLERR;
> }
>
> return mask;
> }
>
> -/* FIXME: most Unices do not set POLLERR for fifos */
> -#define fifo_poll pipe_poll
> +static unsigned int
> +pipe_poll(struct file *filp, poll_table *wait)
> +{
> + return __pipe_poll(filp, wait, 1);
> +}
> +
> +static unsigned int
> +fifo_poll(struct file *filp, poll_table *wait)
> +{
> + return __pipe_poll(filp, wait, 0);
> +}
>
> static int
> pipe_release(struct inode *inode, int decr, int decw)
A userspace-visible change, no?
So there's a risk in changing it. What do we get in return? Worried.
-
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/