socket.c (d29c445b635b3a03cf683cafcbae58a4ec1e1125) socket.c (e0d1095ae3405404d247afb00233ef837d58da83)
1/*
2 * NET An implementation of the SOCKET network access protocol.
3 *
4 * Version: @(#)socket.c 1.1.93 18/02/95
5 *
6 * Authors: Orest Zborowski, <obz@Kodak.COM>
7 * Ross Biro
8 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>

--- 92 unchanged lines hidden (view full) ---

101
102#include <linux/if_tun.h>
103#include <linux/ipv6_route.h>
104#include <linux/route.h>
105#include <linux/sockios.h>
106#include <linux/atalk.h>
107#include <net/busy_poll.h>
108
1/*
2 * NET An implementation of the SOCKET network access protocol.
3 *
4 * Version: @(#)socket.c 1.1.93 18/02/95
5 *
6 * Authors: Orest Zborowski, <obz@Kodak.COM>
7 * Ross Biro
8 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>

--- 92 unchanged lines hidden (view full) ---

101
102#include <linux/if_tun.h>
103#include <linux/ipv6_route.h>
104#include <linux/route.h>
105#include <linux/sockios.h>
106#include <linux/atalk.h>
107#include <net/busy_poll.h>
108
109#ifdef CONFIG_NET_LL_RX_POLL
109#ifdef CONFIG_NET_RX_BUSY_POLL
110unsigned int sysctl_net_busy_read __read_mostly;
111unsigned int sysctl_net_busy_poll __read_mostly;
112#endif
113
114static int sock_no_open(struct inode *irrelevant, struct file *dontcare);
115static ssize_t sock_aio_read(struct kiocb *iocb, const struct iovec *iov,
116 unsigned long nr_segs, loff_t pos);
117static ssize_t sock_aio_write(struct kiocb *iocb, const struct iovec *iov,

--- 731 unchanged lines hidden (view full) ---

849 */
850 msg->msg_iov = (struct iovec *)vec, msg->msg_iovlen = num;
851 result = sock_recvmsg(sock, msg, size, flags);
852 set_fs(oldfs);
853 return result;
854}
855EXPORT_SYMBOL(kernel_recvmsg);
856
110unsigned int sysctl_net_busy_read __read_mostly;
111unsigned int sysctl_net_busy_poll __read_mostly;
112#endif
113
114static int sock_no_open(struct inode *irrelevant, struct file *dontcare);
115static ssize_t sock_aio_read(struct kiocb *iocb, const struct iovec *iov,
116 unsigned long nr_segs, loff_t pos);
117static ssize_t sock_aio_write(struct kiocb *iocb, const struct iovec *iov,

--- 731 unchanged lines hidden (view full) ---

849 */
850 msg->msg_iov = (struct iovec *)vec, msg->msg_iovlen = num;
851 result = sock_recvmsg(sock, msg, size, flags);
852 set_fs(oldfs);
853 return result;
854}
855EXPORT_SYMBOL(kernel_recvmsg);
856
857static void sock_aio_dtor(struct kiocb *iocb)
858{
859 kfree(iocb->private);
860}
861
857static ssize_t sock_sendpage(struct file *file, struct page *page,
858 int offset, size_t size, loff_t *ppos, int more)
859{
860 struct socket *sock;
861 int flags;
862
863 sock = file->private_data;
864

--- 14 unchanged lines hidden (view full) ---

879 return -EINVAL;
880
881 return sock->ops->splice_read(sock, ppos, pipe, len, flags);
882}
883
884static struct sock_iocb *alloc_sock_iocb(struct kiocb *iocb,
885 struct sock_iocb *siocb)
886{
862static ssize_t sock_sendpage(struct file *file, struct page *page,
863 int offset, size_t size, loff_t *ppos, int more)
864{
865 struct socket *sock;
866 int flags;
867
868 sock = file->private_data;
869

--- 14 unchanged lines hidden (view full) ---

884 return -EINVAL;
885
886 return sock->ops->splice_read(sock, ppos, pipe, len, flags);
887}
888
889static struct sock_iocb *alloc_sock_iocb(struct kiocb *iocb,
890 struct sock_iocb *siocb)
891{
887 if (!is_sync_kiocb(iocb))
888 BUG();
892 if (!is_sync_kiocb(iocb)) {
893 siocb = kmalloc(sizeof(*siocb), GFP_KERNEL);
894 if (!siocb)
895 return NULL;
896 iocb->ki_dtor = sock_aio_dtor;
897 }
889
890 siocb->kiocb = iocb;
891 iocb->private = siocb;
892 return siocb;
893}
894
895static ssize_t do_sock_read(struct msghdr *msg, struct kiocb *iocb,
896 struct file *file, const struct iovec *iov,

--- 20 unchanged lines hidden (view full) ---

917static ssize_t sock_aio_read(struct kiocb *iocb, const struct iovec *iov,
918 unsigned long nr_segs, loff_t pos)
919{
920 struct sock_iocb siocb, *x;
921
922 if (pos != 0)
923 return -ESPIPE;
924
898
899 siocb->kiocb = iocb;
900 iocb->private = siocb;
901 return siocb;
902}
903
904static ssize_t do_sock_read(struct msghdr *msg, struct kiocb *iocb,
905 struct file *file, const struct iovec *iov,

--- 20 unchanged lines hidden (view full) ---

926static ssize_t sock_aio_read(struct kiocb *iocb, const struct iovec *iov,
927 unsigned long nr_segs, loff_t pos)
928{
929 struct sock_iocb siocb, *x;
930
931 if (pos != 0)
932 return -ESPIPE;
933
925 if (iocb->ki_nbytes == 0) /* Match SYS5 behaviour */
934 if (iocb->ki_left == 0) /* Match SYS5 behaviour */
926 return 0;
927
928
929 x = alloc_sock_iocb(iocb, &siocb);
930 if (!x)
931 return -ENOMEM;
932 return do_sock_read(&x->async_msg, iocb, iocb->ki_filp, iov, nr_segs);
933}

--- 2536 unchanged lines hidden ---
935 return 0;
936
937
938 x = alloc_sock_iocb(iocb, &siocb);
939 if (!x)
940 return -ENOMEM;
941 return do_sock_read(&x->async_msg, iocb, iocb->ki_filp, iov, nr_segs);
942}

--- 2536 unchanged lines hidden ---