patch-2.4.4 linux/net/socket.c
Next file: linux/net/sunrpc/clnt.c
Previous file: linux/net/rose/rose_dev.c
Back to the patch index
Back to the overall index
- Lines: 64
- Date:
Wed Apr 25 16:13:50 2001
- Orig file:
v2.4.3/linux/net/socket.c
- Orig date:
Fri Nov 17 11:36:27 2000
diff -u --recursive --new-file v2.4.3/linux/net/socket.c linux/net/socket.c
@@ -71,6 +71,7 @@
#include <linux/poll.h>
#include <linux/cache.h>
#include <linux/module.h>
+#include <linux/highmem.h>
#if defined(CONFIG_KMOD) && defined(CONFIG_NET)
#include <linux/kmod.h>
@@ -104,6 +105,8 @@
unsigned long count, loff_t *ppos);
static ssize_t sock_writev(struct file *file, const struct iovec *vector,
unsigned long count, loff_t *ppos);
+static ssize_t sock_sendpage(struct file *file, struct page *page,
+ int offset, size_t size, loff_t *ppos, int more);
/*
@@ -122,7 +125,8 @@
release: sock_close,
fasync: sock_fasync,
readv: sock_readv,
- writev: sock_writev
+ writev: sock_writev,
+ sendpage: sock_sendpage
};
/*
@@ -602,6 +606,24 @@
return sock_sendmsg(sock, &msg, size);
}
+ssize_t sock_sendpage(struct file *file, struct page *page,
+ int offset, size_t size, loff_t *ppos, int more)
+{
+ struct socket *sock;
+ int flags;
+
+ if (ppos != &file->f_pos)
+ return -ESPIPE;
+
+ sock = socki_lookup(file->f_dentry->d_inode);
+
+ flags = !(file->f_flags & O_NONBLOCK) ? 0 : MSG_DONTWAIT;
+ if (more)
+ flags |= MSG_MORE;
+
+ return sock->ops->sendpage(sock, page, offset, size, flags);
+}
+
int sock_readv_writev(int type, struct inode * inode, struct file * file,
const struct iovec * iov, long count, long size)
{
@@ -1269,7 +1291,10 @@
{
int err;
struct socket *sock;
-
+
+ if (optlen < 0)
+ return -EINVAL;
+
if ((sock = sockfd_lookup(fd, &err))!=NULL)
{
if (level == SOL_SOCKET)
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)