Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
sock.h File Reference
#include <linux/hardirq.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/list_nulls.h>
#include <linux/timer.h>
#include <linux/cache.h>
#include <linux/bitops.h>
#include <linux/lockdep.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <linux/mm.h>
#include <linux/security.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/memcontrol.h>
#include <linux/res_counter.h>
#include <linux/static_key.h>
#include <linux/aio.h>
#include <linux/sched.h>
#include <linux/filter.h>
#include <linux/rculist_nulls.h>
#include <linux/poll.h>
#include <linux/atomic.h>
#include <net/dst.h>
#include <net/checksum.h>

Go to the source code of this file.

Data Structures

struct  socket_lock_t
 
struct  sock_common
 
struct  sock
 
struct  proto
 
struct  cg_proto
 
struct  sock_iocb
 
struct  socket_alloc
 

Macros

#define SOCK_DEBUGGING
 
#define SOCK_DEBUG(sk, msg...)
 
#define sk_node   __sk_common.skc_node
 
#define sk_nulls_node   __sk_common.skc_nulls_node
 
#define sk_refcnt   __sk_common.skc_refcnt
 
#define sk_tx_queue_mapping   __sk_common.skc_tx_queue_mapping
 
#define sk_dontcopy_begin   __sk_common.skc_dontcopy_begin
 
#define sk_dontcopy_end   __sk_common.skc_dontcopy_end
 
#define sk_hash   __sk_common.skc_hash
 
#define sk_family   __sk_common.skc_family
 
#define sk_state   __sk_common.skc_state
 
#define sk_reuse   __sk_common.skc_reuse
 
#define sk_bound_dev_if   __sk_common.skc_bound_dev_if
 
#define sk_bind_node   __sk_common.skc_bind_node
 
#define sk_prot   __sk_common.skc_prot
 
#define sk_net   __sk_common.skc_net
 
#define sk_rmem_alloc   sk_backlog.rmem_alloc
 
#define SK_NO_REUSE   0
 
#define SK_CAN_REUSE   1
 
#define SK_FORCE_REUSE   2
 
#define sk_del_node_init_rcu(sk)   sk_del_node_init(sk)
 
#define sk_for_each(__sk, node, list)   hlist_for_each_entry(__sk, node, list, sk_node)
 
#define sk_for_each_rcu(__sk, node, list)   hlist_for_each_entry_rcu(__sk, node, list, sk_node)
 
#define sk_nulls_for_each(__sk, node, list)   hlist_nulls_for_each_entry(__sk, node, list, sk_nulls_node)
 
#define sk_nulls_for_each_rcu(__sk, node, list)   hlist_nulls_for_each_entry_rcu(__sk, node, list, sk_nulls_node)
 
#define sk_for_each_from(__sk, node)
 
#define sk_nulls_for_each_from(__sk, node)
 
#define sk_for_each_safe(__sk, node, tmp, list)   hlist_for_each_entry_safe(__sk, node, tmp, list, sk_node)
 
#define sk_for_each_bound(__sk, node, list)   hlist_for_each_entry(__sk, node, list, sk_bind_node)
 
#define sk_wait_event(__sk, __timeo, __condition)
 
#define sk_refcnt_debug_inc(sk)   do { } while (0)
 
#define sk_refcnt_debug_dec(sk)   do { } while (0)
 
#define sk_refcnt_debug_release(sk)   do { } while (0)
 
#define mem_cgroup_sockets_enabled   0
 
#define SOCK_DESTROY_TIME   (10*HZ)
 
#define PROT_SOCK   1024
 
#define SHUTDOWN_MASK   3
 
#define RCV_SHUTDOWN   1
 
#define SEND_SHUTDOWN   2
 
#define SOCK_SNDBUF_LOCK   1
 
#define SOCK_RCVBUF_LOCK   2
 
#define SOCK_BINDADDR_LOCK   4
 
#define SOCK_BINDPORT_LOCK   8
 
#define SK_MEM_QUANTUM   ((int)PAGE_SIZE)
 
#define SK_MEM_QUANTUM_SHIFT   ilog2(SK_MEM_QUANTUM)
 
#define SK_MEM_SEND   0
 
#define SK_MEM_RECV   1
 
#define sock_owned_by_user(sk)   ((sk)->sk_lock.owned)
 
