Lines Matching defs:sock
102 #include <net/sock.h>
182 static inline int unix_our_peer(struct sock *sk, struct sock *osk)
187 static inline int unix_may_send(struct sock *sk, struct sock *osk)
192 static inline int unix_recvq_full(const struct sock *sk)
197 static inline int unix_recvq_full_lockless(const struct sock *sk)
203 struct sock *unix_peer_get(struct sock *s)
205 struct sock *peer;
254 static void __unix_remove_socket(struct sock *sk)
259 static void __unix_insert_socket(struct hlist_head *list, struct sock *sk)
265 static inline void unix_remove_socket(struct sock *sk)
272 static inline void unix_insert_socket(struct hlist_head *list, struct sock *sk)
279 static struct sock *__unix_find_socket_byname(struct net *net,
283 struct sock *s;
298 static inline struct sock *unix_find_socket_byname(struct net *net,
303 struct sock *s;
313 static struct sock *unix_find_socket_byinode(struct inode *i)
315 struct sock *s;
378 static int unix_dgram_peer_wake_connect(struct sock *sk, struct sock *other)
399 static void unix_dgram_peer_wake_disconnect(struct sock *sk,
400 struct sock *other)
416 static void unix_dgram_peer_wake_disconnect_wakeup(struct sock *sk,
417 struct sock *other)
430 static int unix_dgram_peer_wake_me(struct sock *sk, struct sock *other)
450 static int unix_writable(const struct sock *sk)
456 static void unix_write_space(struct sock *sk)
475 static void unix_dgram_disconnected(struct sock *sk, struct sock *other)
492 static void unix_sock_destructor(struct sock *sk)
519 static void unix_release_sock(struct sock *sk, int embrion)
523 struct sock *skpair;
585 * Can't we simply set sock->err?
594 static void init_peercred(struct sock *sk)
610 static void copy_peercred(struct sock *sk, struct sock *peersk)
634 static int unix_listen(struct socket *sock, int backlog)
637 struct sock *sk = sock->sk;
641 if (sock->type != SOCK_STREAM && sock->type != SOCK_SEQPACKET)
675 static int unix_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
693 static int unix_set_peek_off(struct sock *sk, int val)
707 static void unix_show_fdinfo(struct seq_file *m, struct socket *sock)
709 struct sock *sk = sock->sk;
713 u = unix_sk(sock->sk);
801 static struct sock *unix_create1(struct net *net, struct socket *sock, int kern)
803 struct sock *sk = NULL;
814 sock_init_data(sock, sk);
843 static int unix_create(struct net *net, struct socket *sock, int protocol,
849 sock->state = SS_UNCONNECTED;
851 switch (sock->type) {
853 sock->ops = &unix_stream_ops;
860 sock->type = SOCK_DGRAM;
863 sock->ops = &unix_dgram_ops;
866 sock->ops = &unix_seqpacket_ops;
872 return unix_create1(net, sock, kern) ? 0 : -ENOMEM;
875 static int unix_release(struct socket *sock)
877 struct sock *sk = sock->sk;
883 sock->sk = NULL;
888 static int unix_autobind(struct socket *sock)
890 struct sock *sk = sock->sk;
920 if (__unix_find_socket_byname(net, addr->name, addr->len, sock->type,
948 static struct sock *unix_find_other(struct net *net,
952 struct sock *u;
1032 static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
1034 struct sock *sk = sock->sk;
1051 err = unix_autobind(sock);
1062 (SOCK_INODE(sock)->i_mode & ~current_umask());
1123 static void unix_state_double_lock(struct sock *sk1, struct sock *sk2)
1136 static void unix_state_double_unlock(struct sock *sk1, struct sock *sk2)
1146 static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr,
1149 struct sock *sk = sock->sk;
1152 struct sock *other;
1166 if (test_bit(SOCK_PASSCRED, &sock->flags) &&
1167 !unix_sk(sk)->addr && (err = unix_autobind(sock)) != 0)
1171 other = unix_find_other(net, sunaddr, alen, sock->type, hash, &err);
1204 struct sock *old_peer = unix_peer(sk);
1226 static long unix_wait_for_peer(struct sock *other, long timeo)
1248 static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr,
1252 struct sock *sk = sock->sk;
1255 struct sock *newsk = NULL;
1256 struct sock *other = NULL;
1268 if (test_bit(SOCK_PASSCRED, &sock->flags) && !u->addr &&
1269 (err = unix_autobind(sock)) != 0)
1281 /* create new sock for complete connection */
1286 /* Allocate skb for sending to listening sock */
1292 /* Find listening sock. */
1379 /* copy address information from listening to new sock
1406 sock->state = SS_CONNECTED;
1415 /* take ten and and send info to listening sock */
1439 struct sock *ska = socka->sk, *skb = sockb->sk;
1467 static int unix_accept(struct socket *sock, struct socket *newsock, int flags,
1470 struct sock *sk = sock->sk;
1471 struct sock *tsk;
1476 if (sock->type != SOCK_STREAM && sock->type != SOCK_SEQPACKET)
1499 /* attach accepted sock to socket */
1502 unix_sock_inherit_flags(sock, newsock);
1512 static int unix_getname(struct socket *sock, struct sockaddr *uaddr, int peer)
1514 struct sock *sk = sock->sk;
1607 static bool unix_passcred_enabled(const struct socket *sock,
1608 const struct sock *other)
1610 return test_bit(SOCK_PASSCRED, &sock->flags) ||
1620 static void maybe_add_creds(struct sk_buff *skb, const struct socket *sock,
1621 const struct sock *other)
1625 if (unix_passcred_enabled(sock, other)) {
1633 const struct sock *other)
1660 static void scm_stat_add(struct sock *sk, struct sk_buff *skb)
1669 static void scm_stat_del(struct sock *sk, struct sk_buff *skb)
1682 static int unix_dgram_sendmsg(struct socket *sock, struct msghdr *msg,
1685 struct sock *sk = sock->sk;
1689 struct sock *other = NULL;
1700 err = scm_send(sock, msg, &scm, false);
1721 if (test_bit(SOCK_PASSCRED, &sock->flags) && !u->addr
1722 && (err = unix_autobind(sock)) != 0)
1863 maybe_add_creds(skb, sock, other);
1890 static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg,
1893 struct sock *sk = sock->sk;
1894 struct sock *other = NULL;
1903 err = scm_send(sock, msg, &scm, false);
1966 maybe_add_creds(skb, sock, other);
1997 struct sock *other, *sk = socket->sk;
2105 static int unix_seqpacket_sendmsg(struct socket *sock, struct msghdr *msg,
2109 struct sock *sk = sock->sk;
2121 return unix_dgram_sendmsg(sock, msg, len);
2124 static int unix_seqpacket_recvmsg(struct socket *sock, struct msghdr *msg,
2127 struct sock *sk = sock->sk;
2132 return unix_dgram_recvmsg(sock, msg, size, flags);
2135 static void unix_copy_addr(struct msghdr *msg, struct sock *sk)
2145 static int unix_dgram_recvmsg(struct socket *sock, struct msghdr *msg,
2149 struct sock *sk = sock->sk;
2243 scm_recv(sock, msg, &scm, flags);
2255 static long unix_stream_data_wait(struct sock *sk, long timeo,
2315 struct socket *sock = state->socket;
2316 struct sock *sk = sock->sk;
2418 } else if (test_bit(SOCK_PASSCRED, &sock->flags)) {
2503 scm_recv(sock, state->msg, &scm, flags);
2521 static int unix_stream_recvmsg(struct socket *sock, struct msghdr *msg,
2526 .socket = sock,
2544 static ssize_t unix_stream_splice_read(struct socket *sock, loff_t *ppos,
2550 .socket = sock,
2559 if (sock->file->f_flags & O_NONBLOCK ||
2566 static int unix_shutdown(struct socket *sock, int mode)
2568 struct sock *sk = sock->sk;
2569 struct sock *other;
2612 long unix_inq_len(struct sock *sk)
2636 long unix_outq_len(struct sock *sk)
2642 static int unix_open_file(struct sock *sk)
2678 static int unix_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
2680 struct sock *sk = sock->sk;
2707 static int unix_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
2709 return unix_ioctl(sock, cmd, (unsigned long)compat_ptr(arg));
2713 static __poll_t unix_poll(struct file *file, struct socket *sock, poll_table *wait)
2715 struct sock *sk = sock->sk;
2719 sock_poll_wait(file, sock, wait);
2750 static __poll_t unix_dgram_poll(struct file *file, struct socket *sock,
2753 struct sock *sk = sock->sk, *other;
2758 sock_poll_wait(file, sock, wait);
2818 static struct sock *unix_from_bucket(struct seq_file *seq, loff_t *pos)
2822 struct sock *sk;
2835 static struct sock *unix_next_socket(struct seq_file *seq,
2836 struct sock *sk,
2841 while (sk > (struct sock *)SEQ_START_TOKEN) {
2895 struct sock *s = v;