socket.c (eb5bc2a213f96bd43b5f00a625acb0c669613645) socket.c (66ee59af630fd8d5f4f56fb28162857e629aa0ab)
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>

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

853 ssize_t res;
854
855 if (file->f_flags & O_NONBLOCK)
856 msg.msg_flags = MSG_DONTWAIT;
857
858 if (iocb->ki_pos != 0)
859 return -ESPIPE;
860
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>

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

853 ssize_t res;
854
855 if (file->f_flags & O_NONBLOCK)
856 msg.msg_flags = MSG_DONTWAIT;
857
858 if (iocb->ki_pos != 0)
859 return -ESPIPE;
860
861 if (iocb->ki_nbytes == 0) /* Match SYS5 behaviour */
861 if (!iov_iter_count(to)) /* Match SYS5 behaviour */
862 return 0;
863
864 res = __sock_recvmsg(iocb, sock, &msg,
862 return 0;
863
864 res = __sock_recvmsg(iocb, sock, &msg,
865 iocb->ki_nbytes, msg.msg_flags);
865 iov_iter_count(to), msg.msg_flags);
866 *to = msg.msg_iter;
867 return res;
868}
869
870static ssize_t sock_write_iter(struct kiocb *iocb, struct iov_iter *from)
871{
872 struct file *file = iocb->ki_filp;
873 struct socket *sock = file->private_data;

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

878 return -ESPIPE;
879
880 if (file->f_flags & O_NONBLOCK)
881 msg.msg_flags = MSG_DONTWAIT;
882
883 if (sock->type == SOCK_SEQPACKET)
884 msg.msg_flags |= MSG_EOR;
885
866 *to = msg.msg_iter;
867 return res;
868}
869
870static ssize_t sock_write_iter(struct kiocb *iocb, struct iov_iter *from)
871{
872 struct file *file = iocb->ki_filp;
873 struct socket *sock = file->private_data;

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

878 return -ESPIPE;
879
880 if (file->f_flags & O_NONBLOCK)
881 msg.msg_flags = MSG_DONTWAIT;
882
883 if (sock->type == SOCK_SEQPACKET)
884 msg.msg_flags |= MSG_EOR;
885
886 res = __sock_sendmsg(iocb, sock, &msg, iocb->ki_nbytes);
886 res = __sock_sendmsg(iocb, sock, &msg, iov_iter_count(from));
887 *from = msg.msg_iter;
888 return res;
889}
890
891/*
892 * Atomic setting of ioctl hooks to avoid race
893 * with module unload.
894 */

--- 2484 unchanged lines hidden ---
887 *from = msg.msg_iter;
888 return res;
889}
890
891/*
892 * Atomic setting of ioctl hooks to avoid race
893 * with module unload.
894 */

--- 2484 unchanged lines hidden ---