Lines Matching refs:sock
19 * Alan Cox : sock->protocol is set correctly.
37 * Alan Cox : Fixed TCP ack bug, removed remove sock
129 #include <net/sock.h>
141 #include <trace/events/sock.h>
154 static void sock_def_write_space_wfree(struct sock *sk);
155 static void sock_def_write_space(struct sock *sk);
167 bool sk_ns_capable(const struct sock *sk,
184 bool sk_capable(const struct sock *sk, int cap)
199 bool sk_net_capable(const struct sock *sk, int cap)
304 void sk_set_memalloc(struct sock *sk)
312 void sk_clear_memalloc(struct sock *sk)
329 int __sk_backlog_rcv(struct sock *sk, struct sk_buff *skb)
348 void sk_error_report(struct sock *sk)
461 static bool sock_needs_netstamp(const struct sock *sk)
472 static void sock_disable_timestamp(struct sock *sk, unsigned long flags)
483 int __sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
518 int sock_queue_rcv_skb_reason(struct sock *sk, struct sk_buff *skb,
548 int __sk_receive_skb(struct sock *sk, struct sk_buff *skb,
596 struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie)
614 struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie)
630 static int sock_bindtoindex_locked(struct sock *sk, int ifindex)
660 int sock_bindtoindex(struct sock *sk, int ifindex, bool lock_sk)
674 static int sock_setbindtodevice(struct sock *sk, sockptr_t optval, int optlen)
722 static int sock_getbindtodevice(struct sock *sk, sockptr_t optval,
763 bool sk_mc_loop(struct sock *sk)
783 void sock_set_reuseaddr(struct sock *sk)
791 void sock_set_reuseport(struct sock *sk)
799 void sock_no_linger(struct sock *sk)
808 void sock_set_priority(struct sock *sk, u32 priority)
816 void sock_set_sndtimeo(struct sock *sk, s64 secs)
827 static void __sock_set_timestamps(struct sock *sk, bool val, bool new, bool ns)
840 void sock_enable_timestamps(struct sock *sk)
848 void sock_set_timestamp(struct sock *sk, int optname, bool valbool)
866 static int sock_timestamping_bind_phc(struct sock *sk, int phc_index)
878 pr_err("%s: sock not bind to device\n", __func__);
903 int sock_set_timestamping(struct sock *sk, int optname,
953 void sock_set_keepalive(struct sock *sk)
963 static void __sock_set_rcvbuf(struct sock *sk, int val)
984 void sock_set_rcvbuf(struct sock *sk, int val)
992 static void __sock_set_mark(struct sock *sk, u32 val)
1000 void sock_set_mark(struct sock *sk, u32 val)
1008 static void sock_release_reserved_memory(struct sock *sk, int bytes)
1018 static int sock_reserve_memory(struct sock *sk, int bytes)
1057 void sockopt_lock_sock(struct sock *sk)
1070 void sockopt_release_sock(struct sock *sk)
1096 int sk_setsockopt(struct sock *sk, int level, int optname,
1100 struct socket *sock = sk->sk_socket;
1252 assign_bit(SOCK_PASSCRED, &sock->flags, valbool);
1256 assign_bit(SOCK_PASSPIDFD, &sock->flags, valbool);
1283 int (*set_rcvlowat)(struct sock *sk, int val) = NULL;
1287 if (sock)
1288 set_rcvlowat = READ_ONCE(sock->ops)->set_rcvlowat;
1365 assign_bit(SOCK_PASSSEC, &sock->flags, valbool);
1390 int (*set_peek_off)(struct sock *sk, int val);
1392 set_peek_off = READ_ONCE(sock->ops)->set_peek_off;
1557 int sock_setsockopt(struct socket *sock, int level, int optname,
1560 return sk_setsockopt(sock->sk, level, optname,
1565 static const struct cred *sk_get_peer_cred(struct sock *sk)
1604 int sk_getsockopt(struct sock *sk, int level, int optname,
1607 struct socket *sock = sk->sk_socket;
1755 v.val = !!test_bit(SOCK_PASSCRED, &sock->flags);
1759 v.val = !!test_bit(SOCK_PASSPIDFD, &sock->flags);
1838 lv = READ_ONCE(sock->ops)->getname(sock, (struct sockaddr *)&address, 2);
1856 v.val = !!test_bit(SOCK_PASSSEC, &sock->flags);
1860 return security_socket_getpeersec_stream(sock,
1880 if (!READ_ONCE(sock->ops)->set_peek_off)
2021 int sock_getsockopt(struct socket *sock, int level, int optname,
2024 return sk_getsockopt(sock->sk, level, optname,
2034 static inline void sock_lock_init(struct sock *sk)
2057 static void sock_copy(struct sock *nsk, const struct sock *osk)
2068 BUILD_BUG_ON(offsetof(struct sock, sk_tx_queue_mapping) <
2069 offsetof(struct sock, sk_dontcopy_begin) ||
2070 offsetof(struct sock, sk_tx_queue_mapping) >=
2071 offsetof(struct sock, sk_dontcopy_end));
2073 memcpy(nsk, osk, offsetof(struct sock, sk_dontcopy_begin));
2076 prot->obj_size - offsetof(struct sock, sk_dontcopy_end));
2084 static struct sock *sk_prot_alloc(struct proto *prot, gfp_t priority,
2087 struct sock *sk;
2120 static void sk_prot_free(struct proto *prot, struct sock *sk)
2143 * @prot: struct proto associated with this new sock instance
2146 struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
2149 struct sock *sk;
2155 * See comment in struct sock definition to understand
2189 struct sock *sk = container_of(head, struct sock, sk_rcu);
2229 void sk_destruct(struct sock *sk)
2244 static void __sk_free(struct sock *sk)
2255 void sk_free(struct sock *sk)
2267 static void sk_init_common(struct sock *sk)
2295 struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)
2300 struct sock *newsk;
2357 /* though it's an empty new sock, the charging may fail
2415 void sk_free_unlock_clone(struct sock *sk)
2425 static u32 sk_dst_gso_max_size(struct sock *sk, struct dst_entry *dst)
2443 void sk_setup_caps(struct sock *sk, struct dst_entry *dst)
2479 struct sock *sk = skb->sk;
2517 struct sock *sk = skb->sk;
2523 void skb_set_owner_w(struct sk_buff *skb, struct sock *sk)
2538 * is enough to guarantee sk_free() wont free this sock until
2581 struct sock *sk = skb->sk;
2611 kuid_t sock_i_uid(struct sock *sk)
2622 unsigned long __sock_i_ino(struct sock *sk)
2633 unsigned long sock_i_ino(struct sock *sk)
2647 struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force,
2665 struct sock *sk = skb->sk;
2670 struct sk_buff *sock_omalloc(struct sock *sk, unsigned long size,
2693 void *sock_kmalloc(struct sock *sk, int size, gfp_t priority)
2717 static inline void __sock_kfree_s(struct sock *sk, void *mem, int size,
2729 void sock_kfree_s(struct sock *sk, void *mem, int size)
2735 void sock_kzfree_s(struct sock *sk, void *mem, int size)
2744 static long sock_wait_for_wmem(struct sock *sk, long timeo)
2773 struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len,
2817 int __sock_cmsg_send(struct sock *sk, struct cmsghdr *cmsg,
2861 int sock_cmsg_send(struct sock *sk, struct msghdr *msg,
2880 static void sk_enter_memory_pressure(struct sock *sk)
2888 static void sk_leave_memory_pressure(struct sock *sk)
2947 bool sk_page_frag_refill(struct sock *sk, struct page_frag *pfrag)
2958 void __lock_sock(struct sock *sk)
2976 void __release_sock(struct sock *sk)
3009 void __sk_flush_backlog(struct sock *sk)
3019 * @sk: sock to wait on
3028 int sk_wait_data(struct sock *sk, long *timeo, const struct sk_buff *skb)
3051 int __sk_mem_raise_allocated(struct sock *sk, int size, int amt, int kind)
3147 int __sk_mem_schedule(struct sock *sk, int size, int kind)
3166 void __sk_mem_reduce_allocated(struct sock *sk, int amount)
3183 void __sk_mem_reclaim(struct sock *sk, int amount)
3191 int sk_set_peek_off(struct sock *sk, int val)
3205 int sock_no_bind(struct socket *sock, struct sockaddr *saddr, int len)
3211 int sock_no_connect(struct socket *sock, struct sockaddr *saddr,
3224 int sock_no_accept(struct socket *sock, struct socket *newsock, int flags,
3231 int sock_no_getname(struct socket *sock, struct sockaddr *saddr,
3238 int sock_no_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
3244 int sock_no_listen(struct socket *sock, int backlog)
3250 int sock_no_shutdown(struct socket *sock, int how)
3256 int sock_no_sendmsg(struct socket *sock, struct msghdr *m, size_t len)
3262 int sock_no_sendmsg_locked(struct sock *sk, struct msghdr *m, size_t len)
3268 int sock_no_recvmsg(struct socket *sock, struct msghdr *m, size_t len,
3275 int sock_no_mmap(struct file *file, struct socket *sock, struct vm_area_struct *vma)
3284 * various sock-based usage counts.
3288 struct socket *sock;
3290 sock = sock_from_file(file);
3291 if (sock) {
3292 sock_update_netprioidx(&sock->sk->sk_cgrp_data);
3293 sock_update_classid(&sock->sk->sk_cgrp_data);
3301 static void sock_def_wakeup(struct sock *sk)
3312 static void sock_def_error_report(struct sock *sk)
3324 void sock_def_readable(struct sock *sk)
3339 static void sock_def_write_space(struct sock *sk)
3365 static void sock_def_write_space_wfree(struct sock *sk)
3384 static void sock_def_destruct(struct sock *sk)
3388 void sk_send_sigurg(struct sock *sk)
3396 void sk_reset_timer(struct sock *sk, struct timer_list* timer,
3404 void sk_stop_timer(struct sock *sk, struct timer_list* timer)
3411 void sk_stop_timer_sync(struct sock *sk, struct timer_list *timer)
3418 void sock_init_data_uid(struct socket *sock, struct sock *sk, kuid_t uid)
3430 sk_set_socket(sk, sock);
3434 if (sock) {
3435 sk->sk_type = sock->type;
3436 RCU_INIT_POINTER(sk->sk_wq, &sock->wq);
3437 sock->sk = sk;
3501 void sock_init_data(struct socket *sock, struct sock *sk)
3503 kuid_t uid = sock ?
3504 SOCK_INODE(sock)->i_uid :
3507 sock_init_data_uid(sock, sk, uid);
3511 void lock_sock_nested(struct sock *sk, int subclass)
3525 void release_sock(struct sock *sk)
3544 bool __lock_sock_fast(struct sock *sk) __acquires(&sk->sk_lock.slock)
3552 * sock::sk_lock.slock held.
3555 * sock::sk_lock.slock prevents all other lockers to
3576 int sock_gettstamp(struct socket *sock, void __user *userstamp,
3579 struct sock *sk = sock->sk;
3615 void sock_enable_timestamp(struct sock *sk, enum sock_flags flag)
3632 int sock_recv_errqueue(struct sock *sk, struct msghdr *msg, int len,
3675 int sock_common_getsockopt(struct socket *sock, int level, int optname,
3678 struct sock *sk = sock->sk;
3685 int sock_common_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
3688 struct sock *sk = sock->sk;
3702 int sock_common_setsockopt(struct socket *sock, int level, int optname,
3705 struct sock *sk = sock->sk;
3712 void sk_common_release(struct sock *sk)
3747 void sk_get_meminfo(const struct sock *sk, u32 *mem)
3875 pr_crit("%s: Can't create timewait sock SLAB cache!\n",
3911 pr_crit("%s: Can't create request sock SLAB cache!\n",
3939 pr_crit("%s: Can't create sock SLAB cache!\n",
4138 struct sock *sk = p;
4152 int sock_bind_add(struct sock *sk, struct sockaddr *addr, int addr_len)
4161 int sock_ioctl_inout(struct sock *sk, unsigned int cmd,
4184 static int sock_ioctl_out(struct sock *sk, unsigned int cmd, void __user *arg)
4195 /* A wrapper around sock ioctls, which copies the data from userspace
4200 int sk_ioctl(struct sock *sk, unsigned int cmd, void __user *arg)