diff options
author | James Morris <jmorris@namei.org> | 2018-02-21 11:21:41 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2018-02-21 11:21:41 -0500 |
commit | a02633e9b13dcb9b1a656b08f81bc8ba2d4d2294 (patch) | |
tree | 3d5ef56eee3117cd61812759a255fa293d8044b8 /net/unix/af_unix.c | |
parent | d21bd6898336a7892914d308d5e0868f0b863571 (diff) | |
parent | 91ab883eb21325ad80f3473633f794c78ac87f51 (diff) |
Merge tag 'v4.16-rc2' into next-general
Sync to Linux 4.16-rc2 for developers to work against.
Diffstat (limited to 'net/unix/af_unix.c')
-rw-r--r-- | net/unix/af_unix.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index a9ee634f3c42..d545e1d0dea2 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -367,7 +367,7 @@ static int unix_dgram_peer_wake_relay(wait_queue_entry_t *q, unsigned mode, int | |||
367 | /* relaying can only happen while the wq still exists */ | 367 | /* relaying can only happen while the wq still exists */ |
368 | u_sleep = sk_sleep(&u->sk); | 368 | u_sleep = sk_sleep(&u->sk); |
369 | if (u_sleep) | 369 | if (u_sleep) |
370 | wake_up_interruptible_poll(u_sleep, key); | 370 | wake_up_interruptible_poll(u_sleep, key_to_poll(key)); |
371 | 371 | ||
372 | return 0; | 372 | return 0; |
373 | } | 373 | } |
@@ -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(); |
@@ -638,8 +638,8 @@ static int unix_stream_connect(struct socket *, struct sockaddr *, | |||
638 | static int unix_socketpair(struct socket *, struct socket *); | 638 | static int unix_socketpair(struct socket *, struct socket *); |
639 | static int unix_accept(struct socket *, struct socket *, int, bool); | 639 | static int unix_accept(struct socket *, struct socket *, int, bool); |
640 | static int unix_getname(struct socket *, struct sockaddr *, int *, int); | 640 | static int unix_getname(struct socket *, struct sockaddr *, int *, int); |
641 | static unsigned int unix_poll(struct file *, struct socket *, poll_table *); | 641 | static __poll_t unix_poll(struct file *, struct socket *, poll_table *); |
642 | static unsigned int unix_dgram_poll(struct file *, struct socket *, | 642 | static __poll_t unix_dgram_poll(struct file *, struct socket *, |
643 | poll_table *); | 643 | poll_table *); |
644 | static int unix_ioctl(struct socket *, unsigned int, unsigned long); | 644 | static int unix_ioctl(struct socket *, unsigned int, unsigned long); |
645 | static int unix_shutdown(struct socket *, int); | 645 | static int unix_shutdown(struct socket *, int); |
@@ -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); |
@@ -2640,75 +2640,76 @@ static int unix_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
2640 | return err; | 2640 | return err; |
2641 | } | 2641 | } |
2642 | 2642 | ||
2643 | static unsigned int unix_poll(struct file *file, struct socket *sock, poll_table *wait) | 2643 | static __poll_t unix_poll(struct file *file, struct socket *sock, poll_table *wait) |
2644 | { | 2644 | { |
2645 | struct sock *sk = sock->sk; | 2645 | struct sock *sk = sock->sk; |
2646 | unsigned int mask; | 2646 | __poll_t mask; |
2647 | 2647 | ||
2648 | sock_poll_wait(file, sk_sleep(sk), wait); | 2648 | sock_poll_wait(file, sk_sleep(sk), wait); |
2649 | mask = 0; | 2649 | mask = 0; |
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 | } |
2677 | 2677 | ||
2678 | static unsigned int unix_dgram_poll(struct file *file, struct socket *sock, | 2678 | static __poll_t unix_dgram_poll(struct file *file, struct socket *sock, |
2679 | poll_table *wait) | 2679 | poll_table *wait) |
2680 | { | 2680 | { |
2681 | struct sock *sk = sock->sk, *other; | 2681 | struct sock *sk = sock->sk, *other; |
2682 | unsigned int mask, writable; | 2682 | unsigned int writable; |
2683 | __poll_t mask; | ||
2683 | 2684 | ||
2684 | sock_poll_wait(file, sk_sleep(sk), wait); | 2685 | sock_poll_wait(file, sk_sleep(sk), wait); |
2685 | mask = 0; | 2686 | mask = 0; |
2686 | 2687 | ||
2687 | /* exceptional events? */ | 2688 | /* exceptional events? */ |
2688 | if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) | 2689 | if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) |
2689 | mask |= POLLERR | | 2690 | mask |= EPOLLERR | |
2690 | (sock_flag(sk, SOCK_SELECT_ERR_QUEUE) ? POLLPRI : 0); | 2691 | (sock_flag(sk, SOCK_SELECT_ERR_QUEUE) ? EPOLLPRI : 0); |
2691 | 2692 | ||
2692 | if (sk->sk_shutdown & RCV_SHUTDOWN) | 2693 | if (sk->sk_shutdown & RCV_SHUTDOWN) |
2693 | mask |= POLLRDHUP | POLLIN | POLLRDNORM; | 2694 | mask |= EPOLLRDHUP | EPOLLIN | EPOLLRDNORM; |
2694 | if (sk->sk_shutdown == SHUTDOWN_MASK) | 2695 | if (sk->sk_shutdown == SHUTDOWN_MASK) |
2695 | mask |= POLLHUP; | 2696 | mask |= EPOLLHUP; |
2696 | 2697 | ||
2697 | /* readable? */ | 2698 | /* readable? */ |
2698 | if (!skb_queue_empty(&sk->sk_receive_queue)) | 2699 | if (!skb_queue_empty(&sk->sk_receive_queue)) |
2699 | mask |= POLLIN | POLLRDNORM; | 2700 | mask |= EPOLLIN | EPOLLRDNORM; |
2700 | 2701 | ||
2701 | /* Connection-based need to check for termination and startup */ | 2702 | /* Connection-based need to check for termination and startup */ |
2702 | if (sk->sk_type == SOCK_SEQPACKET) { | 2703 | if (sk->sk_type == SOCK_SEQPACKET) { |
2703 | if (sk->sk_state == TCP_CLOSE) | 2704 | if (sk->sk_state == TCP_CLOSE) |
2704 | mask |= POLLHUP; | 2705 | mask |= EPOLLHUP; |
2705 | /* connection hasn't started yet? */ | 2706 | /* connection hasn't started yet? */ |
2706 | if (sk->sk_state == TCP_SYN_SENT) | 2707 | if (sk->sk_state == TCP_SYN_SENT) |
2707 | return mask; | 2708 | return mask; |
2708 | } | 2709 | } |
2709 | 2710 | ||
2710 | /* No write status requested, avoid expensive OUT tests. */ | 2711 | /* No write status requested, avoid expensive OUT tests. */ |
2711 | if (!(poll_requested_events(wait) & (POLLWRBAND|POLLWRNORM|POLLOUT))) | 2712 | if (!(poll_requested_events(wait) & (EPOLLWRBAND|EPOLLWRNORM|EPOLLOUT))) |
2712 | return mask; | 2713 | return mask; |
2713 | 2714 | ||
2714 | writable = unix_writable(sk); | 2715 | writable = unix_writable(sk); |
@@ -2725,7 +2726,7 @@ static unsigned int unix_dgram_poll(struct file *file, struct socket *sock, | |||
2725 | } | 2726 | } |
2726 | 2727 | ||
2727 | if (writable) | 2728 | if (writable) |
2728 | mask |= POLLOUT | POLLWRNORM | POLLWRBAND; | 2729 | mask |= EPOLLOUT | EPOLLWRNORM | EPOLLWRBAND; |
2729 | else | 2730 | else |
2730 | sk_set_bit(SOCKWQ_ASYNC_NOSPACE, sk); | 2731 | sk_set_bit(SOCKWQ_ASYNC_NOSPACE, sk); |
2731 | 2732 | ||
@@ -2869,7 +2870,6 @@ static int unix_seq_open(struct inode *inode, struct file *file) | |||
2869 | } | 2870 | } |
2870 | 2871 | ||
2871 | static const struct file_operations unix_seq_fops = { | 2872 | static const struct file_operations unix_seq_fops = { |
2872 | .owner = THIS_MODULE, | ||
2873 | .open = unix_seq_open, | 2873 | .open = unix_seq_open, |
2874 | .read = seq_read, | 2874 | .read = seq_read, |
2875 | .llseek = seq_lseek, | 2875 | .llseek = seq_lseek, |