Lines Matching refs:sock
9 * Version: @(#)sock.h 1.0.4 05/13/93
87 void SOCK_DEBUG(const struct sock *sk, const char *msg, ...)
111 struct sock;
161 * for struct sock and struct inet_timewait_sock.
206 * offset(struct sock, sk_refcnt) == 128 on 64bit arches
212 struct sock *skc_listener; /* request_sock */
251 * struct sock - network layer representation of sockets
256 * @sk_kern_sock: True if sock is using kernel lock classes
258 * @sk_wq: sock wait queue and async head
294 * @sk_prot_creator: sk_prot of original sock creator (see ipv6_setsockopt,
317 * @sk_timer: sock cleanup timer
339 * @sk_disconnects: number of disconnect operations performed on this sock
340 * @sk_state_change: callback to indicate change in the state of the sock
346 * @sk_destruct: called at sock freeing time, i.e. when all refcnt == 0
357 struct sock {
529 void (*sk_state_change)(struct sock *sk);
530 void (*sk_data_ready)(struct sock *sk);
531 void (*sk_write_space)(struct sock *sk);
532 void (*sk_error_report)(struct sock *sk);
533 int (*sk_backlog_rcv)(struct sock *sk,
536 struct sk_buff* (*sk_validate_xmit_skb)(struct sock *sk,
540 void (*sk_destruct)(struct sock *sk);
581 static inline bool sk_user_data_is_nocopy(const struct sock *sk)
599 __locked_read_sk_user_data_with_flags(const struct sock *sk,
622 __rcu_dereference_sk_user_data_with_flags(const struct sock *sk,
649 struct net *sock_net(const struct sock *sk)
655 void sock_net_set(struct sock *sk, struct net *net)
671 int sk_set_peek_off(struct sock *sk, int val);
673 static inline int sk_peek_offset(const struct sock *sk, int flags)
682 static inline void sk_peek_offset_bwd(struct sock *sk, int val)
692 static inline void sk_peek_offset_fwd(struct sock *sk, int val)
700 static inline struct sock *sk_entry(const struct hlist_node *node)
702 return hlist_entry(node, struct sock, sk_node);
705 static inline struct sock *__sk_head(const struct hlist_head *head)
707 return hlist_entry(head->first, struct sock, sk_node);
710 static inline struct sock *sk_head(const struct hlist_head *head)
715 static inline struct sock *__sk_nulls_head(const struct hlist_nulls_head *head)
717 return hlist_nulls_entry(head->first, struct sock, sk_nulls_node);
720 static inline struct sock *sk_nulls_head(const struct hlist_nulls_head *head)
725 static inline struct sock *sk_next(const struct sock *sk)
727 return hlist_entry_safe(sk->sk_node.next, struct sock, sk_node);
730 static inline struct sock *sk_nulls_next(const struct sock *sk)
734 struct sock, sk_nulls_node) :
738 static inline bool sk_unhashed(const struct sock *sk)
743 static inline bool sk_hashed(const struct sock *sk)
753 static inline void __sk_del_node(struct sock *sk)
759 static inline bool __sk_del_node_init(struct sock *sk)
775 static __always_inline void sock_hold(struct sock *sk)
783 static __always_inline void __sock_put(struct sock *sk)
788 static inline bool sk_del_node_init(struct sock *sk)
801 static inline bool __sk_nulls_del_node_init_rcu(struct sock *sk)
810 static inline bool sk_nulls_del_node_init_rcu(struct sock *sk)
822 static inline void __sk_add_node(struct sock *sk, struct hlist_head *list)
827 static inline void sk_add_node(struct sock *sk, struct hlist_head *list)
833 static inline void sk_add_node_rcu(struct sock *sk, struct hlist_head *list)
843 static inline void sk_add_node_tail_rcu(struct sock *sk, struct hlist_head *list)
849 static inline void __sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list)
854 static inline void __sk_nulls_add_node_tail_rcu(struct sock *sk, struct hlist_nulls_head *list)
859 static inline void sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list)
865 static inline void __sk_del_bind_node(struct sock *sk)
870 static inline void sk_add_bind_node(struct sock *sk,
876 static inline void __sk_del_bind2_node(struct sock *sk)
881 static inline void sk_add_bind2_node(struct sock *sk, struct hlist_head *list)
920 static inline struct user_namespace *sk_user_ns(const struct sock *sk)
966 static inline void sock_copy_flags(struct sock *nsk, const struct sock *osk)
971 static inline void sock_set_flag(struct sock *sk, enum sock_flags flag)
976 static inline void sock_reset_flag(struct sock *sk, enum sock_flags flag)
981 static inline void sock_valbool_flag(struct sock *sk, enum sock_flags bit,
990 static inline bool sock_flag(const struct sock *sk, enum sock_flags flag)
1014 static inline gfp_t sk_gfp_mask(const struct sock *sk, gfp_t gfp_mask)
1019 static inline void sk_acceptq_removed(struct sock *sk)
1024 static inline void sk_acceptq_added(struct sock *sk)
1033 static inline bool sk_acceptq_is_full(const struct sock *sk)
1041 static inline int sk_stream_min_wspace(const struct sock *sk)
1046 static inline int sk_stream_wspace(const struct sock *sk)
1051 static inline void sk_wmem_queued_add(struct sock *sk, int val)
1056 static inline void sk_forward_alloc_add(struct sock *sk, int val)
1062 void sk_stream_write_space(struct sock *sk);
1065 static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb)
1084 static inline bool sk_rcvqueues_full(const struct sock *sk, unsigned int limit)
1092 static inline __must_check int sk_add_backlog(struct sock *sk, struct sk_buff *skb,
1111 int __sk_backlog_rcv(struct sock *sk, struct sk_buff *skb);
1113 INDIRECT_CALLABLE_DECLARE(int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb));
1114 INDIRECT_CALLABLE_DECLARE(int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb));
1116 static inline int sk_backlog_rcv(struct sock *sk, struct sk_buff *skb)
1127 static inline void sk_incoming_cpu_update(struct sock *sk)
1147 static inline void sock_rps_record_flow(const struct sock *sk)
1171 static inline void sock_rps_save_rxhash(struct sock *sk,
1183 static inline void sock_rps_reset_rxhash(struct sock *sk)
1206 int sk_stream_wait_connect(struct sock *sk, long *timeo_p);
1207 int sk_stream_wait_memory(struct sock *sk, long *timeo_p);
1208 void sk_stream_wait_close(struct sock *sk, long timeo_p);
1209 int sk_stream_error(struct sock *sk, int flags, int err);
1210 void sk_stream_kill_queues(struct sock *sk);
1211 void sk_set_memalloc(struct sock *sk);
1212 void sk_clear_memalloc(struct sock *sk);
1214 void __sk_flush_backlog(struct sock *sk);
1216 static inline bool sk_flush_backlog(struct sock *sk)
1225 int sk_wait_data(struct sock *sk, long *timeo, const struct sk_buff *skb);
1239 static inline void sk_prot_clear_nulls(struct sock *sk, int size)
1241 if (offsetof(struct sock, sk_node.next) != 0)
1242 memset(sk, 0, offsetof(struct sock, sk_node.next));
1244 size - offsetof(struct sock, sk_node.pprev));
1251 void (*close)(struct sock *sk,
1253 int (*pre_connect)(struct sock *sk,
1256 int (*connect)(struct sock *sk,
1259 int (*disconnect)(struct sock *sk, int flags);
1261 struct sock * (*accept)(struct sock *sk, int flags, int *err,
1264 int (*ioctl)(struct sock *sk, int cmd,
1266 int (*init)(struct sock *sk);
1267 void (*destroy)(struct sock *sk);
1268 void (*shutdown)(struct sock *sk, int how);
1269 int (*setsockopt)(struct sock *sk, int level,
1272 int (*getsockopt)(struct sock *sk, int level,
1275 void (*keepalive)(struct sock *sk, int valbool);
1277 int (*compat_ioctl)(struct sock *sk,
1280 int (*sendmsg)(struct sock *sk, struct msghdr *msg,
1282 int (*recvmsg)(struct sock *sk, struct msghdr *msg,
1284 void (*splice_eof)(struct socket *sock);
1285 int (*bind)(struct sock *sk,
1287 int (*bind_add)(struct sock *sk,
1290 int (*backlog_rcv) (struct sock *sk,
1295 void (*release_cb)(struct sock *sk);
1298 int (*hash)(struct sock *sk);
1299 void (*unhash)(struct sock *sk);
1300 void (*rehash)(struct sock *sk);
1301 int (*get_port)(struct sock *sk, unsigned short snum);
1302 void (*put_port)(struct sock *sk);
1304 int (*psock_update_sk_prot)(struct sock *sk,
1315 int (*forward_alloc_get)(const struct sock *sk);
1318 bool (*stream_memory_free)(const struct sock *sk, int wake);
1319 bool (*sock_is_readable)(struct sock *sk);
1321 void (*enter_memory_pressure)(struct sock *sk);
1322 void (*leave_memory_pressure)(struct sock *sk);
1369 int (*diag_destroy)(struct sock *sk, int err);
1376 INDIRECT_CALLABLE_DECLARE(bool tcp_stream_memory_free(const struct sock *sk, int wake));
1378 static inline int sk_forward_alloc_get(const struct sock *sk)
1387 static inline bool __sk_stream_memory_free(const struct sock *sk, int wake)
1397 static inline bool sk_stream_memory_free(const struct sock *sk)
1402 static inline bool __sk_stream_is_writeable(const struct sock *sk, int wake)
1408 static inline bool sk_stream_is_writeable(const struct sock *sk)
1413 static inline int sk_under_cgroup_hierarchy(struct sock *sk,
1424 static inline bool sk_has_memory_pressure(const struct sock *sk)
1429 static inline bool sk_under_global_memory_pressure(const struct sock *sk)
1435 static inline bool sk_under_memory_pressure(const struct sock *sk)
1454 sk_memory_allocated(const struct sock *sk)
1463 sk_memory_allocated_add(struct sock *sk, int amt)
1477 sk_memory_allocated_sub(struct sock *sk, int amt)
1492 static inline void sk_sockets_allocated_dec(struct sock *sk)
1498 static inline void sk_sockets_allocated_inc(struct sock *sk)
1505 sk_sockets_allocated_read_positive(struct sock *sk)
1560 static inline int __sk_prot_rehash(struct sock *sk)
1597 int __sk_mem_raise_allocated(struct sock *sk, int size, int amt, int kind);
1598 int __sk_mem_schedule(struct sock *sk, int size, int kind);
1599 void __sk_mem_reduce_allocated(struct sock *sk, int amount);
1600 void __sk_mem_reclaim(struct sock *sk, int amount);
1606 static inline long sk_prot_mem_limits(const struct sock *sk, int index)
1616 static inline bool sk_has_account(struct sock *sk)
1622 static inline bool sk_wmem_schedule(struct sock *sk, int size)
1633 sk_rmem_schedule(struct sock *sk, struct sk_buff *skb, int size)
1644 static inline int sk_unused_reserved_mem(const struct sock *sk)
1657 static inline void sk_mem_reclaim(struct sock *sk)
1670 static inline void sk_mem_reclaim_final(struct sock *sk)
1676 static inline void sk_mem_charge(struct sock *sk, int size)
1683 static inline void sk_mem_uncharge(struct sock *sk, int size)
1710 static inline bool lockdep_sock_is_held(const struct sock *sk)
1716 void lock_sock_nested(struct sock *sk, int subclass);
1718 static inline void lock_sock(struct sock *sk)
1723 void __lock_sock(struct sock *sk);
1724 void __release_sock(struct sock *sk);
1725 void release_sock(struct sock *sk);
1734 bool __lock_sock_fast(struct sock *sk) __acquires(&sk->sk_lock.slock);
1749 static inline bool lock_sock_fast(struct sock *sk)
1758 static inline bool lock_sock_fast_nested(struct sock *sk)
1773 static inline void unlock_sock_fast(struct sock *sk, bool slow)
1785 void sockopt_lock_sock(struct sock *sk);
1786 void sockopt_release_sock(struct sock *sk);
1804 static inline void sock_owned_by_me(const struct sock *sk)
1811 static inline bool sock_owned_by_user(const struct sock *sk)
1817 static inline bool sock_owned_by_user_nocheck(const struct sock *sk)
1822 static inline void sock_release_ownership(struct sock *sk)
1833 static inline bool sock_allow_reclassification(const struct sock *csk)
1835 struct sock *sk = (struct sock *)csk;
1841 struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
1843 void sk_free(struct sock *sk);
1844 void sk_destruct(struct sock *sk);
1845 struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority);
1846 void sk_free_unlock_clone(struct sock *sk);
1848 struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force,
1852 struct sk_buff *sock_omalloc(struct sock *sk, unsigned long size,
1864 int sk_setsockopt(struct sock *sk, int level, int optname,
1866 int sock_setsockopt(struct socket *sock, int level, int op,
1869 int sk_getsockopt(struct sock *sk, int level, int optname,
1871 int sock_getsockopt(struct socket *sock, int level, int op,
1873 int sock_gettstamp(struct socket *sock, void __user *userstamp,
1875 struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len,
1879 static inline struct sk_buff *sock_alloc_send_skb(struct sock *sk,
1886 void *sock_kmalloc(struct sock *sk, int size, gfp_t priority);
1887 void sock_kfree_s(struct sock *sk, void *mem, int size);
1888 void sock_kzfree_s(struct sock *sk, void *mem, int size);
1889 void sk_send_sigurg(struct sock *sk);
1891 static inline void sock_replace_proto(struct sock *sk, struct proto *proto)
1905 const struct sock *sk)
1912 int __sock_cmsg_send(struct sock *sk, struct cmsghdr *cmsg,
1914 int sock_cmsg_send(struct sock *sk, struct msghdr *msg,
1930 int sock_no_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t len);
1932 int sock_no_mmap(struct file *file, struct socket *sock,
1939 int sock_common_getsockopt(struct socket *sock, int level, int optname,
1941 int sock_common_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
1943 int sock_common_setsockopt(struct socket *sock, int level, int optname,
1946 void sk_common_release(struct sock *sk);
1953 void sock_init_data_uid(struct socket *sock, struct sock *sk, kuid_t uid);
1956 * Assumes struct socket *sock is embedded in a struct socket_alloc.
1958 void sock_init_data(struct socket *sock, struct sock *sk);
1986 static inline void sock_put(struct sock *sk)
1994 void sock_gen_put(struct sock *sk);
1996 int __sk_receive_skb(struct sock *sk, struct sk_buff *skb, const int nested,
1998 static inline int sk_receive_skb(struct sock *sk, struct sk_buff *skb,
2004 static inline void sk_tx_queue_set(struct sock *sk, int tx_queue)
2017 static inline void sk_tx_queue_clear(struct sock *sk)
2025 static inline int sk_tx_queue_get(const struct sock *sk)
2039 static inline void __sk_rx_queue_set(struct sock *sk,
2054 static inline void sk_rx_queue_set(struct sock *sk, const struct sk_buff *skb)
2059 static inline void sk_rx_queue_update(struct sock *sk, const struct sk_buff *skb)
2064 static inline void sk_rx_queue_clear(struct sock *sk)
2071 static inline int sk_rx_queue_get(const struct sock *sk)
2085 static inline void sk_set_socket(struct sock *sk, struct socket *sock)
2087 sk->sk_socket = sock;
2090 static inline wait_queue_head_t *sk_sleep(struct sock *sk)
2097 * Note that parent inode held reference count on this struct sock,
2102 static inline void sock_orphan(struct sock *sk)
2111 static inline void sock_graft(struct sock *sk, struct socket *parent)
2123 kuid_t sock_i_uid(struct sock *sk);
2124 unsigned long __sock_i_ino(struct sock *sk);
2125 unsigned long sock_i_ino(struct sock *sk);
2127 static inline kuid_t sock_net_uid(const struct net *net, const struct sock *sk)
2139 static inline void sk_set_txhash(struct sock *sk)
2145 static inline bool sk_rethink_txhash(struct sock *sk)
2155 __sk_dst_get(const struct sock *sk)
2162 sk_dst_get(const struct sock *sk)
2174 static inline void __dst_negative_advice(struct sock *sk)
2189 static inline void dst_negative_advice(struct sock *sk)
2196 __sk_dst_set(struct sock *sk, struct dst_entry *dst)
2209 sk_dst_set(struct sock *sk, struct dst_entry *dst)
2220 __sk_dst_reset(struct sock *sk)
2226 sk_dst_reset(struct sock *sk)
2231 struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie);
2233 struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie);
2235 static inline void sk_dst_confirm(struct sock *sk)
2244 struct sock *sk = skb->sk;
2252 bool sk_mc_loop(struct sock *sk);
2254 static inline bool sk_can_gso(const struct sock *sk)
2259 void sk_setup_caps(struct sock *sk, struct dst_entry *dst);
2261 static inline void sk_gso_disable(struct sock *sk)
2267 static inline int skb_do_copy_data_nocache(struct sock *sk, struct sk_buff *skb,
2285 static inline int skb_add_data_nocache(struct sock *sk, struct sk_buff *skb,
2298 static inline int skb_copy_to_page_nocache(struct sock *sk, struct iov_iter *from,
2322 static inline int sk_wmem_alloc_get(const struct sock *sk)
2333 static inline int sk_rmem_alloc_get(const struct sock *sk)
2344 static inline bool sk_has_allocations(const struct sock *sk)
2388 * @sock: socket to wait on
2393 static inline void sock_poll_wait(struct file *filp, struct socket *sock,
2397 poll_wait(filp, &sock->wq.wait, p);
2407 static inline void skb_set_hash_from_sk(struct sk_buff *skb, struct sock *sk)
2418 void skb_set_owner_w(struct sk_buff *skb, struct sock *sk);
2428 static inline void skb_set_owner_r(struct sk_buff *skb, struct sock *sk)
2437 static inline __must_check bool skb_set_owner_sk_safe(struct sk_buff *skb, struct sock *sk)
2448 static inline struct sk_buff *skb_clone_and_charge_r(struct sk_buff *skb, struct sock *sk)
2470 void sk_reset_timer(struct sock *sk, struct timer_list *timer,
2473 void sk_stop_timer(struct sock *sk, struct timer_list *timer);
2475 void sk_stop_timer_sync(struct sock *sk, struct timer_list *timer);
2477 int __sk_queue_drop_skb(struct sock *sk, struct sk_buff_head *sk_queue,
2479 void (*destructor)(struct sock *sk,
2481 int __sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb);
2483 int sock_queue_rcv_skb_reason(struct sock *sk, struct sk_buff *skb,
2486 static inline int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
2491 int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb);
2492 struct sk_buff *sock_dequeue_err_skb(struct sock *sk);
2498 static inline int sock_error(struct sock *sk)
2512 void sk_error_report(struct sock *sk);
2514 static inline unsigned long sock_wspace(struct sock *sk)
2530 static inline void sk_set_bit(int nr, struct sock *sk)
2539 static inline void sk_clear_bit(int nr, struct sock *sk)
2548 static inline void sk_wake_async(const struct sock *sk, int how, int band)
2567 static inline void sk_stream_moderate_sndbuf(struct sock *sk)
2596 static inline struct page_frag *sk_page_frag(struct sock *sk)
2604 bool sk_page_frag_refill(struct sock *sk, struct page_frag *pfrag);
2609 static inline bool sock_writeable(const struct sock *sk)
2624 static inline long sock_rcvtimeo(const struct sock *sk, bool noblock)
2629 static inline long sock_sndtimeo(const struct sock *sk, bool noblock)
2634 static inline int sock_rcvlowat(const struct sock *sk, int waitall, int len)
2667 sock_skb_set_dropcount(const struct sock *sk, struct sk_buff *skb)
2673 static inline void sk_drops_add(struct sock *sk, const struct sk_buff *skb)
2680 static inline ktime_t sock_read_timestamp(struct sock *sk)
2697 static inline void sock_write_timestamp(struct sock *sk, ktime_t kt)
2708 void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
2710 void __sock_recv_wifi_status(struct msghdr *msg, struct sock *sk,
2714 sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
2738 void __sock_recv_cmsgs(struct msghdr *msg, struct sock *sk,
2742 static inline void sock_recv_cmsgs(struct msghdr *msg, struct sock *sk,
2771 static inline void _sock_tx_timestamp(struct sock *sk, __u16 tsflags,
2784 static inline void sock_tx_timestamp(struct sock *sk, __u16 tsflags,
2796 static inline bool sk_is_inet(const struct sock *sk)
2803 static inline bool sk_is_tcp(const struct sock *sk)
2810 static inline bool sk_is_udp(const struct sock *sk)
2817 static inline bool sk_is_stream_unix(const struct sock *sk)
2830 static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb)
2849 static inline bool sk_fullsock(const struct sock *sk)
2855 sk_is_refcounted(struct sock *sk)
2867 static inline struct sock *
2871 struct sock *sk = skb->sk;
2894 struct sock *sk = skb->sk;
2913 static inline bool sk_listener(const struct sock *sk)
2918 void sock_enable_timestamp(struct sock *sk, enum sock_flags flag);
2919 int sock_recv_errqueue(struct sock *sk, struct msghdr *msg, int len, int level,
2922 bool sk_ns_capable(const struct sock *sk,
2924 bool sk_capable(const struct sock *sk, int cap);
2925 bool sk_net_capable(const struct sock *sk, int cap);
2927 void sk_get_meminfo(const struct sock *sk, u32 *meminfo);
2951 static inline int sk_get_wmem0(const struct sock *sk, const struct proto *proto)
2960 static inline int sk_get_rmem0(const struct sock *sk, const struct proto *proto)
2973 static inline void sk_pacing_shift_update(struct sock *sk, int val)
2985 static inline bool sk_dev_equal_l3scope(struct sock *sk, int dif)
3000 void sock_def_readable(struct sock *sk);
3002 int sock_bindtoindex(struct sock *sk, int ifindex, bool lock_sk);
3003 void sock_set_timestamp(struct sock *sk, int optname, bool valbool);
3004 int sock_set_timestamping(struct sock *sk, int optname,
3007 void sock_enable_timestamps(struct sock *sk);
3008 void sock_no_linger(struct sock *sk);
3009 void sock_set_keepalive(struct sock *sk);
3010 void sock_set_priority(struct sock *sk, u32 priority);
3011 void sock_set_rcvbuf(struct sock *sk, int val);
3012 void sock_set_mark(struct sock *sk, u32 val);
3013 void sock_set_reuseaddr(struct sock *sk);
3014 void sock_set_reuseport(struct sock *sk);
3015 void sock_set_sndtimeo(struct sock *sk, s64 secs);
3017 int sock_bind_add(struct sock *sk, struct sockaddr *addr, int addr_len);
3023 int sock_ioctl_inout(struct sock *sk, unsigned int cmd,
3025 int sk_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);
3026 static inline bool sk_is_readable(struct sock *sk)