patch-2.2.4 linux/net/socket.c

Next file: linux/net/sunrpc/auth.c
Previous file: linux/net/sched/sch_teql.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.3/linux/net/socket.c linux/net/socket.c
@@ -41,6 +41,7 @@
  *		Kevin Buhr	:	Fixed the dumb errors in the above.
  *		Andi Kleen	:	Some small cleanups, optimizations,
  *					and fixed a copy_from_user() bug.
+ *		Tigran Aivazian	:	sys_send(args) calls sys_sendto(args, NULL, 0)
  *
  *
  *		This program is free software; you can redistribute it and/or
@@ -929,40 +930,6 @@
 }
 
 /*
- *	Send a datagram down a socket. The datagram as with write() is
- *	in user space. We check it can be read.
- */
-
-asmlinkage int sys_send(int fd, void * buff, size_t len, unsigned flags)
-{
-	struct socket *sock;
-	int err;
-	struct msghdr msg;
-	struct iovec iov;
-
-	lock_kernel();
-	sock = sockfd_lookup(fd, &err);
-	if (sock) {
-		iov.iov_base=buff;
-		iov.iov_len=len;
-		msg.msg_name=NULL;
-		msg.msg_namelen=0;
-		msg.msg_iov=&iov;
-		msg.msg_iovlen=1;
-		msg.msg_control=NULL;
-		msg.msg_controllen=0;
-		if (sock->file->f_flags & O_NONBLOCK)
-			flags |= MSG_DONTWAIT;
-		msg.msg_flags = flags;
-		err = sock_sendmsg(sock, &msg, len);
-
-		sockfd_put(sock);
-	}
-	unlock_kernel();
-	return err;
-}
-
-/*
  *	Send a datagram to a given address. We move the address into kernel
  *	space and check the user space data area is readable before invoking
  *	the protocol.
@@ -1008,6 +975,14 @@
 	return err;
 }
 
+/*
+ *	Send a datagram down a socket. 
+ */
+
+asmlinkage int sys_send(int fd, void * buff, size_t len, unsigned flags)
+{
+	return sys_sendto(fd, buff, len, flags, NULL, 0);
+}
 
 /*
  *	Receive a frame from the socket and optionally record the address of the 
@@ -1059,7 +1034,7 @@
 
 asmlinkage int sys_recv(int fd, void * ubuf, size_t size, unsigned flags)
 {
-	return sys_recvfrom(fd,ubuf,size,flags, NULL, NULL);
+	return sys_recvfrom(fd, ubuf, size, flags, NULL, NULL);
 }
 
 /*

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)