#define sock_lock_init_class_and_name(sk, sname, skey, name, key)
 
#define bh_lock_sock(__sk)   spin_lock(&((__sk)->sk_lock.slock))
 
#define bh_lock_sock_nested(__sk)
 
#define bh_unlock_sock(__sk)   spin_unlock(&((__sk)->sk_lock.slock))
 
#define SOCK_MIN_SNDBUF   2048
 
#define SOCK_MIN_RCVBUF   (2048 + sizeof(struct sk_buff))
 
#define FLAGS_TS_OR_DROPS
 
#define NETDEBUG(fmt, args...)   do { if (net_msg_warn) printk(fmt,##args); } while (0)
 
#define LIMIT_NETDEBUG(fmt, args...)   do { if (net_msg_warn && net_ratelimit()) printk(fmt,##args); } while(0)
 

Enumerations

enum  sock_flags {
  SOCK_DEAD, SOCK_DONE, SOCK_URGINLINE, SOCK_KEEPOPEN,
  SOCK_LINGER, SOCK_DESTROY, SOCK_BROADCAST, SOCK_TIMESTAMP,
  SOCK_ZAPPED, SOCK_USE_WRITE_QUEUE, SOCK_DBG, SOCK_RCVTSTAMP,
  SOCK_RCVTSTAMPNS, SOCK_LOCALROUTE, SOCK_QUEUE_SHRUNK, SOCK_MEMALLOC,
  SOCK_TIMESTAMPING_TX_HARDWARE, SOCK_TIMESTAMPING_TX_SOFTWARE, SOCK_TIMESTAMPING_RX_HARDWARE, SOCK_TIMESTAMPING_RX_SOFTWARE,
  SOCK_TIMESTAMPING_SOFTWARE, SOCK_TIMESTAMPING_RAW_HARDWARE, SOCK_TIMESTAMPING_SYS_HARDWARE, SOCK_FASYNC,
  SOCK_RXQ_OVFL, SOCK_ZEROCOPY, SOCK_WIFI_STATUS, SOCK_NOFCS
}
 
enum  cg_proto_flags { MEMCG_SOCK_ACTIVE, MEMCG_SOCK_ACTIVATED }
 

Functions

void sk_stream_write_space (struct sock *sk)
 
int __sk_backlog_rcv (struct sock *sk, struct sk_buff *skb)
 
int sk_stream_wait_connect (struct sock *sk, long *timeo_p)
 
int sk_stream_wait_memory (struct sock *sk, long *timeo_p)
 
void sk_stream_wait_close (struct sock *sk, long timeo_p)
 
int sk_stream_error (struct sock *sk, int flags, int err)
 
void sk_stream_kill_queues (struct sock *sk)
 
void sk_set_memalloc (struct sock *sk)
 
void sk_clear_memalloc (struct sock *sk)
 
int sk_wait_data (struct sock *sk, long *timeo)
 
int proto_register (struct proto *prot, int alloc_slab)
 
void proto_unregister (struct proto *prot)
 
void sk_prot_clear_portaddr_nulls (struct sock *sk, int size)
 
int __sk_mem_schedule (struct sock *sk, int size, int kind)
 
void __sk_mem_reclaim (struct sock *sk)
 
void lock_sock_nested (struct sock *sk, int subclass)
 
void release_sock (struct sock *sk)
 
bool lock_sock_fast (struct sock *sk)
 
struct socksk_alloc (struct net *net, int family, gfp_t priority, struct proto *prot)
 
void sk_free (struct sock *sk)
 
void sk_release_kernel (struct sock *sk)
 
struct socksk_clone_lock (const struct sock *sk, const gfp_t priority)
 
struct sk_buffsock_wmalloc (struct sock *sk, unsigned long size, int force, gfp_t priority)
 
struct sk_buffsock_rmalloc (struct sock *sk, unsigned long size, int force, gfp_t priority)
 
void sock_wfree (struct sk_buff *skb)
 
void sock_rfree (struct sk_buff *skb)
 
void sock_edemux (struct sk_buff *skb)
 
int sock_setsockopt (struct socket *sock, int level, int op, char __user *optval, unsigned int optlen)
 
int sock_getsockopt (struct socket *sock, int level, int op, char __user *optval, int __user *optlen)
 
struct sk_buffsock_alloc_send_skb (struct sock *sk, unsigned long size, int noblock, int *errcode)
 
struct sk_buffsock_alloc_send_pskb (struct sock *sk, unsigned long header_len, unsigned long data_len, int noblock, int *errcode)
 
voidsock_kmalloc (struct sock *sk, int size, gfp_t priority)
 
void sock_kfree_s (struct sock *sk, void *mem, int size)
 
void sk_send_sigurg (struct sock *sk)
 
int sock_no_bind (struct socket *, struct sockaddr *, int)
 
int sock_no_connect (struct socket *, struct sockaddr *, int, int)
 
int sock_no_socketpair (struct socket *, struct socket *)
 
int sock_no_accept (struct socket *, struct socket *, int)
 
int sock_no_getname (struct socket *, struct sockaddr *, int *, int)
 
unsigned int sock_no_poll (struct file *, struct socket *, struct poll_table_struct *)
 
int sock_no_ioctl (struct socket *, unsigned int, unsigned long)
 
int sock_no_listen (struct socket *, int)
 
int sock_no_shutdown (struct socket *, int)
 
int sock_no_getsockopt (struct socket *, int, int, char __user *, int __user *)
 
int sock_no_setsockopt (struct socket *, int, int, char __user *, unsigned int)
 
int sock_no_sendmsg (struct kiocb *, struct socket *, struct msghdr *, size_t)
 
int sock_no_recvmsg (struct kiocb *, struct socket *, struct msghdr *, size_t, int)
 
int sock_no_mmap (struct file *file, struct socket *sock, struct vm_area_struct *vma)
 
ssize_t sock_no_sendpage (struct socket *sock, struct page *page, int offset, size_t size, int flags)
 
int sock_common_getsockopt (struct socket *sock, int level, int optname, char __user *optval, int __user *optlen)
 
int sock_common_recvmsg (struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t size, int flags)
 
int sock_common_setsockopt (struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen)
 
int compat_sock_common_getsockopt (struct socket *sock, int level, int optname, char __user *optval, int __user *optlen)
 
int compat_sock_common_setsockopt (struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen)
 
void sk_common_release (struct sock *sk)
 
void sock_init_data (struct socket *sock, struct sock *sk)
 
void sk_filter_release_rcu (struct rcu_head *rcu)
 
int sk_receive_skb (struct sock *sk, struct sk_buff *skb, const int nested)
 
kuid_t sock_i_uid (struct sock *sk)
 
unsigned long sock_i_ino (struct sock *sk)
 
void sk_reset_txq (struct sock *sk)
 
struct dst_entry__sk_dst_check (struct sock *sk, u32 cookie)
 
struct dst_entrysk_dst_check (struct sock *sk, u32 cookie)
 
void sk_setup_caps (struct sock *sk, struct dst_entry *dst)
 
void sk_reset_timer (struct sock *sk, struct timer_list *timer, unsigned long expires)
 
void sk_stop_timer (struct sock *sk, struct timer_list *timer)
 
int sock_queue_rcv_skb (struct sock *sk, struct sk_buff *skb)
 
int sock_queue_err_skb (struct sock *sk, struct sk_buff *skb)
 
struct sk_buffsk_stream_alloc_skb (struct sock *sk, int size, gfp_t gfp)
 
bool sk_page_frag_refill (struct sock *sk, struct page_frag *pfrag)
 
void __sock_recv_timestamp (struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
 
void __sock_recv_wifi_status (struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
 
void __sock_recv_ts_and_drops (struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
 
int sock_tx_timestamp (struct sock *sk, __u8 *tx_flags)
 
void sock_enable_timestamp (struct sock *sk, int flag)
 
int sock_get_timestamp (struct sock *, struct timeval __user *)
 
int sock_get_timestampns (struct sock *, struct timespec __user *)
 

Variables

int net_msg_warn
 
__u32 sysctl_wmem_max
 
__u32 sysctl_rmem_max
 
int sysctl_optmem_max
 
__u32 sysctl_wmem_default
 
__u32 sysctl_rmem_default
 

Macro Definition Documentation

#define bh_lock_sock (   __sk)    spin_lock(&((__sk)->sk_lock.slock))

Definition at line 1433 of file sock.h.

#define bh_lock_sock_nested (   __sk)
Value:
spin_lock_nested(&((__sk)->sk_lock.slock), \

Definition at line 1434 of file sock.h.

#define bh_unlock_sock (   __sk)    spin_unlock(&((__sk)->sk_lock.slock))

Definition at line 1437 of file sock.h.

#define FLAGS_TS_OR_DROPS
#define LIMIT_NETDEBUG (   fmt,
  args... 
)    do { if (net_msg_warn && net_ratelimit()) printk(fmt,##args); } while(0)

Definition at line 2218 of file sock.h.

#define mem_cgroup_sockets_enabled   0

Definition at line 1043 of file sock.h.

#define NETDEBUG (   fmt,
  args... 
)    do { if (net_msg_warn) printk(fmt,##args); } while (0)

Definition at line 2215 of file sock.h.

#define PROT_SOCK   1024

Definition at line 1262 of file sock.h.

#define RCV_SHUTDOWN   1

Definition at line 1265 of file sock.h.

#define SEND_SHUTDOWN   2

Definition at line 1266 of file sock.h.

#define SHUTDOWN_MASK   3

Definition at line 1264 of file sock.h.

#define sk_bind_node   __sk_common.skc_bind_node

Definition at line 283 of file sock.h.

#define sk_bound_dev_if   __sk_common.skc_bound_dev_if

Definition at line 282 of file sock.h.

#define SK_CAN_REUSE   1

Definition at line 391 of file sock.h.

#define sk_del_node_init_rcu (   sk)    sk_del_node_init(sk)

Definition at line 526 of file sock.h.

#define sk_dontcopy_begin   __sk_common.skc_dontcopy_begin

Definition at line 276 of file sock.h.

#define sk_dontcopy_end   __sk_common.skc_dontcopy_end

Definition at line 277 of file sock.h.

#define sk_family   __sk_common.skc_family

Definition at line 279 of file sock.h.

#define sk_for_each (   __sk,
  node,
  list 
)    hlist_for_each_entry(__sk, node, list, sk_node)

Definition at line 588 of file sock.h.

#define sk_for_each_bound (   __sk,
  node,
  list 
)    hlist_for_each_entry(__sk, node, list, sk_bind_node)

Definition at line 604 of file sock.h.

#define sk_for_each_from (   __sk,
  node 
)
Value:
if (__sk && ({ node = &(__sk)->sk_node; 1; })) \
hlist_for_each_entry_from(__sk, node, sk_node)

Definition at line 596 of file sock.h.

#define sk_for_each_rcu (   __sk,
  node,
  list 
)    hlist_for_each_entry_rcu(__sk, node, list, sk_node)

Definition at line 590 of file sock.h.

#define sk_for_each_safe (   __sk,
  node,
  tmp,
  list 
)    hlist_for_each_entry_safe(__sk, node, tmp, list, sk_node)

Definition at line 602 of file sock.h.

#define SK_FORCE_REUSE   2

Definition at line 392 of file sock.h.

#define sk_hash   __sk_common.skc_hash

Definition at line 278 of file sock.h.

#define SK_MEM_QUANTUM   ((int)PAGE_SIZE)

Definition at line 1317 of file sock.h.

#define SK_MEM_QUANTUM_SHIFT   ilog2(SK_MEM_QUANTUM)

Definition at line 1318 of file sock.h.

#define SK_MEM_RECV   1

Definition at line 1320 of file sock.h.

#define SK_MEM_SEND   0

Definition at line 1319 of file sock.h.

#define sk_net   __sk_common.skc_net

Definition at line 285 of file sock.h.

#define SK_NO_REUSE   0

Definition at line 390 of file sock.h.

#define sk_node   __sk_common.skc_node

Definition at line 271 of file sock.h.

#define sk_nulls_for_each (   __sk,
  node,
  list 
)    hlist_nulls_for_each_entry(__sk, node, list, sk_nulls_node)

Definition at line 592 of file sock.h.

#define sk_nulls_for_each_from (   __sk,
  node 
)
Value:
if (__sk && ({ node = &(__sk)->sk_nulls_node; 1; })) \
hlist_nulls_for_each_entry_from(__sk, node, sk_nulls_node)

Definition at line 599 of file sock.h.

#define sk_nulls_for_each_rcu (   __sk,
  node,
  list 
)    hlist_nulls_for_each_entry_rcu(__sk, node, list, sk_nulls_node)

Definition at line 594 of file sock.h.

#define sk_nulls_node   __sk_common.skc_nulls_node

Definition at line 272 of file sock.h.

#define sk_prot   __sk_common.skc_prot

Definition at line 284 of file sock.h.

#define sk_refcnt   __sk_common.skc_refcnt

Definition at line 273 of file sock.h.

#define sk_refcnt_debug_dec (   sk)    do { } while (0)

Definition at line 1030 of file sock.h.

#define sk_refcnt_debug_inc (   sk)    do { } while (0)

Definition at line 1029 of file sock.h.

#define sk_refcnt_debug_release (   sk)    do { } while (0)

Definition at line 1031 of file sock.h.

#define sk_reuse   __sk_common.skc_reuse

Definition at line 281 of file sock.h.

#define sk_rmem_alloc   sk_backlog.rmem_alloc

Definition at line 302 of file sock.h.

#define sk_state   __sk_common.skc_state

Definition at line 280 of file sock.h.

#define sk_tx_queue_mapping   __sk_common.skc_tx_queue_mapping

Definition at line 274 of file sock.h.

#define sk_wait_event (   __sk,
  __timeo,
  __condition 
)
Value:
({ int __rc; \
release_sock(__sk); \
__rc = __condition; \
if (!__rc) { \
*(__timeo) = schedule_timeout(*(__timeo)); \
} \
lock_sock(__sk); \
__rc = __condition; \
__rc; \
})

Definition at line 819 of file sock.h.

#define SOCK_BINDADDR_LOCK   4

Definition at line 1270 of file sock.h.

#define SOCK_BINDPORT_LOCK   8

Definition at line 1271 of file sock.h.

#define SOCK_DEBUG (   sk,
  msg... 
)
Value:
do { if ((sk) && sock_flag((sk), SOCK_DBG)) \
printk(KERN_DEBUG msg); } while (0)

Definition at line 96 of file sock.h.

#define SOCK_DEBUGGING

Definition at line 94 of file sock.h.

#define SOCK_DESTROY_TIME   (10*HZ)

Definition at line 1259 of file sock.h.

#define sock_lock_init_class_and_name (   sk,
  sname,
  skey,
  name,
  key 
)
Value:
do { \
sk->sk_lock.owned = 0; \
init_waitqueue_head(&sk->sk_lock.wq); \
spin_lock_init(&(sk)->sk_lock.slock); \
debug_check_no_locks_freed((void *)&(sk)->sk_lock, \
sizeof((sk)->sk_lock)); \
lockdep_set_class_and_name(&(sk)->sk_lock.slock, \
(skey), (sname)); \
lockdep_init_map(&(sk)->sk_lock.dep_map, (name), (key), 0); \
} while (0)

Definition at line 1411 of file sock.h.

#define SOCK_MIN_RCVBUF   (2048 + sizeof(struct sk_buff))

Definition at line 2015 of file sock.h.

#define SOCK_MIN_SNDBUF   2048

Definition at line 2010 of file sock.h.

#define sock_owned_by_user (   sk)    ((sk)->sk_lock.owned)

Definition at line 1402 of file sock.h.

#define SOCK_RCVBUF_LOCK   2

Definition at line 1269 of file sock.h.

#define SOCK_SNDBUF_LOCK   1

Definition at line 1268 of file sock.h.

Enumeration Type Documentation

Enumerator:
MEMCG_SOCK_ACTIVE 
MEMCG_SOCK_ACTIVATED 

Definition at line 970 of file sock.h.

enum sock_flags
Enumerator:
SOCK_DEAD 
SOCK_DONE 
SOCK_URGINLINE 
SOCK_KEEPOPEN 
SOCK_LINGER 
SOCK_DESTROY 
SOCK_BROADCAST 
SOCK_TIMESTAMP 
SOCK_ZAPPED 
SOCK_USE_WRITE_QUEUE 
SOCK_DBG 
SOCK_RCVTSTAMP 
SOCK_RCVTSTAMPNS 
SOCK_LOCALROUTE 
SOCK_QUEUE_SHRUNK 
SOCK_MEMALLOC 
SOCK_TIMESTAMPING_TX_HARDWARE 
SOCK_TIMESTAMPING_TX_SOFTWARE 
SOCK_TIMESTAMPING_RX_HARDWARE 
SOCK_TIMESTAMPING_RX_SOFTWARE 
SOCK_TIMESTAMPING_SOFTWARE 
SOCK_TIMESTAMPING_RAW_HARDWARE 
SOCK_TIMESTAMPING_SYS_HARDWARE 
SOCK_FASYNC 
SOCK_RXQ_OVFL 
SOCK_ZEROCOPY 
SOCK_WIFI_STATUS 
SOCK_NOFCS 

Definition at line 617 of file sock.h.

Function Documentation

int __sk_backlog_rcv ( struct sock sk,
struct sk_buff skb 
)

Definition at line 313 of file sock.c.

struct dst_entry* __sk_dst_check ( struct sock sk,
u32  cookie 
)
read

Definition at line 479 of file sock.c.

void __sk_mem_reclaim ( struct sock sk)

__sk_reclaim - reclaim memory_allocated : socket

Definition at line 1940 of file sock.c.

int __sk_mem_schedule ( struct sock sk,
int  size,
int  kind 
)

__sk_mem_schedule - increase sk_forward_alloc and memory_allocated : socket : memory size to allocate : allocation type

If kind is SK_MEM_SEND, it means wmem allocation. Otherwise it means rmem allocation. This function assumes that protocols which have memory_pressure use sk_wmem_queued as write buffer accounting.

Definition at line 1858 of file sock.c.

void __sock_recv_timestamp ( struct msghdr msg,
struct sock sk,
struct sk_buff skb 
)

Definition at line 702 of file socket.c.

void __sock_recv_ts_and_drops ( struct msghdr msg,
struct sock sk,
struct sk_buff skb 
)

Definition at line 774 of file socket.c.

void __sock_recv_wifi_status ( struct msghdr msg,
struct sock sk,
struct sk_buff skb 
)

Definition at line 750 of file socket.c.

int compat_sock_common_getsockopt ( struct socket sock,
int  level,
int  optname,
char __user optval,
int __user optlen 
)
int compat_sock_common_setsockopt ( struct socket sock,
int  level,
int  optname,
char __user optval,
unsigned int  optlen 
)
bool lock_sock_fast ( struct sock sk)

lock_sock_fast - fast version of lock_sock : socket

This version should be used for very small section, where process wont block return false if fast path is taken sk_lock.slock locked, owned = 0, BH disabled return true if slow path is taken sk_lock.slock unlocked, owned = 1, BH enabled

Definition at line 2266 of file sock.c.

void lock_sock_nested ( struct sock sk,
int  subclass 
)

Definition at line 2219 of file sock.c.

int proto_register ( struct proto prot,
int  alloc_slab 
)

Definition at line 2551 of file sock.c.

void proto_unregister ( struct proto prot)

Definition at line 2622 of file sock.c.

void release_sock ( struct sock sk)

Definition at line 2235 of file sock.c.

struct sock* sk_alloc ( struct net net,
int  family,
gfp_t  priority,
struct proto prot 
)
read

sk_alloc - All socket objects are allocated here : the applicable net namespace : protocol family : for allocation (GFP_KERNEL, GFP_ATOMIC, etc) : struct proto associated with this new sock instance

Definition at line 1249 of file sock.c.

void sk_clear_memalloc ( struct sock sk)

Definition at line 293 of file sock.c.

struct sock* sk_clone_lock ( const struct sock sk,
const gfp_t  priority 
)
read

sk_clone_lock - clone a socket, and lock its clone : the socket to clone : for allocation (GFP_KERNEL, GFP_ATOMIC, etc)

Caller must unlock socket even in error path (bh_unlock_sock(newsk))

Definition at line 1346 of file sock.c.

void sk_common_release ( struct sock sk)

Definition at line 2408 of file sock.c.

struct dst_entry* sk_dst_check ( struct sock sk,
u32  cookie 
)
read

Definition at line 494 of file sock.c.

void sk_filter_release_rcu ( struct rcu_head rcu)

sk_filter_release_rcu - Release a socket filter by rcu_head : rcu_head that contains the sk_filter to free

Definition at line 622 of file filter.c.

void sk_free ( struct sock sk)

Definition at line 1301 of file sock.c.

bool sk_page_frag_refill ( struct sock sk,
struct page_frag pfrag 
)

Definition at line 1731 of file sock.c.

void sk_prot_clear_portaddr_nulls ( struct sock sk,
int  size 
)

Definition at line 1138 of file sock.c.

int sk_receive_skb ( struct sock sk,
struct sk_buff skb,
const int  nested 
)

Definition at line 431 of file sock.c.

void sk_release_kernel ( struct sock sk)

Definition at line 1320 of file sock.c.

void sk_reset_timer ( struct sock sk,
struct timer_list timer,
unsigned long  expires 
)

Definition at line 2141 of file sock.c.

void sk_reset_txq ( struct sock sk)

Definition at line 473 of file sock.c.

void sk_send_sigurg ( struct sock sk)

Definition at line 2133 of file sock.c.

void sk_set_memalloc ( struct sock sk)

sk_set_memalloc - sets SOCK_MEMALLOC : socket to set it on

Set SOCK_MEMALLOC on a socket for access to emergency reserves. It's the responsibility of the admin to adjust min_free_kbytes to meet the requirements

Definition at line 285 of file sock.c.

void sk_setup_caps ( struct sock sk,
struct dst_entry dst 
)

Definition at line 1442 of file sock.c.

void sk_stop_timer ( struct sock sk,
struct timer_list timer 
)

Definition at line 2149 of file sock.c.

struct sk_buff* sk_stream_alloc_skb ( struct sock sk,
int  size,
gfp_t  gfp 
)
read

Definition at line 760 of file tcp.c.

int sk_stream_error ( struct sock sk,
int  flags,
int  err 
)

Definition at line 176 of file stream.c.

void sk_stream_kill_queues ( struct sock sk)

Definition at line 186 of file stream.c.

void sk_stream_wait_close ( struct sock sk,
long  timeo_p 
)

Definition at line 95 of file stream.c.

int sk_stream_wait_connect ( struct sock sk,
long timeo_p 
)

sk_stream_wait_connect - Wait for a socket to get into the connected state : sock to wait on : for how long to wait

Must be called with the socket locked.

Definition at line 55 of file stream.c.

int sk_stream_wait_memory ( struct sock sk,
long timeo_p 
)

sk_stream_wait_memory - Wait for more memory for a socket : socket to wait for memory : for how long

Definition at line 117 of file stream.c.

void sk_stream_write_space ( struct sock sk)

sk_stream_write_space - stream socket write_space callback. : socket

FIXME: write proper description

Definition at line 28 of file stream.c.

int sk_wait_data ( struct sock sk,
long timeo 
)

sk_wait_data - wait for data to arrive at sk_receive_queue : sock to wait on : for how long

Now socket state including sk->sk_err is changed only under lock, hence we may omit checks after joining wait queue. We check receive queue before schedule() only as optimization; it is very likely that release_sock() added new data.

Definition at line 1834 of file sock.c.

struct sk_buff* sock_alloc_send_pskb ( struct sock sk,
unsigned long  header_len,
unsigned long  data_len,
int  noblock,
int errcode 
)
read

Definition at line 1636 of file sock.c.

struct sk_buff* sock_alloc_send_skb ( struct sock sk,
unsigned long  size,
int  noblock,
int errcode 
)
read

Definition at line 1721 of file sock.c.

int sock_common_getsockopt ( struct socket sock,
int  level,
int  optname,
char __user optval,
int __user optlen 
)

Definition at line 2344 of file sock.c.

int sock_common_recvmsg ( struct kiocb iocb,
struct socket sock,
struct msghdr msg,
size_t  size,
int  flags 
)

Definition at line 2367 of file sock.c.

int sock_common_setsockopt ( struct socket sock,
int  level,
int  optname,
char __user optval,
unsigned int  optlen 
)

Definition at line 2385 of file sock.c.

void sock_edemux ( struct sk_buff skb)

Definition at line 1505 of file sock.c.

void sock_enable_timestamp ( struct sock sk,
int  flag 
)

Definition at line 2321 of file sock.c.

int sock_get_timestamp ( struct sock ,
struct timeval __user  
)

Definition at line 2289 of file sock.c.

int sock_get_timestampns ( struct sock ,
struct timespec __user  
)

Definition at line 2305 of file sock.c.

