sock.c (1f782fee18b39b9ad438ebbd82c2915a16c879ee) sock.c (f845172531fb7410c7fb7780b1a6e51ee6df7d52)
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Generic socket support routines. Memory allocators, socket lock/release
7 * handler for protocols to use and generic option handler.
8 *

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

118#include <net/protocol.h>
119#include <linux/skbuff.h>
120#include <net/net_namespace.h>
121#include <net/request_sock.h>
122#include <net/sock.h>
123#include <linux/net_tstamp.h>
124#include <net/xfrm.h>
125#include <linux/ipsec.h>
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Generic socket support routines. Memory allocators, socket lock/release
7 * handler for protocols to use and generic option handler.
8 *

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

118#include <net/protocol.h>
119#include <linux/skbuff.h>
120#include <net/net_namespace.h>
121#include <net/request_sock.h>
122#include <net/sock.h>
123#include <linux/net_tstamp.h>
124#include <net/xfrm.h>
125#include <linux/ipsec.h>
126#include <net/cls_cgroup.h>
126
127#include <linux/filter.h>
128
129#ifdef CONFIG_INET
130#include <net/tcp.h>
131#endif
132
133/*

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

212__u32 sysctl_rmem_max __read_mostly = SK_RMEM_MAX;
213__u32 sysctl_wmem_default __read_mostly = SK_WMEM_MAX;
214__u32 sysctl_rmem_default __read_mostly = SK_RMEM_MAX;
215
216/* Maximal space eaten by iovec or ancilliary data plus some space */
217int sysctl_optmem_max __read_mostly = sizeof(unsigned long)*(2*UIO_MAXIOV+512);
218EXPORT_SYMBOL(sysctl_optmem_max);
219
127
128#include <linux/filter.h>
129
130#ifdef CONFIG_INET
131#include <net/tcp.h>
132#endif
133
134/*

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

213__u32 sysctl_rmem_max __read_mostly = SK_RMEM_MAX;
214__u32 sysctl_wmem_default __read_mostly = SK_WMEM_MAX;
215__u32 sysctl_rmem_default __read_mostly = SK_RMEM_MAX;
216
217/* Maximal space eaten by iovec or ancilliary data plus some space */
218int sysctl_optmem_max __read_mostly = sizeof(unsigned long)*(2*UIO_MAXIOV+512);
219EXPORT_SYMBOL(sysctl_optmem_max);
220
221#if defined(CONFIG_CGROUPS) && !defined(CONFIG_NET_CLS_CGROUP)
222int net_cls_subsys_id = -1;
223EXPORT_SYMBOL_GPL(net_cls_subsys_id);
224#endif
225
220static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen)
221{
222 struct timeval tv;
223
224 if (optlen < sizeof(tv))
225 return -EINVAL;
226 if (copy_from_user(&tv, optval, sizeof(tv)))
227 return -EFAULT;

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

1045 security_sk_free(sk);
1046 if (slab != NULL)
1047 kmem_cache_free(slab, sk);
1048 else
1049 kfree(sk);
1050 module_put(owner);
1051}
1052
226static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen)
227{
228 struct timeval tv;
229
230 if (optlen < sizeof(tv))
231 return -EINVAL;
232 if (copy_from_user(&tv, optval, sizeof(tv)))
233 return -EFAULT;

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

1051 security_sk_free(sk);
1052 if (slab != NULL)
1053 kmem_cache_free(slab, sk);
1054 else
1055 kfree(sk);
1056 module_put(owner);
1057}
1058
1059#ifdef CONFIG_CGROUPS
1060void sock_update_classid(struct sock *sk)
1061{
1062 u32 classid = task_cls_classid(current);
1063
1064 if (classid && classid != sk->sk_classid)
1065 sk->sk_classid = classid;
1066}
1067#endif
1068
1053/**
1054 * sk_alloc - All socket objects are allocated here
1055 * @net: the applicable net namespace
1056 * @family: protocol family
1057 * @priority: for allocation (%GFP_KERNEL, %GFP_ATOMIC, etc)
1058 * @prot: struct proto associated with this new sock instance
1059 */
1060struct sock *sk_alloc(struct net *net, int family, gfp_t priority,

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

1068 /*
1069 * See comment in struct sock definition to understand
1070 * why we need sk_prot_creator -acme
1071 */
1072 sk->sk_prot = sk->sk_prot_creator = prot;
1073 sock_lock_init(sk);
1074 sock_net_set(sk, get_net(net));
1075 atomic_set(&sk->sk_wmem_alloc, 1);
1069/**
1070 * sk_alloc - All socket objects are allocated here
1071 * @net: the applicable net namespace
1072 * @family: protocol family
1073 * @priority: for allocation (%GFP_KERNEL, %GFP_ATOMIC, etc)
1074 * @prot: struct proto associated with this new sock instance
1075 */
1076struct sock *sk_alloc(struct net *net, int family, gfp_t priority,

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

1084 /*
1085 * See comment in struct sock definition to understand
1086 * why we need sk_prot_creator -acme
1087 */
1088 sk->sk_prot = sk->sk_prot_creator = prot;
1089 sock_lock_init(sk);
1090 sock_net_set(sk, get_net(net));
1091 atomic_set(&sk->sk_wmem_alloc, 1);
1092
1093 sock_update_classid(sk);
1076 }
1077
1078 return sk;
1079}
1080EXPORT_SYMBOL(sk_alloc);
1081
1082static void __sk_free(struct sock *sk)
1083{

--- 1388 unchanged lines hidden ---
1094 }
1095
1096 return sk;
1097}
1098EXPORT_SYMBOL(sk_alloc);
1099
1100static void __sk_free(struct sock *sk)
1101{

--- 1388 unchanged lines hidden ---