Commit d9a232d4 authored by Kuniyuki Iwashima's avatar Kuniyuki Iwashima Committed by David S. Miller

af_unix: Support POLLPRI for OOB.

The commit 314001f0 ("af_unix: Add OOB support") introduced OOB for
AF_UNIX, but it lacks some changes for POLLPRI.  Let's add the missing
piece.

In the selftest, normal datagrams are sent followed by OOB data, so this
commit replaces `POLLIN | POLLPRI` with just `POLLPRI` in the first test
case.

Fixes: 314001f0 ("af_unix: Add OOB support")
Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.co.jp>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e82025c6
...@@ -3137,6 +3137,10 @@ static __poll_t unix_poll(struct file *file, struct socket *sock, poll_table *wa ...@@ -3137,6 +3137,10 @@ static __poll_t unix_poll(struct file *file, struct socket *sock, poll_table *wa
mask |= EPOLLIN | EPOLLRDNORM; mask |= EPOLLIN | EPOLLRDNORM;
if (sk_is_readable(sk)) if (sk_is_readable(sk))
mask |= EPOLLIN | EPOLLRDNORM; mask |= EPOLLIN | EPOLLRDNORM;
#if IS_ENABLED(CONFIG_AF_UNIX_OOB)
if (READ_ONCE(unix_sk(sk)->oob_skb))
mask |= EPOLLPRI;
#endif
/* Connection-based need to check for termination and startup */ /* Connection-based need to check for termination and startup */
if ((sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) && if ((sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) &&
......
...@@ -218,10 +218,10 @@ main(int argc, char **argv) ...@@ -218,10 +218,10 @@ main(int argc, char **argv)
/* Test 1: /* Test 1:
* veriyf that SIGURG is * veriyf that SIGURG is
* delivered and 63 bytes are * delivered, 63 bytes are
* read and oob is '@' * read, oob is '@', and POLLPRI works.
*/ */
wait_for_data(pfd, POLLIN | POLLPRI); wait_for_data(pfd, POLLPRI);
read_oob(pfd, &oob); read_oob(pfd, &oob);
len = read_data(pfd, buf, 1024); len = read_data(pfd, buf, 1024);
if (!signal_recvd || len != 63 || oob != '@') { if (!signal_recvd || len != 63 || oob != '@') {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment