aboutsummaryrefslogtreecommitdiffstats
path: root/net/socket.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-03-29 19:58:22 -0500
committerJeff Garzik <jeff@garzik.org>2006-03-29 19:58:22 -0500
commit79072f38909e3d9883317238887460c39ddcc4cb (patch)
tree28369f5a844535ff836565eefd62695b0e890fa3 /net/socket.c
parent200d5a7684cc49ef4be40e832daf3f217e70dfbb (diff)
parent55d8ca4f8094246da6e71889a4e04bfafaa78b10 (diff)
Merge branch 'upstream'
Diffstat (limited to 'net/socket.c')
-rw-r--r--net/socket.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/net/socket.c b/net/socket.c
index e3c21d5ec288..fcd77eac0ccf 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -107,6 +107,10 @@ static unsigned int sock_poll(struct file *file,
107 struct poll_table_struct *wait); 107 struct poll_table_struct *wait);
108static long sock_ioctl(struct file *file, 108static long sock_ioctl(struct file *file,
109 unsigned int cmd, unsigned long arg); 109 unsigned int cmd, unsigned long arg);
110#ifdef CONFIG_COMPAT
111static long compat_sock_ioctl(struct file *file,
112 unsigned int cmd, unsigned long arg);
113#endif
110static int sock_fasync(int fd, struct file *filp, int on); 114static int sock_fasync(int fd, struct file *filp, int on);
111static ssize_t sock_readv(struct file *file, const struct iovec *vector, 115static ssize_t sock_readv(struct file *file, const struct iovec *vector,
112 unsigned long count, loff_t *ppos); 116 unsigned long count, loff_t *ppos);
@@ -128,6 +132,9 @@ static struct file_operations socket_file_ops = {
128 .aio_write = sock_aio_write, 132 .aio_write = sock_aio_write,
129 .poll = sock_poll, 133 .poll = sock_poll,
130 .unlocked_ioctl = sock_ioctl, 134 .unlocked_ioctl = sock_ioctl,
135#ifdef CONFIG_COMPAT
136 .compat_ioctl = compat_sock_ioctl,
137#endif
131 .mmap = sock_mmap, 138 .mmap = sock_mmap,
132 .open = sock_no_open, /* special open code to disallow open via /proc */ 139 .open = sock_no_open, /* special open code to disallow open via /proc */
133 .release = sock_close, 140 .release = sock_close,
@@ -312,7 +319,8 @@ static int init_inodecache(void)
312{ 319{
313 sock_inode_cachep = kmem_cache_create("sock_inode_cache", 320 sock_inode_cachep = kmem_cache_create("sock_inode_cache",
314 sizeof(struct socket_alloc), 321 sizeof(struct socket_alloc),
315 0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT, 322 0, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
323 SLAB_MEM_SPREAD),
316 init_once, NULL); 324 init_once, NULL);
317 if (sock_inode_cachep == NULL) 325 if (sock_inode_cachep == NULL)
318 return -ENOMEM; 326 return -ENOMEM;
@@ -531,7 +539,7 @@ static int sock_no_open(struct inode *irrelevant, struct file *dontcare)
531 return -ENXIO; 539 return -ENXIO;
532} 540}
533 541
534struct file_operations bad_sock_fops = { 542const struct file_operations bad_sock_fops = {
535 .owner = THIS_MODULE, 543 .owner = THIS_MODULE,
536 .open = sock_no_open, 544 .open = sock_no_open,
537}; 545};
@@ -2136,6 +2144,20 @@ void socket_seq_show(struct seq_file *seq)
2136} 2144}
2137#endif /* CONFIG_PROC_FS */ 2145#endif /* CONFIG_PROC_FS */
2138 2146
2147#ifdef CONFIG_COMPAT
2148static long compat_sock_ioctl(struct file *file, unsigned cmd,
2149 unsigned long arg)
2150{
2151 struct socket *sock = file->private_data;
2152 int ret = -ENOIOCTLCMD;
2153
2154 if (sock->ops->compat_ioctl)
2155 ret = sock->ops->compat_ioctl(sock, cmd, arg);
2156
2157 return ret;
2158}
2159#endif
2160
2139/* ABI emulation layers need these two */ 2161/* ABI emulation layers need these two */
2140EXPORT_SYMBOL(move_addr_to_kernel); 2162EXPORT_SYMBOL(move_addr_to_kernel);
2141EXPORT_SYMBOL(move_addr_to_user); 2163EXPORT_SYMBOL(move_addr_to_user);