Skip to content

Commit d9a232d

Browse files
q2vendavem330
authored andcommitted
af_unix: Support POLLPRI for OOB.
The commit 314001f ("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: 314001f ("af_unix: Add OOB support") Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.co.jp> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e82025c commit d9a232d

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

net/unix/af_unix.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3137,6 +3137,10 @@ static __poll_t unix_poll(struct file *file, struct socket *sock, poll_table *wa
31373137
mask |= EPOLLIN | EPOLLRDNORM;
31383138
if (sk_is_readable(sk))
31393139
mask |= EPOLLIN | EPOLLRDNORM;
3140+
#if IS_ENABLED(CONFIG_AF_UNIX_OOB)
3141+
if (READ_ONCE(unix_sk(sk)->oob_skb))
3142+
mask |= EPOLLPRI;
3143+
#endif
31403144

31413145
/* Connection-based need to check for termination and startup */
31423146
if ((sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) &&

tools/testing/selftests/net/af_unix/test_unix_oob.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,10 @@ main(int argc, char **argv)
218218

219219
/* Test 1:
220220
* veriyf that SIGURG is
221-
* delivered and 63 bytes are
222-
* read and oob is '@'
221+
* delivered, 63 bytes are
222+
* read, oob is '@', and POLLPRI works.
223223
*/
224-
wait_for_data(pfd, POLLIN | POLLPRI);
224+
wait_for_data(pfd, POLLPRI);
225225
read_oob(pfd, &oob);
226226
len = read_data(pfd, buf, 1024);
227227
if (!signal_recvd || len != 63 || oob != '@') {

0 commit comments

Comments
 (0)