aboutsummaryrefslogtreecommitdiffstats
path: root/net/unix/af_unix.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/unix/af_unix.c')
-rw-r--r--net/unix/af_unix.c47
1 files changed, 13 insertions, 34 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 68bb70a62afe..95b02a71fd47 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -638,9 +638,8 @@ static int unix_stream_connect(struct socket *, struct sockaddr *,
638static int unix_socketpair(struct socket *, struct socket *); 638static int unix_socketpair(struct socket *, struct socket *);
639static int unix_accept(struct socket *, struct socket *, int, bool); 639static int unix_accept(struct socket *, struct socket *, int, bool);
640static int unix_getname(struct socket *, struct sockaddr *, int); 640static int unix_getname(struct socket *, struct sockaddr *, int);
641static __poll_t unix_poll(struct file *, struct socket *, poll_table *); 641static __poll_t unix_poll_mask(struct socket *, __poll_t);
642static __poll_t unix_dgram_poll(struct file *, struct socket *, 642static __poll_t unix_dgram_poll_mask(struct socket *, __poll_t);
643 poll_table *);
644static int unix_ioctl(struct socket *, unsigned int, unsigned long); 643static int unix_ioctl(struct socket *, unsigned int, unsigned long);
645static int unix_shutdown(struct socket *, int); 644static int unix_shutdown(struct socket *, int);
646static int unix_stream_sendmsg(struct socket *, struct msghdr *, size_t); 645static int unix_stream_sendmsg(struct socket *, struct msghdr *, size_t);
@@ -681,7 +680,7 @@ static const struct proto_ops unix_stream_ops = {
681 .socketpair = unix_socketpair, 680 .socketpair = unix_socketpair,
682 .accept = unix_accept, 681 .accept = unix_accept,
683 .getname = unix_getname, 682 .getname = unix_getname,
684 .poll = unix_poll, 683 .poll_mask = unix_poll_mask,
685 .ioctl = unix_ioctl, 684 .ioctl = unix_ioctl,
686 .listen = unix_listen, 685 .listen = unix_listen,
687 .shutdown = unix_shutdown, 686 .shutdown = unix_shutdown,
@@ -704,7 +703,7 @@ static const struct proto_ops unix_dgram_ops = {
704 .socketpair = unix_socketpair, 703 .socketpair = unix_socketpair,
705 .accept = sock_no_accept, 704 .accept = sock_no_accept,
706 .getname = unix_getname, 705 .getname = unix_getname,
707 .poll = unix_dgram_poll, 706 .poll_mask = unix_dgram_poll_mask,
708 .ioctl = unix_ioctl, 707 .ioctl = unix_ioctl,
709 .listen = sock_no_listen, 708 .listen = sock_no_listen,
710 .shutdown = unix_shutdown, 709 .shutdown = unix_shutdown,
@@ -726,7 +725,7 @@ static const struct proto_ops unix_seqpacket_ops = {
726 .socketpair = unix_socketpair, 725 .socketpair = unix_socketpair,
727 .accept = unix_accept, 726 .accept = unix_accept,
728 .getname = unix_getname, 727 .getname = unix_getname,
729 .poll = unix_dgram_poll, 728 .poll_mask = unix_dgram_poll_mask,
730 .ioctl = unix_ioctl, 729 .ioctl = unix_ioctl,
731 .listen = unix_listen, 730 .listen = unix_listen,
732 .shutdown = unix_shutdown, 731 .shutdown = unix_shutdown,
@@ -2630,13 +2629,10 @@ static int unix_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
2630 return err; 2629 return err;
2631} 2630}
2632 2631
2633static __poll_t unix_poll(struct file *file, struct socket *sock, poll_table *wait) 2632static __poll_t unix_poll_mask(struct socket *sock, __poll_t events)
2634{ 2633{
2635 struct sock *sk = sock->sk; 2634 struct sock *sk = sock->sk;
2636 __poll_t mask; 2635 __poll_t mask = 0;
2637
2638 sock_poll_wait(file, sk_sleep(sk), wait);
2639 mask = 0;
2640 2636
2641 /* exceptional events? */ 2637 /* exceptional events? */
2642 if (sk->sk_err) 2638 if (sk->sk_err)
@@ -2665,15 +2661,11 @@ static __poll_t unix_poll(struct file *file, struct socket *sock, poll_table *wa
2665 return mask; 2661 return mask;
2666} 2662}
2667 2663
2668static __poll_t unix_dgram_poll(struct file *file, struct socket *sock, 2664static __poll_t unix_dgram_poll_mask(struct socket *sock, __poll_t events)
2669 poll_table *wait)
2670{ 2665{
2671 struct sock *sk = sock->sk, *other; 2666 struct sock *sk = sock->sk, *other;
2672 unsigned int writable; 2667 int writable;
2673 __poll_t mask; 2668 __poll_t mask = 0;
2674
2675 sock_poll_wait(file, sk_sleep(sk), wait);
2676 mask = 0;
2677 2669
2678 /* exceptional events? */ 2670 /* exceptional events? */
2679 if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) 2671 if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue))
@@ -2699,7 +2691,7 @@ static __poll_t unix_dgram_poll(struct file *file, struct socket *sock,
2699 } 2691 }
2700 2692
2701 /* No write status requested, avoid expensive OUT tests. */ 2693 /* No write status requested, avoid expensive OUT tests. */
2702 if (!(poll_requested_events(wait) & (EPOLLWRBAND|EPOLLWRNORM|EPOLLOUT))) 2694 if (!(events & (EPOLLWRBAND|EPOLLWRNORM|EPOLLOUT)))
2703 return mask; 2695 return mask;
2704 2696
2705 writable = unix_writable(sk); 2697 writable = unix_writable(sk);
@@ -2852,20 +2844,6 @@ static const struct seq_operations unix_seq_ops = {
2852 .stop = unix_seq_stop, 2844 .stop = unix_seq_stop,
2853 .show = unix_seq_show, 2845 .show = unix_seq_show,
2854}; 2846};
2855
2856static int unix_seq_open(struct inode *inode, struct file *file)
2857{
2858 return seq_open_net(inode, file, &unix_seq_ops,
2859 sizeof(struct seq_net_private));
2860}
2861
2862static const struct file_operations unix_seq_fops = {
2863 .open = unix_seq_open,
2864 .read = seq_read,
2865 .llseek = seq_lseek,
2866 .release = seq_release_net,
2867};
2868
2869#endif 2847#endif
2870 2848
2871static const struct net_proto_family unix_family_ops = { 2849static const struct net_proto_family unix_family_ops = {
@@ -2884,7 +2862,8 @@ static int __net_init unix_net_init(struct net *net)
2884 goto out; 2862 goto out;
2885 2863
2886#ifdef CONFIG_PROC_FS 2864#ifdef CONFIG_PROC_FS
2887 if (!proc_create("unix", 0, net->proc_net, &unix_seq_fops)) { 2865 if (!proc_create_net("unix", 0, net->proc_net, &unix_seq_ops,
2866 sizeof(struct seq_net_private))) {
2888 unix_sysctl_unregister(net); 2867 unix_sysctl_unregister(net);
2889 goto out; 2868 goto out;
2890 } 2869 }