Lines Matching refs:sock

174 static inline int unix_our_peer(struct sock *sk, struct sock *osk)  in unix_our_peer()
179 static inline int unix_may_send(struct sock *sk, struct sock *osk) in unix_may_send()
184 static inline int unix_recvq_full(struct sock const *sk) in unix_recvq_full()
189 struct sock *unix_peer_get(struct sock *s) in unix_peer_get()
191 struct sock *peer; in unix_peer_get()
238 static void __unix_remove_socket(struct sock *sk) in __unix_remove_socket()
243 static void __unix_insert_socket(struct hlist_head *list, struct sock *sk) in __unix_insert_socket()
249 static inline void unix_remove_socket(struct sock *sk) in unix_remove_socket()
256 static inline void unix_insert_socket(struct hlist_head *list, struct sock *sk) in unix_insert_socket()
263 static struct sock *__unix_find_socket_byname(struct net *net, in __unix_find_socket_byname()
267 struct sock *s; in __unix_find_socket_byname()
284 static inline struct sock *unix_find_socket_byname(struct net *net, in unix_find_socket_byname()
289 struct sock *s; in unix_find_socket_byname()
299 static struct sock *unix_find_socket_byinode(struct inode *i) in unix_find_socket_byinode()
301 struct sock *s; in unix_find_socket_byinode()
364 static int unix_dgram_peer_wake_connect(struct sock *sk, struct sock *other) in unix_dgram_peer_wake_connect()
385 static void unix_dgram_peer_wake_disconnect(struct sock *sk, in unix_dgram_peer_wake_disconnect()
386 struct sock *other) in unix_dgram_peer_wake_disconnect()
402 static void unix_dgram_peer_wake_disconnect_wakeup(struct sock *sk, in unix_dgram_peer_wake_disconnect_wakeup()
403 struct sock *other) in unix_dgram_peer_wake_disconnect_wakeup()
416 static int unix_dgram_peer_wake_me(struct sock *sk, struct sock *other) in unix_dgram_peer_wake_me()
431 static inline int unix_writable(struct sock *sk) in unix_writable()
436 static void unix_write_space(struct sock *sk) in unix_write_space()
455 static void unix_dgram_disconnected(struct sock *sk, struct sock *other) in unix_dgram_disconnected()
472 static void unix_sock_destructor(struct sock *sk) in unix_sock_destructor()
499 static void unix_release_sock(struct sock *sk, int embrion) in unix_release_sock()
503 struct sock *skpair; in unix_release_sock()
572 static void init_peercred(struct sock *sk) in init_peercred()
581 static void copy_peercred(struct sock *sk, struct sock *peersk) in copy_peercred()
590 static int unix_listen(struct socket *sock, int backlog) in unix_listen() argument
593 struct sock *sk = sock->sk; in unix_listen()
598 if (sock->type != SOCK_STREAM && sock->type != SOCK_SEQPACKET) in unix_listen()
643 static int unix_set_peek_off(struct sock *sk, int val) in unix_set_peek_off()
737 static struct sock *unix_create1(struct net *net, struct socket *sock) in unix_create1() argument
739 struct sock *sk = NULL; in unix_create1()
750 sock_init_data(sock, sk); in unix_create1()
778 static int unix_create(struct net *net, struct socket *sock, int protocol, in unix_create() argument
784 sock->state = SS_UNCONNECTED; in unix_create()
786 switch (sock->type) { in unix_create()
788 sock->ops = &unix_stream_ops; in unix_create()
795 sock->type = SOCK_DGRAM; in unix_create()
797 sock->ops = &unix_dgram_ops; in unix_create()
800 sock->ops = &unix_seqpacket_ops; in unix_create()
806 return unix_create1(net, sock) ? 0 : -ENOMEM; in unix_create()
809 static int unix_release(struct socket *sock) in unix_release() argument
811 struct sock *sk = sock->sk; in unix_release()
817 sock->sk = NULL; in unix_release()
822 static int unix_autobind(struct socket *sock) in unix_autobind() argument
824 struct sock *sk = sock->sk; in unix_autobind()
855 if (__unix_find_socket_byname(net, addr->name, addr->len, sock->type, in unix_autobind()
883 static struct sock *unix_find_other(struct net *net, in unix_find_other()
887 struct sock *u; in unix_find_other()
967 static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) in unix_bind() argument
969 struct sock *sk = sock->sk; in unix_bind()
984 err = unix_autobind(sock); in unix_bind()
1014 (SOCK_INODE(sock)->i_mode & ~current_umask()); in unix_bind()
1052 static void unix_state_double_lock(struct sock *sk1, struct sock *sk2) in unix_state_double_lock()
1067 static void unix_state_double_unlock(struct sock *sk1, struct sock *sk2) in unix_state_double_unlock()
1077 static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr, in unix_dgram_connect() argument
1080 struct sock *sk = sock->sk; in unix_dgram_connect()
1083 struct sock *other; in unix_dgram_connect()
1093 if (test_bit(SOCK_PASSCRED, &sock->flags) && in unix_dgram_connect()
1094 !unix_sk(sk)->addr && (err = unix_autobind(sock)) != 0) in unix_dgram_connect()
1098 other = unix_find_other(net, sunaddr, alen, sock->type, hash, &err); in unix_dgram_connect()
1131 struct sock *old_peer = unix_peer(sk); in unix_dgram_connect()
1153 static long unix_wait_for_peer(struct sock *other, long timeo) in unix_wait_for_peer()
1174 static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr, in unix_stream_connect() argument
1178 struct sock *sk = sock->sk; in unix_stream_connect()
1181 struct sock *newsk = NULL; in unix_stream_connect()
1182 struct sock *other = NULL; in unix_stream_connect()
1194 if (test_bit(SOCK_PASSCRED, &sock->flags) && !u->addr && in unix_stream_connect()
1195 (err = unix_autobind(sock)) != 0) in unix_stream_connect()
1318 sock->state = SS_CONNECTED; in unix_stream_connect()
1351 struct sock *ska = socka->sk, *skb = sockb->sk; in unix_socketpair()
1379 static int unix_accept(struct socket *sock, struct socket *newsock, int flags) in unix_accept() argument
1381 struct sock *sk = sock->sk; in unix_accept()
1382 struct sock *tsk; in unix_accept()
1387 if (sock->type != SOCK_STREAM && sock->type != SOCK_SEQPACKET) in unix_accept()
1413 unix_sock_inherit_flags(sock, newsock); in unix_accept()
1423 static int unix_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len, int peer) in unix_getname() argument
1425 struct sock *sk = sock->sk; in unix_getname()
1511 struct sock *sk = unix_get_socket(scm->fp->fp[i]); in unix_attach_fds()
1556 static void maybe_add_creds(struct sk_buff *skb, const struct socket *sock, in maybe_add_creds() argument
1557 const struct sock *other) in maybe_add_creds()
1561 if (test_bit(SOCK_PASSCRED, &sock->flags) || in maybe_add_creds()
1573 static int unix_dgram_sendmsg(struct socket *sock, struct msghdr *msg, in unix_dgram_sendmsg() argument
1576 struct sock *sk = sock->sk; in unix_dgram_sendmsg()
1580 struct sock *other = NULL; in unix_dgram_sendmsg()
1592 err = scm_send(sock, msg, &scm, false); in unix_dgram_sendmsg()
1613 if (test_bit(SOCK_PASSCRED, &sock->flags) && !u->addr in unix_dgram_sendmsg()
1614 && (err = unix_autobind(sock)) != 0) in unix_dgram_sendmsg()
1756 maybe_add_creds(skb, sock, other); in unix_dgram_sendmsg()
1784 static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg, in unix_stream_sendmsg() argument
1787 struct sock *sk = sock->sk; in unix_stream_sendmsg()
1788 struct sock *other = NULL; in unix_stream_sendmsg()
1798 err = scm_send(sock, msg, &scm, false); in unix_stream_sendmsg()
1862 maybe_add_creds(skb, sock, other); in unix_stream_sendmsg()
1887 static int unix_seqpacket_sendmsg(struct socket *sock, struct msghdr *msg, in unix_seqpacket_sendmsg() argument
1891 struct sock *sk = sock->sk; in unix_seqpacket_sendmsg()
1903 return unix_dgram_sendmsg(sock, msg, len); in unix_seqpacket_sendmsg()
1906 static int unix_seqpacket_recvmsg(struct socket *sock, struct msghdr *msg, in unix_seqpacket_recvmsg() argument
1909 struct sock *sk = sock->sk; in unix_seqpacket_recvmsg()
1914 return unix_dgram_recvmsg(sock, msg, size, flags); in unix_seqpacket_recvmsg()
1917 static void unix_copy_addr(struct msghdr *msg, struct sock *sk) in unix_copy_addr()
1927 static int unix_dgram_recvmsg(struct socket *sock, struct msghdr *msg, in unix_dgram_recvmsg() argument
1931 struct sock *sk = sock->sk; in unix_dgram_recvmsg()
2013 scm_recv(sock, msg, &scm, flags); in unix_dgram_recvmsg()
2026 static long unix_stream_data_wait(struct sock *sk, long timeo, in unix_stream_data_wait()
2064 static int unix_stream_recvmsg(struct socket *sock, struct msghdr *msg, in unix_stream_recvmsg() argument
2068 struct sock *sk = sock->sk; in unix_stream_recvmsg()
2166 } else if (test_bit(SOCK_PASSCRED, &sock->flags)) { in unix_stream_recvmsg()
2228 scm_recv(sock, msg, &scm, flags); in unix_stream_recvmsg()
2233 static int unix_shutdown(struct socket *sock, int mode) in unix_shutdown() argument
2235 struct sock *sk = sock->sk; in unix_shutdown()
2236 struct sock *other; in unix_shutdown()
2279 long unix_inq_len(struct sock *sk) in unix_inq_len()
2303 long unix_outq_len(struct sock *sk) in unix_outq_len()
2309 static int unix_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) in unix_ioctl() argument
2311 struct sock *sk = sock->sk; in unix_ioctl()
2334 static unsigned int unix_poll(struct file *file, struct socket *sock, poll_table *wait) in unix_poll() argument
2336 struct sock *sk = sock->sk; in unix_poll()
2369 static unsigned int unix_dgram_poll(struct file *file, struct socket *sock, in unix_dgram_poll() argument
2372 struct sock *sk = sock->sk, *other; in unix_dgram_poll()
2434 static struct sock *unix_from_bucket(struct seq_file *seq, loff_t *pos) in unix_from_bucket()
2438 struct sock *sk; in unix_from_bucket()
2451 static struct sock *unix_next_socket(struct seq_file *seq, in unix_next_socket()
2452 struct sock *sk, in unix_next_socket()
2457 while (sk > (struct sock *)SEQ_START_TOKEN) { in unix_next_socket()
2511 struct sock *s = v; in unix_seq_show()