linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r@public.gmane.org
To: linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [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: Sat, 02 May 2015 23:24:34 +0000	[thread overview]
Message-ID: <bug-95331-11311-94wTaFUQ9L@https.bugzilla.kernel.org/> (raw)
In-Reply-To: <bug-95331-11311-3bo0kxnWaOQUvHkbgXJLS5sdmw4N0Rt+2LY78lusg7I@public.gmane.org/>

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

--- Comment #13 from Jason Vas Dias <jason.vas.dias-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> ---
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-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-05-02 23:24 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-23 19:22 [Bug 95331] New: fcntl.2 + sigaction.2 + signal.7 need further information about use of a SA_SIGINFO signal handler that uses si->si_fd bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
     [not found] ` <bug-95331-11311-3bo0kxnWaOQUvHkbgXJLS5sdmw4N0Rt+2LY78lusg7I@public.gmane.org/>
2015-03-23 19:58   ` [Bug 95331] " bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
2015-03-23 20:25   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
2015-03-24 11:22   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
2015-03-24 11:51   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
2015-03-24 12:37   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
2015-05-02 19:44   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
2015-05-02 20:10   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
2015-05-02 20:19   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
2015-05-02 20:22   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
2015-05-02 20:31   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
2015-05-02 20:32   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
2015-05-02 20:45   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
2015-05-02 23:24   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r [this message]
2015-05-02 23:53   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
2015-05-02 23:56   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
2015-05-03  0:16   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
2015-05-03  0:19   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
2015-05-03  0:34   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
2015-05-03  1:49   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
2016-03-11 19:10   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
2016-03-25 19:44   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
2016-03-25 19:45   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r

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=bug-95331-11311-94wTaFUQ9L@https.bugzilla.kernel.org/ \
    --to=bugzilla-daemon-590eeb7gvniway/ihj7yzeb+6bgklq7r@public.gmane.org \
    --cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.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;
as well as URLs for NNTP newsgroup(s).