[Bug 95331] fcntl.2 + sigaction.2 + signal.7 need further information about use of a SA_SIGINFO signal handler that uses si->si_fd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



https://bugzilla.kernel.org/show_bug.cgi?id=95331

--- Comment #13 from Jason Vas Dias <jason.vas.dias@xxxxxxxxx> ---
I think it is because in fs/pipe.c :

static int
pipe_fasync(int fd, struct file *filp, int on)
{
    struct pipe_inode_info *pipe = filp->private_data;
    int retval = 0;

    __pipe_lock(pipe);
    if (filp->f_mode & FMODE_READ)
        retval = fasync_helper(fd, filp, on, &pipe->fasync_readers);
    if ((filp->f_mode & FMODE_WRITE) && retval >= 0) {
        retval = fasync_helper(fd, filp, on, &pipe->fasync_writers);
        if (retval < 0 && (filp->f_mode & FMODE_READ))
            /* this can happen only if on == T */
            fasync_helper(-1, filp, 0, &pipe->fasync_readers);
    }
    __pipe_unlock(pipe);
    return retval;
}


Perhaps a pipe FD ioctl could be provided that would set a pipe inode 
'sigio_on_write_enabled' flag that could be handled ? : 

    ... else
        if (pipe->sigio_on_write_enabled && (filp->f_mode & FMODE_WRITE) && 
           (retval == -1 ) && (pipe->last_retval != -1) &&  
           (pipe->last_readers != 0) ) 
        { pipe->last_retval = -1;
          if( pipe->readers == 0 )
              kill_fasync(&pipe->fasync_readers, SIGIO, POLL_OUT);
          retval = fasync_helper(fd, filp, on, &pipe->fasync_writers);
        } pipe->last_retval = retval; pipe->last_readers = pipe->readers;
    __pipe_unlock(pipe);
    return retval;
}

ie. so if the last error status was NOT -1, but is now -1, and O_ASYNC is
enabled, and readers is now 0, then if this special new sigio_on_write_enabled
flag was set, then a sigio might be sent for it ?

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux