Lines Matching refs:sock

9  * Version:	@(#)sock.h	1.0.4	05/13/93
89 void SOCK_DEBUG(const struct sock *sk, const char *msg, ...)
113 struct sock;
163 * for struct sock and struct inet_timewait_sock.
213 * offset(struct sock, sk_refcnt) == 128 on 64bit arches
219 struct sock *skc_listener; /* request_sock */
257 * struct sock - network layer representation of sockets
262 * @sk_kern_sock: True if sock is using kernel lock classes
264 * @sk_wq: sock wait queue and async head
300 * @sk_prot_creator: sk_prot of original sock creator (see ipv6_setsockopt,
319 * @sk_timer: sock cleanup timer
338 * @sk_state_change: callback to indicate change in the state of the sock
344 * @sk_destruct: called at sock freeing time, i.e. when all refcnt == 0
353 struct sock {
515 void (*sk_state_change)(struct sock *sk);
516 void (*sk_data_ready)(struct sock *sk);
517 void (*sk_write_space)(struct sock *sk);
518 void (*sk_error_report)(struct sock *sk);
519 int (*sk_backlog_rcv)(struct sock *sk,
522 struct sk_buff* (*sk_validate_xmit_skb)(struct sock *sk,
526 void (*sk_destruct)(struct sock *sk);
565 static inline bool sk_user_data_is_nocopy(const struct sock *sk)
581 __rcu_dereference_sk_user_data_with_flags(const struct sock *sk,
618 int sk_set_peek_off(struct sock *sk, int val);
620 static inline int sk_peek_offset(struct sock *sk, int flags)
629 static inline void sk_peek_offset_bwd(struct sock *sk, int val)
639 static inline void sk_peek_offset_fwd(struct sock *sk, int val)
647 static inline struct sock *sk_entry(const struct hlist_node *node)
649 return hlist_entry(node, struct sock, sk_node);
652 static inline struct sock *__sk_head(const struct hlist_head *head)
654 return hlist_entry(head->first, struct sock, sk_node);
657 static inline struct sock *sk_head(const struct hlist_head *head)
662 static inline struct sock *__sk_nulls_head(const struct hlist_nulls_head *head)
664 return hlist_nulls_entry(head->first, struct sock, sk_nulls_node);
667 static inline struct sock *sk_nulls_head(const struct hlist_nulls_head *head)
672 static inline struct sock *sk_next(const struct sock *sk)
674 return hlist_entry_safe(sk->sk_node.next, struct sock, sk_node);
677 static inline struct sock *sk_nulls_next(const struct sock *sk)
681 struct sock, sk_nulls_node) :
685 static inline bool sk_unhashed(const struct sock *sk)
690 static inline bool sk_hashed(const struct sock *sk)
705 static inline void __sk_del_node(struct sock *sk)
711 static inline bool __sk_del_node_init(struct sock *sk)
727 static __always_inline void sock_hold(struct sock *sk)
735 static __always_inline void __sock_put(struct sock *sk)
740 static inline bool sk_del_node_init(struct sock *sk)
753 static inline bool __sk_nulls_del_node_init_rcu(struct sock *sk)
762 static inline bool sk_nulls_del_node_init_rcu(struct sock *sk)
774 static inline void __sk_add_node(struct sock *sk, struct hlist_head *list)
779 static inline void sk_add_node(struct sock *sk, struct hlist_head *list)
785 static inline void sk_add_node_rcu(struct sock *sk, struct hlist_head *list)
795 static inline void sk_add_node_tail_rcu(struct sock *sk, struct hlist_head *list)
801 static inline void __sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list)
806 static inline void __sk_nulls_add_node_tail_rcu(struct sock *sk, struct hlist_nulls_head *list)
811 static inline void sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list)
817 static inline void __sk_del_bind_node(struct sock *sk)
822 static inline void sk_add_bind_node(struct sock *sk,
860 static inline struct user_namespace *sk_user_ns(struct sock *sk)
905 static inline void sock_copy_flags(struct sock *nsk, struct sock *osk)
910 static inline void sock_set_flag(struct sock *sk, enum sock_flags flag)
915 static inline void sock_reset_flag(struct sock *sk, enum sock_flags flag)
920 static inline void sock_valbool_flag(struct sock *sk, enum sock_flags bit,
929 static inline bool sock_flag(const struct sock *sk, enum sock_flags flag)
953 static inline gfp_t sk_gfp_mask(const struct sock *sk, gfp_t gfp_mask)
958 static inline void sk_acceptq_removed(struct sock *sk)
963 static inline void sk_acceptq_added(struct sock *sk)
968 static inline bool sk_acceptq_is_full(const struct sock *sk)
976 static inline int sk_stream_min_wspace(const struct sock *sk)
981 static inline int sk_stream_wspace(const struct sock *sk)
986 static inline void sk_wmem_queued_add(struct sock *sk, int val)
991 void sk_stream_write_space(struct sock *sk);
994 static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb)
1013 static inline bool sk_rcvqueues_full(const struct sock *sk, unsigned int limit)
1021 static inline __must_check int sk_add_backlog(struct sock *sk, struct sk_buff *skb,
1040 int __sk_backlog_rcv(struct sock *sk, struct sk_buff *skb);
1042 static inline int sk_backlog_rcv(struct sock *sk, struct sk_buff *skb)
1050 static inline void sk_incoming_cpu_update(struct sock *sk)
1070 static inline void sock_rps_record_flow(const struct sock *sk)
1094 static inline void sock_rps_save_rxhash(struct sock *sk,
1106 static inline void sock_rps_reset_rxhash(struct sock *sk)
1131 int sk_stream_wait_connect(struct sock *sk, long *timeo_p);
1132 int sk_stream_wait_memory(struct sock *sk, long *timeo_p);
1133 void sk_stream_wait_close(struct sock *sk, long timeo_p);
1134 int sk_stream_error(struct sock *sk, int flags, int err);
1135 void sk_stream_kill_queues(struct sock *sk);
1136 void sk_set_memalloc(struct sock *sk);
1137 void sk_clear_memalloc(struct sock *sk);
1139 void __sk_flush_backlog(struct sock *sk);
1141 static inline bool sk_flush_backlog(struct sock *sk)
1150 int sk_wait_data(struct sock *sk, long *timeo, const struct sk_buff *skb);
1163 static inline void sk_prot_clear_nulls(struct sock *sk, int size)
1165 if (offsetof(struct sock, sk_node.next) != 0)
1166 memset(sk, 0, offsetof(struct sock, sk_node.next));
1168 size - offsetof(struct sock, sk_node.pprev));
1175 void (*close)(struct sock *sk,
1177 int (*pre_connect)(struct sock *sk,
1180 int (*connect)(struct sock *sk,
1183 int (*disconnect)(struct sock *sk, int flags);
1185 struct sock * (*accept)(struct sock *sk, int flags, int *err,
1188 int (*ioctl)(struct sock *sk, int cmd,
1190 int (*init)(struct sock *sk);
1191 void (*destroy)(struct sock *sk);
1192 void (*shutdown)(struct sock *sk, int how);
1193 int (*setsockopt)(struct sock *sk, int level,
1196 int (*getsockopt)(struct sock *sk, int level,
1199 void (*keepalive)(struct sock *sk, int valbool);
1201 int (*compat_ioctl)(struct sock *sk,
1204 int (*sendmsg)(struct sock *sk, struct msghdr *msg,
1206 int (*recvmsg)(struct sock *sk, struct msghdr *msg,
1209 int (*sendpage)(struct sock *sk, struct page *page,
1211 int (*bind)(struct sock *sk,
1213 int (*bind_add)(struct sock *sk,
1216 int (*backlog_rcv) (struct sock *sk,
1221 void (*release_cb)(struct sock *sk);
1224 int (*hash)(struct sock *sk);
1225 void (*unhash)(struct sock *sk);
1226 void (*rehash)(struct sock *sk);
1227 int (*get_port)(struct sock *sk, unsigned short snum);
1234 bool (*stream_memory_free)(const struct sock *sk, int wake);
1235 bool (*stream_memory_read)(const struct sock *sk);
1237 void (*enter_memory_pressure)(struct sock *sk);
1238 void (*leave_memory_pressure)(struct sock *sk);
1285 int (*diag_destroy)(struct sock *sk, int err);
1293 static inline void sk_refcnt_debug_inc(struct sock *sk)
1298 static inline void sk_refcnt_debug_dec(struct sock *sk)
1305 static inline void sk_refcnt_debug_release(const struct sock *sk)
1317 static inline bool __sk_stream_memory_free(const struct sock *sk, int wake)
1326 static inline bool sk_stream_memory_free(const struct sock *sk)
1331 static inline bool __sk_stream_is_writeable(const struct sock *sk, int wake)
1337 static inline bool sk_stream_is_writeable(const struct sock *sk)
1342 static inline int sk_under_cgroup_hierarchy(struct sock *sk,
1353 static inline bool sk_has_memory_pressure(const struct sock *sk)
1358 static inline bool sk_under_global_memory_pressure(const struct sock *sk)
1364 static inline bool sk_under_memory_pressure(const struct sock *sk)
1377 sk_memory_allocated(const struct sock *sk)
1383 sk_memory_allocated_add(struct sock *sk, int amt)
1389 sk_memory_allocated_sub(struct sock *sk, int amt)
1394 static inline void sk_sockets_allocated_dec(struct sock *sk)
1399 static inline void sk_sockets_allocated_inc(struct sock *sk)
1405 sk_sockets_allocated_read_positive(struct sock *sk)
1447 static inline int __sk_prot_rehash(struct sock *sk)
1486 int __sk_mem_raise_allocated(struct sock *sk, int size, int amt, int kind);
1487 int __sk_mem_schedule(struct sock *sk, int size, int kind);
1488 void __sk_mem_reduce_allocated(struct sock *sk, int amount);
1489 void __sk_mem_reclaim(struct sock *sk, int amount);
1500 static inline long sk_prot_mem_limits(const struct sock *sk, int index)
1517 static inline bool sk_has_account(struct sock *sk)
1523 static inline bool sk_wmem_schedule(struct sock *sk, int size)
1534 sk_rmem_schedule(struct sock *sk, struct sk_buff *skb, int size)
1545 static inline void sk_mem_reclaim(struct sock *sk)
1553 static inline void sk_mem_reclaim_partial(struct sock *sk)
1561 static inline void sk_mem_charge(struct sock *sk, int size)
1568 static inline void sk_mem_uncharge(struct sock *sk, int size)
1586 static inline void sk_wmem_free_skb(struct sock *sk, struct sk_buff *skb)
1600 static inline void sock_release_ownership(struct sock *sk)
1630 static inline bool lockdep_sock_is_held(const struct sock *sk)
1637 void lock_sock_nested(struct sock *sk, int subclass);
1639 static inline void lock_sock(struct sock *sk)
1644 void __release_sock(struct sock *sk);
1645 void release_sock(struct sock *sk);
1654 bool lock_sock_fast(struct sock *sk);
1663 static inline void unlock_sock_fast(struct sock *sk, bool slow)
1685 static inline void sock_owned_by_me(const struct sock *sk)
1692 static inline void sock_not_owned_by_me(const struct sock *sk)
1699 static inline bool sock_owned_by_user(const struct sock *sk)
1705 static inline bool sock_owned_by_user_nocheck(const struct sock *sk)
1711 static inline bool sock_allow_reclassification(const struct sock *csk)
1713 struct sock *sk = (struct sock *)csk;
1718 struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
1720 void sk_free(struct sock *sk);
1721 void sk_destruct(struct sock *sk);
1722 struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority);
1723 void sk_free_unlock_clone(struct sock *sk);
1725 struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force,
1729 struct sk_buff *sock_omalloc(struct sock *sk, unsigned long size,
1741 int sock_setsockopt(struct socket *sock, int level, int op,
1744 int sock_getsockopt(struct socket *sock, int level, int op,
1746 int sock_gettstamp(struct socket *sock, void __user *userstamp,
1748 struct sk_buff *sock_alloc_send_skb(struct sock *sk, unsigned long size,
1750 struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len,
1753 void *sock_kmalloc(struct sock *sk, int size, gfp_t priority);
1754 void sock_kfree_s(struct sock *sk, void *mem, int size);
1755 void sock_kzfree_s(struct sock *sk, void *mem, int size);
1756 void sk_send_sigurg(struct sock *sk);
1765 const struct sock *sk)
1770 int __sock_cmsg_send(struct sock *sk, struct msghdr *msg, struct cmsghdr *cmsg,
1772 int sock_cmsg_send(struct sock *sk, struct msghdr *msg,
1788 int sock_no_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t len);
1790 int sock_no_mmap(struct file *file, struct socket *sock,
1792 ssize_t sock_no_sendpage(struct socket *sock, struct page *page, int offset,
1794 ssize_t sock_no_sendpage_locked(struct sock *sk, struct page *page,
1801 int sock_common_getsockopt(struct socket *sock, int level, int optname,
1803 int sock_common_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
1805 int sock_common_setsockopt(struct socket *sock, int level, int optname,
1808 void sk_common_release(struct sock *sk);
1815 void sock_init_data_uid(struct socket *sock, struct sock *sk, kuid_t uid);
1818 * Assumes struct socket *sock is embedded in a struct socket_alloc.
1820 void sock_init_data(struct socket *sock, struct sock *sk);
1848 static inline void sock_put(struct sock *sk)
1856 void sock_gen_put(struct sock *sk);
1858 int __sk_receive_skb(struct sock *sk, struct sk_buff *skb, const int nested,
1860 static inline int sk_receive_skb(struct sock *sk, struct sk_buff *skb,
1866 static inline void sk_tx_queue_set(struct sock *sk, int tx_queue)
1879 static inline void sk_tx_queue_clear(struct sock *sk)
1887 static inline int sk_tx_queue_get(const struct sock *sk)
1901 static inline void sk_rx_queue_set(struct sock *sk, const struct sk_buff *skb)
1915 static inline void sk_rx_queue_clear(struct sock *sk)
1923 static inline int sk_rx_queue_get(const struct sock *sk)
1932 static inline void sk_set_socket(struct sock *sk, struct socket *sock)
1934 sk->sk_socket = sock;
1937 static inline wait_queue_head_t *sk_sleep(struct sock *sk)
1944 * Note that parent inode held reference count on this struct sock,
1949 static inline void sock_orphan(struct sock *sk)
1958 static inline void sock_graft(struct sock *sk, struct socket *parent)
1970 kuid_t sock_i_uid(struct sock *sk);
1971 unsigned long __sock_i_ino(struct sock *sk);
1972 unsigned long sock_i_ino(struct sock *sk);
1974 static inline kuid_t sock_net_uid(const struct net *net, const struct sock *sk)
1986 static inline void sk_set_txhash(struct sock *sk)
1992 static inline bool sk_rethink_txhash(struct sock *sk)
2002 __sk_dst_get(struct sock *sk)
2009 sk_dst_get(struct sock *sk)
2021 static inline void __dst_negative_advice(struct sock *sk)
2029 static inline void dst_negative_advice(struct sock *sk)
2036 __sk_dst_set(struct sock *sk, struct dst_entry *dst)
2049 sk_dst_set(struct sock *sk, struct dst_entry *dst)
2060 __sk_dst_reset(struct sock *sk)
2066 sk_dst_reset(struct sock *sk)
2071 struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie);
2073 struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie);
2075 static inline void sk_dst_confirm(struct sock *sk)
2084 struct sock *sk = skb->sk;
2095 bool sk_mc_loop(struct sock *sk);
2097 static inline bool sk_can_gso(const struct sock *sk)
2102 void sk_setup_caps(struct sock *sk, struct dst_entry *dst);
2104 static inline void sk_nocaps_add(struct sock *sk, netdev_features_t flags)
2110 static inline int skb_do_copy_data_nocache(struct sock *sk, struct sk_buff *skb,
2128 static inline int skb_add_data_nocache(struct sock *sk, struct sk_buff *skb,
2141 static inline int skb_copy_to_page_nocache(struct sock *sk, struct iov_iter *from,
2167 static inline int sk_wmem_alloc_get(const struct sock *sk)
2178 static inline int sk_rmem_alloc_get(const struct sock *sk)
2189 static inline bool sk_has_allocations(const struct sock *sk)
2233 * @sock: socket to wait on
2238 static inline void sock_poll_wait(struct file *filp, struct socket *sock,
2242 poll_wait(filp, &sock->wq.wait, p);
2252 static inline void skb_set_hash_from_sk(struct sk_buff *skb, struct sock *sk)
2263 void skb_set_owner_w(struct sk_buff *skb, struct sock *sk);
2273 static inline void skb_set_owner_r(struct sk_buff *skb, struct sock *sk)
2282 static inline __must_check bool skb_set_owner_sk_safe(struct sk_buff *skb, struct sock *sk)
2293 static inline struct sk_buff *skb_clone_and_charge_r(struct sk_buff *skb, struct sock *sk)
2306 void sk_reset_timer(struct sock *sk, struct timer_list *timer,
2309 void sk_stop_timer(struct sock *sk, struct timer_list *timer);
2311 void sk_stop_timer_sync(struct sock *sk, struct timer_list *timer);
2313 int __sk_queue_drop_skb(struct sock *sk, struct sk_buff_head *sk_queue,
2315 void (*destructor)(struct sock *sk,
2317 int __sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb);
2318 int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb);
2320 int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb);
2321 struct sk_buff *sock_dequeue_err_skb(struct sock *sk);
2327 static inline int sock_error(struct sock *sk)
2341 static inline unsigned long sock_wspace(struct sock *sk)
2357 static inline void sk_set_bit(int nr, struct sock *sk)
2366 static inline void sk_clear_bit(int nr, struct sock *sk)
2375 static inline void sk_wake_async(const struct sock *sk, int how, int band)
2394 static inline void sk_stream_moderate_sndbuf(struct sock *sk)
2406 struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp,
2426 static inline struct page_frag *sk_page_frag(struct sock *sk)
2435 bool sk_page_frag_refill(struct sock *sk, struct page_frag *pfrag);
2440 static inline bool sock_writeable(const struct sock *sk)
2450 static inline long sock_rcvtimeo(const struct sock *sk, bool noblock)
2455 static inline long sock_sndtimeo(const struct sock *sk, bool noblock)
2460 static inline int sock_rcvlowat(const struct sock *sk, int waitall, int len)
2493 sock_skb_set_dropcount(const struct sock *sk, struct sk_buff *skb)
2499 static inline void sk_drops_add(struct sock *sk, const struct sk_buff *skb)
2506 static inline ktime_t sock_read_timestamp(struct sock *sk)
2523 static inline void sock_write_timestamp(struct sock *sk, ktime_t kt)
2534 void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
2536 void __sock_recv_wifi_status(struct msghdr *msg, struct sock *sk,
2540 sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
2564 void __sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
2568 static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
2595 static inline void _sock_tx_timestamp(struct sock *sk, __u16 tsflags,
2608 static inline void sock_tx_timestamp(struct sock *sk, __u16 tsflags,
2629 static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb)
2642 struct net *sock_net(const struct sock *sk)
2648 void sock_net_set(struct sock *sk, struct net *net)
2666 static inline bool sk_fullsock(const struct sock *sk)
2672 sk_is_refcounted(struct sock *sk)
2683 static inline struct sock *
2687 struct sock *sk = skb->sk;
2708 struct sock *sk = skb->sk;
2727 static inline bool sk_listener(const struct sock *sk)
2732 void sock_enable_timestamp(struct sock *sk, enum sock_flags flag);
2733 int sock_recv_errqueue(struct sock *sk, struct msghdr *msg, int len, int level,
2736 bool sk_ns_capable(const struct sock *sk,
2738 bool sk_capable(const struct sock *sk, int cap);
2739 bool sk_net_capable(const struct sock *sk, int cap);
2741 void sk_get_meminfo(const struct sock *sk, u32 *meminfo);
2765 static inline int sk_get_wmem0(const struct sock *sk, const struct proto *proto)
2774 static inline int sk_get_rmem0(const struct sock *sk, const struct proto *proto)
2787 static inline void sk_pacing_shift_update(struct sock *sk, int val)
2799 static inline bool sk_dev_equal_l3scope(struct sock *sk, int dif)
2813 void sock_def_readable(struct sock *sk);
2815 int sock_bindtoindex(struct sock *sk, int ifindex, bool lock_sk);
2816 void sock_enable_timestamps(struct sock *sk);
2817 void sock_no_linger(struct sock *sk);
2818 void sock_set_keepalive(struct sock *sk);
2819 void sock_set_priority(struct sock *sk, u32 priority);
2820 void sock_set_rcvbuf(struct sock *sk, int val);
2821 void sock_set_mark(struct sock *sk, u32 val);
2822 void sock_set_reuseaddr(struct sock *sk);
2823 void sock_set_reuseport(struct sock *sk);
2824 void sock_set_sndtimeo(struct sock *sk, s64 secs);
2826 int sock_bind_add(struct sock *sk, struct sockaddr *addr, int addr_len);