aboutsummaryrefslogtreecommitdiffstats
path: root/net/unix/af_unix.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-02-11 17:34:03 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-02-11 17:34:03 -0500
commita9a08845e9acbd224e4ee466f5c1275ed50054e8 (patch)
tree415d6e6a82e001c65e6b161539411f54ba5fe8ce /net/unix/af_unix.c
parentee5daa1361fceb6f482c005bcc9ba8d01b92ea5c (diff)
vfs: do bulk POLL* -> EPOLL* replacement
This is the mindless scripted replacement of kernel use of POLL* variables as described by Al, done by this script: for V in IN OUT PRI ERR RDNORM RDBAND WRNORM WRBAND HUP RDHUP NVAL MSG; do L=`git grep -l -w POLL$V | grep -v '^t' | grep -v /um/ | grep -v '^sa' | grep -v '/poll.h$'|grep -v '^D'` for f in $L; do sed -i "-es/^\([^\"]*\)\(\<POLL$V\>\)/\\1E\\2/" $f; done done with de-mangling cleanups yet to come. NOTE! On almost all architectures, the EPOLL* constants have the same values as the POLL* constants do. But they keyword here is "almost". For various bad reasons they aren't the same, and epoll() doesn't actually work quite correctly in some cases due to this on Sparc et al. The next patch from Al will sort out the final differences, and we should be all done. Scripted-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'net/unix/af_unix.c')
-rw-r--r--net/unix/af_unix.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 0214acbd6bff..d545e1d0dea2 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -415,9 +415,9 @@ static void unix_dgram_peer_wake_disconnect_wakeup(struct sock *sk,
415{ 415{
416 unix_dgram_peer_wake_disconnect(sk, other); 416 unix_dgram_peer_wake_disconnect(sk, other);
417 wake_up_interruptible_poll(sk_sleep(sk), 417 wake_up_interruptible_poll(sk_sleep(sk),
418 POLLOUT | 418 EPOLLOUT |
419 POLLWRNORM | 419 EPOLLWRNORM |
420 POLLWRBAND); 420 EPOLLWRBAND);
421} 421}
422 422
423/* preconditions: 423/* preconditions:
@@ -454,7 +454,7 @@ static void unix_write_space(struct sock *sk)
454 wq = rcu_dereference(sk->sk_wq); 454 wq = rcu_dereference(sk->sk_wq);
455 if (skwq_has_sleeper(wq)) 455 if (skwq_has_sleeper(wq))
456 wake_up_interruptible_sync_poll(&wq->wait, 456 wake_up_interruptible_sync_poll(&wq->wait,
457 POLLOUT | POLLWRNORM | POLLWRBAND); 457 EPOLLOUT | EPOLLWRNORM | EPOLLWRBAND);
458 sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT); 458 sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT);
459 } 459 }
460 rcu_read_unlock(); 460 rcu_read_unlock();
@@ -2129,8 +2129,8 @@ static int unix_dgram_recvmsg(struct socket *sock, struct msghdr *msg,
2129 2129
2130 if (wq_has_sleeper(&u->peer_wait)) 2130 if (wq_has_sleeper(&u->peer_wait))
2131 wake_up_interruptible_sync_poll(&u->peer_wait, 2131 wake_up_interruptible_sync_poll(&u->peer_wait,
2132 POLLOUT | POLLWRNORM | 2132 EPOLLOUT | EPOLLWRNORM |
2133 POLLWRBAND); 2133 EPOLLWRBAND);
2134 2134
2135 if (msg->msg_name) 2135 if (msg->msg_name)
2136 unix_copy_addr(msg, skb->sk); 2136 unix_copy_addr(msg, skb->sk);
@@ -2650,27 +2650,27 @@ static __poll_t unix_poll(struct file *file, struct socket *sock, poll_table *wa
2650 2650
2651 /* exceptional events? */ 2651 /* exceptional events? */
2652 if (sk->sk_err) 2652 if (sk->sk_err)
2653 mask |= POLLERR; 2653 mask |= EPOLLERR;
2654 if (sk->sk_shutdown == SHUTDOWN_MASK) 2654 if (sk->sk_shutdown == SHUTDOWN_MASK)
2655 mask |= POLLHUP; 2655 mask |= EPOLLHUP;
2656 if (sk->sk_shutdown & RCV_SHUTDOWN) 2656 if (sk->sk_shutdown & RCV_SHUTDOWN)
2657 mask |= POLLRDHUP | POLLIN | POLLRDNORM; 2657 mask |= EPOLLRDHUP | EPOLLIN | EPOLLRDNORM;
2658 2658
2659 /* readable? */ 2659 /* readable? */
2660 if (!skb_queue_empty(&sk->sk_receive_queue)) 2660 if (!skb_queue_empty(&sk->sk_receive_queue))
2661 mask |= POLLIN | POLLRDNORM; 2661 mask |= EPOLLIN | EPOLLRDNORM;
2662 2662
2663 /* Connection-based need to check for termination and startup */ 2663 /* Connection-based need to check for termination and startup */
2664 if ((sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) && 2664 if ((sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) &&
2665 sk->sk_state == TCP_CLOSE) 2665 sk->sk_state == TCP_CLOSE)
2666 mask |= POLLHUP; 2666 mask |= EPOLLHUP;
2667 2667
2668 /* 2668 /*
2669 * we set writable also when the other side has shut down the 2669 * we set writable also when the other side has shut down the
2670 * connection. This prevents stuck sockets. 2670 * connection. This prevents stuck sockets.
2671 */ 2671 */
2672 if (unix_writable(sk)) 2672 if (unix_writable(sk))
2673 mask |= POLLOUT | POLLWRNORM | POLLWRBAND; 2673 mask |= EPOLLOUT | EPOLLWRNORM | EPOLLWRBAND;
2674 2674
2675 return mask; 2675 return mask;
2676} 2676}
@@ -2687,29 +2687,29 @@ static __poll_t unix_dgram_poll(struct file *file, struct socket *sock,
2687 2687
2688 /* exceptional events? */ 2688 /* exceptional events? */
2689 if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) 2689 if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue))
2690 mask |= POLLERR | 2690 mask |= EPOLLERR |
2691 (sock_flag(sk, SOCK_SELECT_ERR_QUEUE) ? POLLPRI : 0); 2691 (sock_flag(sk, SOCK_SELECT_ERR_QUEUE) ? EPOLLPRI : 0);
2692 2692
2693 if (sk->sk_shutdown & RCV_SHUTDOWN) 2693 if (sk->sk_shutdown & RCV_SHUTDOWN)
2694 mask |= POLLRDHUP | POLLIN | POLLRDNORM; 2694 mask |= EPOLLRDHUP | EPOLLIN | EPOLLRDNORM;
2695 if (sk->sk_shutdown == SHUTDOWN_MASK) 2695 if (sk->sk_shutdown == SHUTDOWN_MASK)
2696 mask |= POLLHUP; 2696 mask |= EPOLLHUP;
2697 2697
2698 /* readable? */ 2698 /* readable? */
2699 if (!skb_queue_empty(&sk->sk_receive_queue)) 2699 if (!skb_queue_empty(&sk->sk_receive_queue))
2700 mask |= POLLIN | POLLRDNORM; 2700 mask |= EPOLLIN | EPOLLRDNORM;
2701 2701
2702 /* Connection-based need to check for termination and startup */ 2702 /* Connection-based need to check for termination and startup */
2703 if (sk->sk_type == SOCK_SEQPACKET) { 2703 if (sk->sk_type == SOCK_SEQPACKET) {
2704 if (sk->sk_state == TCP_CLOSE) 2704 if (sk->sk_state == TCP_CLOSE)
2705 mask |= POLLHUP; 2705 mask |= EPOLLHUP;
2706 /* connection hasn't started yet? */ 2706 /* connection hasn't started yet? */
2707 if (sk->sk_state == TCP_SYN_SENT) 2707 if (sk->sk_state == TCP_SYN_SENT)
2708 return mask; 2708 return mask;
2709 } 2709 }
2710 2710
2711 /* No write status requested, avoid expensive OUT tests. */ 2711 /* No write status requested, avoid expensive OUT tests. */
2712 if (!(poll_requested_events(wait) & (POLLWRBAND|POLLWRNORM|POLLOUT))) 2712 if (!(poll_requested_events(wait) & (EPOLLWRBAND|EPOLLWRNORM|EPOLLOUT)))
2713 return mask; 2713 return mask;
2714 2714
2715 writable = unix_writable(sk); 2715 writable = unix_writable(sk);
@@ -2726,7 +2726,7 @@ static __poll_t unix_dgram_poll(struct file *file, struct socket *sock,
2726 } 2726 }
2727 2727
2728 if (writable) 2728 if (writable)
2729 mask |= POLLOUT | POLLWRNORM | POLLWRBAND; 2729 mask |= EPOLLOUT | EPOLLWRNORM | EPOLLWRBAND;
2730 else 2730 else
2731 sk_set_bit(SOCKWQ_ASYNC_NOSPACE, sk); 2731 sk_set_bit(SOCKWQ_ASYNC_NOSPACE, sk);
2732 2732