int sock_getsockopt ( struct socket sock,
int  level,
int  op,
char __user optval,
int __user optlen 
)

Definition at line 867 of file sock.c.

unsigned long sock_i_ino ( struct sock sk)

Definition at line 1529 of file sock.c.

kuid_t sock_i_uid ( struct sock sk)

Definition at line 1518 of file sock.c.

void sock_init_data ( struct socket sock,
struct sock sk 
)

Definition at line 2156 of file sock.c.

void sock_kfree_s ( struct sock sk,
void mem,
int  size 
)

Definition at line 1597 of file sock.c.

void* sock_kmalloc ( struct sock sk,
int  size,
gfp_t  priority 
)

Definition at line 1576 of file sock.c.

int sock_no_accept ( struct socket ,
struct socket ,
int   
)

Definition at line 1979 of file sock.c.

int sock_no_bind ( struct socket ,
struct sockaddr ,
int   
)

Definition at line 1960 of file sock.c.

int sock_no_connect ( struct socket ,
struct sockaddr ,
int  ,
int   
)

Definition at line 1966 of file sock.c.

int sock_no_getname ( struct socket ,
struct sockaddr ,
int ,
int   
)

Definition at line 1985 of file sock.c.

int sock_no_getsockopt ( struct socket ,
int  ,
int  ,
char __user ,
int __user  
)

Definition at line 2023 of file sock.c.

int sock_no_ioctl ( struct socket ,
unsigned  int,
unsigned  long 
)

Definition at line 1998 of file sock.c.

int sock_no_listen ( struct socket ,
int   
)

Definition at line 2004 of file sock.c.

int sock_no_mmap ( struct file file,
struct socket sock,
struct vm_area_struct vma 
)

Definition at line 2044 of file sock.c.

unsigned int sock_no_poll ( struct file ,
struct socket ,
struct poll_table_struct  
)

Definition at line 1992 of file sock.c.

int sock_no_recvmsg ( struct kiocb ,
struct socket ,
struct msghdr ,
size_t  ,
int   
)

Definition at line 2037 of file sock.c.

int sock_no_sendmsg ( struct kiocb ,
struct socket ,
struct msghdr ,
size_t   
)

Definition at line 2030 of file sock.c.

ssize_t sock_no_sendpage ( struct socket sock,
struct page page,
int  offset,
size_t  size,
int  flags 
)

Definition at line 2051 of file sock.c.

int sock_no_setsockopt ( struct socket ,
int  ,
int  ,
char __user ,
unsigned  int 
)

Definition at line 2016 of file sock.c.

int sock_no_shutdown ( struct socket ,
int   
)

Definition at line 2010 of file sock.c.

int sock_no_socketpair ( struct socket ,
struct socket  
)

Definition at line 1973 of file sock.c.

int sock_queue_err_skb ( struct sock sk,
struct sk_buff skb 
)

Definition at line 3263 of file skbuff.c.

int sock_queue_rcv_skb ( struct sock sk,
struct sk_buff skb 
)

Definition at line 383 of file sock.c.

void sock_rfree ( struct sk_buff skb)

Definition at line 1495 of file sock.c.

struct sk_buff* sock_rmalloc ( struct sock sk,
unsigned long  size,
int  force,
gfp_t  priority 
)
read

Definition at line 1560 of file sock.c.

int sock_setsockopt ( struct socket sock,
int  level,
int  op,
char __user optval,
unsigned int  optlen 
)

Definition at line 578 of file sock.c.

int sock_tx_timestamp ( struct sock sk,
__u8 tx_flags 
)

sock_tx_timestamp - checks whether the outgoing packet is to be time stamped : socket sending this packet : filled with instructions for time stamping

Currently only depends on SOCK_TIMESTAMPING* flags. Returns error code if parameters are invalid.

Definition at line 605 of file socket.c.

void sock_wfree ( struct sk_buff skb)

Definition at line 1469 of file sock.c.

struct sk_buff* sock_wmalloc ( struct sock sk,
unsigned long  size,
int  force,
gfp_t  priority 
)
read

Definition at line 1543 of file sock.c.

Variable Documentation

int net_msg_warn
int sysctl_optmem_max
__u32 sysctl_rmem_default
__u32 sysctl_rmem_max
__u32 sysctl_wmem_default
__u32 sysctl_wmem_max