Lines Matching defs:sock
103 #include <net/sock.h>
131 static unsigned int unix_unbound_hash(struct sock *sk)
215 static inline int unix_our_peer(struct sock *sk, struct sock *osk)
220 static inline int unix_may_send(struct sock *sk, struct sock *osk)
225 static inline int unix_recvq_full(const struct sock *sk)
230 static inline int unix_recvq_full_lockless(const struct sock *sk)
236 struct sock *unix_peer_get(struct sock *s)
238 struct sock *peer;
315 static void __unix_remove_socket(struct sock *sk)
320 static void __unix_insert_socket(struct net *net, struct sock *sk)
326 static void __unix_set_addr_hash(struct net *net, struct sock *sk,
336 static void unix_remove_socket(struct net *net, struct sock *sk)
343 static void unix_insert_unbound_socket(struct net *net, struct sock *sk)
350 static void unix_insert_bsd_socket(struct sock *sk)
357 static void unix_remove_bsd_socket(struct sock *sk)
368 static struct sock *__unix_find_socket_byname(struct net *net,
372 struct sock *s;
384 static inline struct sock *unix_find_socket_byname(struct net *net,
388 struct sock *s;
398 static struct sock *unix_find_socket_byinode(struct inode *i)
401 struct sock *s;
462 static int unix_dgram_peer_wake_connect(struct sock *sk, struct sock *other)
483 static void unix_dgram_peer_wake_disconnect(struct sock *sk,
484 struct sock *other)
500 static void unix_dgram_peer_wake_disconnect_wakeup(struct sock *sk,
501 struct sock *other)
514 static int unix_dgram_peer_wake_me(struct sock *sk, struct sock *other)
534 static int unix_writable(const struct sock *sk)
540 static void unix_write_space(struct sock *sk)
559 static void unix_dgram_disconnected(struct sock *sk, struct sock *other)
577 static void unix_sock_destructor(struct sock *sk)
602 static void unix_release_sock(struct sock *sk, int embrion)
605 struct sock *skpair;
676 * Can't we simply set sock->err?
685 static void init_peercred(struct sock *sk)
701 static void copy_peercred(struct sock *sk, struct sock *peersk)
725 static int unix_listen(struct socket *sock, int backlog)
728 struct sock *sk = sock->sk;
732 if (sock->type != SOCK_STREAM && sock->type != SOCK_SEQPACKET)
766 static int unix_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
776 static int unix_read_skb(struct sock *sk, skb_read_actor_t recv_actor);
777 static int unix_stream_read_skb(struct sock *sk, skb_read_actor_t recv_actor);
784 static int unix_set_peek_off(struct sock *sk, int val)
798 static int unix_count_nr_fds(struct sock *sk)
816 static void unix_show_fdinfo(struct seq_file *m, struct socket *sock)
818 struct sock *sk = sock->sk;
831 if (sock->type == SOCK_DGRAM || s_state == TCP_ESTABLISHED)
915 static void unix_close(struct sock *sk, long timeout)
922 static void unix_unhash(struct sock *sk)
966 static struct sock *unix_create1(struct net *net, struct socket *sock, int kern, int type)
969 struct sock *sk;
988 sock_init_data(sock, sk);
1017 static int unix_create(struct net *net, struct socket *sock, int protocol,
1020 struct sock *sk;
1025 sock->state = SS_UNCONNECTED;
1027 switch (sock->type) {
1029 sock->ops = &unix_stream_ops;
1036 sock->type = SOCK_DGRAM;
1039 sock->ops = &unix_dgram_ops;
1042 sock->ops = &unix_seqpacket_ops;
1048 sk = unix_create1(net, sock, kern, sock->type);
1055 static int unix_release(struct socket *sock)
1057 struct sock *sk = sock->sk;
1064 sock->sk = NULL;
1069 static struct sock *unix_find_bsd(struct sockaddr_un *sunaddr, int addr_len,
1074 struct sock *sk;
1113 static struct sock *unix_find_abstract(struct net *net,
1119 struct sock *sk;
1132 static struct sock *unix_find_other(struct net *net,
1136 struct sock *sk;
1146 static int unix_autobind(struct sock *sk)
1207 static int unix_bind_bsd(struct sock *sk, struct sockaddr_un *sunaddr,
1275 static int unix_bind_abstract(struct sock *sk, struct sockaddr_un *sunaddr,
1318 static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
1321 struct sock *sk = sock->sk;
1340 static void unix_state_double_lock(struct sock *sk1, struct sock *sk2)
1353 static void unix_state_double_unlock(struct sock *sk1, struct sock *sk2)
1363 static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr,
1367 struct sock *sk = sock->sk;
1368 struct sock *other;
1380 if ((test_bit(SOCK_PASSCRED, &sock->flags) ||
1381 test_bit(SOCK_PASSPIDFD, &sock->flags)) &&
1389 other = unix_find_other(sock_net(sk), sunaddr, alen, sock->type);
1425 struct sock *old_peer = unix_peer(sk);
1451 static long unix_wait_for_peer(struct sock *other, long timeo)
1473 static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr,
1477 struct sock *sk = sock->sk, *newsk = NULL, *other = NULL;
1489 if ((test_bit(SOCK_PASSCRED, &sock->flags) ||
1490 test_bit(SOCK_PASSPIDFD, &sock->flags)) && !u->addr) {
1503 /* create new sock for complete connection */
1504 newsk = unix_create1(net, NULL, 0, sock->type);
1513 /* Allocate skb for sending to listening sock */
1519 /* Find listening sock. */
1609 /* copy address information from listening to new sock
1636 sock->state = SS_CONNECTED;
1645 /* take ten and send info to listening sock */
1669 struct sock *ska = socka->sk, *skb = sockb->sk;
1697 static int unix_accept(struct socket *sock, struct socket *newsock, int flags,
1700 struct sock *sk = sock->sk;
1701 struct sock *tsk;
1706 if (sock->type != SOCK_STREAM && sock->type != SOCK_SEQPACKET)
1730 /* attach accepted sock to socket */
1733 unix_sock_inherit_flags(sock, newsock);
1743 static int unix_getname(struct socket *sock, struct sockaddr *uaddr, int peer)
1745 struct sock *sk = sock->sk;
1838 static bool unix_passcred_enabled(const struct socket *sock,
1839 const struct sock *other)
1841 return test_bit(SOCK_PASSCRED, &sock->flags) ||
1842 test_bit(SOCK_PASSPIDFD, &sock->flags) ||
1853 static void maybe_add_creds(struct sk_buff *skb, const struct socket *sock,
1854 const struct sock *other)
1858 if (unix_passcred_enabled(sock, other)) {
1873 static void scm_stat_add(struct sock *sk, struct sk_buff *skb)
1882 static void scm_stat_del(struct sock *sk, struct sk_buff *skb)
1895 static int unix_dgram_sendmsg(struct socket *sock, struct msghdr *msg,
1899 struct sock *sk = sock->sk, *other = NULL;
1909 err = scm_send(sock, msg, &scm, false);
1929 if ((test_bit(SOCK_PASSCRED, &sock->flags) ||
1930 test_bit(SOCK_PASSPIDFD, &sock->flags)) && !u->addr) {
2085 maybe_add_creds(skb, sock, other);
2113 static int queue_oob(struct socket *sock, struct msghdr *msg, struct sock *other,
2120 skb = sock_alloc_send_skb(sock->sk, 1, msg->msg_flags & MSG_DONTWAIT, &err);
2147 maybe_add_creds(skb, sock, other);
2165 static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg,
2168 struct sock *sk = sock->sk;
2169 struct sock *other = NULL;
2178 err = scm_send(sock, msg, &scm, false);
2264 maybe_add_creds(skb, sock, other);
2274 err = queue_oob(sock, msg, other, &scm, fds_sent);
2297 static int unix_seqpacket_sendmsg(struct socket *sock, struct msghdr *msg,
2301 struct sock *sk = sock->sk;
2313 return unix_dgram_sendmsg(sock, msg, len);
2316 static int unix_seqpacket_recvmsg(struct socket *sock, struct msghdr *msg,
2319 struct sock *sk = sock->sk;
2324 return unix_dgram_recvmsg(sock, msg, size, flags);
2327 static void unix_copy_addr(struct msghdr *msg, struct sock *sk)
2337 int __unix_dgram_recvmsg(struct sock *sk, struct msghdr *msg, size_t size,
2341 struct socket *sock = sk->sk_socket;
2435 scm_recv_unix(sock, msg, &scm, flags);
2444 static int unix_dgram_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
2447 struct sock *sk = sock->sk;
2458 static int unix_read_skb(struct sock *sk, skb_read_actor_t recv_actor)
2476 static long unix_stream_data_wait(struct sock *sk, long timeo,
2533 struct socket *sock = state->socket;
2534 struct sock *sk = sock->sk;
2572 static struct sk_buff *manage_oob(struct sk_buff *skb, struct sock *sk,
2601 static int unix_stream_read_skb(struct sock *sk, skb_read_actor_t recv_actor)
2613 struct socket *sock = state->socket;
2614 struct sock *sk = sock->sk;
2731 } else if (test_bit(SOCK_PASSCRED, &sock->flags) ||
2732 test_bit(SOCK_PASSPIDFD, &sock->flags)) {
2817 scm_recv_unix(sock, state->msg, &scm, flags);
2835 int __unix_stream_recvmsg(struct sock *sk, struct msghdr *msg,
2849 static int unix_stream_recvmsg(struct socket *sock, struct msghdr *msg,
2854 .socket = sock,
2861 struct sock *sk = sock->sk;
2879 static ssize_t unix_stream_splice_read(struct socket *sock, loff_t *ppos,
2885 .socket = sock,
2894 if (sock->file->f_flags & O_NONBLOCK ||
2901 static int unix_shutdown(struct socket *sock, int mode)
2903 struct sock *sk = sock->sk;
2904 struct sock *other;
2950 long unix_inq_len(struct sock *sk)
2974 long unix_outq_len(struct sock *sk)
2980 static int unix_open_file(struct sock *sk)
3016 static int unix_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
3018 struct sock *sk = sock->sk;
3058 static int unix_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
3060 return unix_ioctl(sock, cmd, (unsigned long)compat_ptr(arg));
3064 static __poll_t unix_poll(struct file *file, struct socket *sock, poll_table *wait)
3066 struct sock *sk = sock->sk;
3070 sock_poll_wait(file, sock, wait);
3107 static __poll_t unix_dgram_poll(struct file *file, struct socket *sock,
3110 struct sock *sk = sock->sk, *other;
3115 sock_poll_wait(file, sock, wait);
3178 static struct sock *unix_from_bucket(struct seq_file *seq, loff_t *pos)
3183 struct sock *sk;
3194 static struct sock *unix_get_first(struct seq_file *seq, loff_t *pos)
3198 struct sock *sk;
3215 static struct sock *unix_get_next(struct seq_file *seq, struct sock *sk,
3252 struct sock *sk = v;
3265 struct sock *s = v;
3317 struct sock **batch;
3339 static int bpf_iter_unix_hold_batch(struct seq_file *seq, struct sock *start_sk)
3344 struct sock *sk;
3372 struct sock **new_batch;
3387 static struct sock *bpf_iter_unix_batch(struct seq_file *seq,
3393 struct sock *sk;
3436 struct sock *sk;
3459 struct sock *sk = v;