Lines Matching refs:sock

184 static inline int unix_our_peer(struct sock *sk, struct sock *osk)  in unix_our_peer()
189 static inline int unix_may_send(struct sock *sk, struct sock *osk) in unix_may_send()
194 static inline int unix_recvq_full(struct sock const *sk) in unix_recvq_full()
199 struct sock *unix_peer_get(struct sock *s) in unix_peer_get()
201 struct sock *peer; in unix_peer_get()
248 static void __unix_remove_socket(struct sock *sk) in __unix_remove_socket()
253 static void __unix_insert_socket(struct hlist_head *list, struct sock *sk) in __unix_insert_socket()
259 static inline void unix_remove_socket(struct sock *sk) in unix_remove_socket()
266 static inline void unix_insert_socket(struct hlist_head *list, struct sock *sk) in unix_insert_socket()
273 static struct sock *__unix_find_socket_byname(struct net *net, in __unix_find_socket_byname()
277 struct sock *s; in __unix_find_socket_byname()
294 static inline struct sock *unix_find_socket_byname(struct net *net, in unix_find_socket_byname()
299 struct sock *s; in unix_find_socket_byname()
309 static struct sock *unix_find_socket_byinode(struct inode *i) in unix_find_socket_byinode()
311 struct sock *s; in unix_find_socket_byinode()
374 static int unix_dgram_peer_wake_connect(struct sock *sk, struct sock *other) in unix_dgram_peer_wake_connect()
395 static void unix_dgram_peer_wake_disconnect(struct sock *sk, in unix_dgram_peer_wake_disconnect()
396 struct sock *other) in unix_dgram_peer_wake_disconnect()
412 static void unix_dgram_peer_wake_disconnect_wakeup(struct sock *sk, in unix_dgram_peer_wake_disconnect_wakeup()
413 struct sock *other) in unix_dgram_peer_wake_disconnect_wakeup()
426 static int unix_dgram_peer_wake_me(struct sock *sk, struct sock *other) in unix_dgram_peer_wake_me()
441 static int unix_writable(const struct sock *sk) in unix_writable()
447 static void unix_write_space(struct sock *sk) in unix_write_space()
466 static void unix_dgram_disconnected(struct sock *sk, struct sock *other) in unix_dgram_disconnected()
483 static void unix_sock_destructor(struct sock *sk) in unix_sock_destructor()
510 static void unix_release_sock(struct sock *sk, int embrion) in unix_release_sock()
514 struct sock *skpair; in unix_release_sock()
584 static void init_peercred(struct sock *sk) in init_peercred()
593 static void copy_peercred(struct sock *sk, struct sock *peersk) in copy_peercred()
602 static int unix_listen(struct socket *sock, int backlog) in unix_listen() argument
605 struct sock *sk = sock->sk; in unix_listen()
610 if (sock->type != SOCK_STREAM && sock->type != SOCK_SEQPACKET) in unix_listen()
660 static int unix_set_peek_off(struct sock *sk, int val) in unix_set_peek_off()
755 static struct sock *unix_create1(struct net *net, struct socket *sock, int kern) in unix_create1() argument
757 struct sock *sk = NULL; in unix_create1()
768 sock_init_data(sock, sk); in unix_create1()
796 static int unix_create(struct net *net, struct socket *sock, int protocol, in unix_create() argument
802 sock->state = SS_UNCONNECTED; in unix_create()
804 switch (sock->type) { in unix_create()
806 sock->ops = &unix_stream_ops; in unix_create()
813 sock->type = SOCK_DGRAM; in unix_create()
815 sock->ops = &unix_dgram_ops; in unix_create()
818 sock->ops = &unix_seqpacket_ops; in unix_create()
824 return unix_create1(net, sock, kern) ? 0 : -ENOMEM; in unix_create()
827 static int unix_release(struct socket *sock) in unix_release() argument
829 struct sock *sk = sock->sk; in unix_release()
835 sock->sk = NULL; in unix_release()
840 static int unix_autobind(struct socket *sock) in unix_autobind() argument
842 struct sock *sk = sock->sk; in unix_autobind()
873 if (__unix_find_socket_byname(net, addr->name, addr->len, sock->type, in unix_autobind()
901 static struct sock *unix_find_other(struct net *net, in unix_find_other()
905 struct sock *u; in unix_find_other()
973 static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) in unix_bind() argument
975 struct sock *sk = sock->sk; in unix_bind()
992 err = unix_autobind(sock); in unix_bind()
1042 (SOCK_INODE(sock)->i_mode & ~current_umask()); in unix_bind()
1084 static void unix_state_double_lock(struct sock *sk1, struct sock *sk2) in unix_state_double_lock()
1099 static void unix_state_double_unlock(struct sock *sk1, struct sock *sk2) in unix_state_double_unlock()
1109 static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr, in unix_dgram_connect() argument
1112 struct sock *sk = sock->sk; in unix_dgram_connect()
1115 struct sock *other; in unix_dgram_connect()
1125 if (test_bit(SOCK_PASSCRED, &sock->flags) && in unix_dgram_connect()
1126 !unix_sk(sk)->addr && (err = unix_autobind(sock)) != 0) in unix_dgram_connect()
1130 other = unix_find_other(net, sunaddr, alen, sock->type, hash, &err); in unix_dgram_connect()
1163 struct sock *old_peer = unix_peer(sk); in unix_dgram_connect()
1185 static long unix_wait_for_peer(struct sock *other, long timeo) in unix_wait_for_peer()
1206 static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr, in unix_stream_connect() argument
1210 struct sock *sk = sock->sk; in unix_stream_connect()
1213 struct sock *newsk = NULL; in unix_stream_connect()
1214 struct sock *other = NULL; in unix_stream_connect()
1226 if (test_bit(SOCK_PASSCRED, &sock->flags) && !u->addr && in unix_stream_connect()
1227 (err = unix_autobind(sock)) != 0) in unix_stream_connect()
1350 sock->state = SS_CONNECTED; in unix_stream_connect()
1383 struct sock *ska = socka->sk, *skb = sockb->sk; in unix_socketpair()
1411 static int unix_accept(struct socket *sock, struct socket *newsock, int flags) in unix_accept() argument
1413 struct sock *sk = sock->sk; in unix_accept()
1414 struct sock *tsk; in unix_accept()
1419 if (sock->type != SOCK_STREAM && sock->type != SOCK_SEQPACKET) in unix_accept()
1445 unix_sock_inherit_flags(sock, newsock); in unix_accept()
1455 static int unix_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len, int peer) in unix_getname() argument
1457 struct sock *sk = sock->sk; in unix_getname()
1543 struct sock *sk = unix_get_socket(scm->fp->fp[i]); in unix_attach_fds()
1584 static bool unix_passcred_enabled(const struct socket *sock, in unix_passcred_enabled() argument
1585 const struct sock *other) in unix_passcred_enabled()
1587 return test_bit(SOCK_PASSCRED, &sock->flags) || in unix_passcred_enabled()
1597 static void maybe_add_creds(struct sk_buff *skb, const struct socket *sock, in maybe_add_creds() argument
1598 const struct sock *other) in maybe_add_creds()
1602 if (unix_passcred_enabled(sock, other)) { in maybe_add_creds()
1610 const struct sock *other) in maybe_init_creds()
1641 static int unix_dgram_sendmsg(struct socket *sock, struct msghdr *msg, in unix_dgram_sendmsg() argument
1644 struct sock *sk = sock->sk; in unix_dgram_sendmsg()
1648 struct sock *other = NULL; in unix_dgram_sendmsg()
1660 err = scm_send(sock, msg, &scm, false); in unix_dgram_sendmsg()
1681 if (test_bit(SOCK_PASSCRED, &sock->flags) && !u->addr in unix_dgram_sendmsg()
1682 && (err = unix_autobind(sock)) != 0) in unix_dgram_sendmsg()
1823 maybe_add_creds(skb, sock, other); in unix_dgram_sendmsg()
1851 static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg, in unix_stream_sendmsg() argument
1854 struct sock *sk = sock->sk; in unix_stream_sendmsg()
1855 struct sock *other = NULL; in unix_stream_sendmsg()
1865 err = scm_send(sock, msg, &scm, false); in unix_stream_sendmsg()
1929 maybe_add_creds(skb, sock, other); in unix_stream_sendmsg()
1961 struct sock *other, *sk = socket->sk; in unix_stream_sendpage()
2070 static int unix_seqpacket_sendmsg(struct socket *sock, struct msghdr *msg, in unix_seqpacket_sendmsg() argument
2074 struct sock *sk = sock->sk; in unix_seqpacket_sendmsg()
2086 return unix_dgram_sendmsg(sock, msg, len); in unix_seqpacket_sendmsg()
2089 static int unix_seqpacket_recvmsg(struct socket *sock, struct msghdr *msg, in unix_seqpacket_recvmsg() argument
2092 struct sock *sk = sock->sk; in unix_seqpacket_recvmsg()
2097 return unix_dgram_recvmsg(sock, msg, size, flags); in unix_seqpacket_recvmsg()
2100 static void unix_copy_addr(struct msghdr *msg, struct sock *sk) in unix_copy_addr()
2110 static int unix_dgram_recvmsg(struct socket *sock, struct msghdr *msg, in unix_dgram_recvmsg() argument
2114 struct sock *sk = sock->sk; in unix_dgram_recvmsg()
2196 scm_recv(sock, msg, &scm, flags); in unix_dgram_recvmsg()
2209 static long unix_stream_data_wait(struct sock *sk, long timeo, in unix_stream_data_wait()
2264 struct socket *sock = state->socket; in unix_stream_read_generic() local
2265 struct sock *sk = sock->sk; in unix_stream_read_generic()
2370 } else if (test_bit(SOCK_PASSCRED, &sock->flags)) { in unix_stream_read_generic()
2453 scm_recv(sock, state->msg, &scm, flags); in unix_stream_read_generic()
2471 static int unix_stream_recvmsg(struct socket *sock, struct msghdr *msg, in unix_stream_recvmsg() argument
2476 .socket = sock, in unix_stream_recvmsg()
2485 static ssize_t skb_unix_socket_splice(struct sock *sk, in skb_unix_socket_splice()
2509 static ssize_t unix_stream_splice_read(struct socket *sock, loff_t *ppos, in unix_stream_splice_read() argument
2515 .socket = sock, in unix_stream_splice_read()
2524 if (sock->file->f_flags & O_NONBLOCK || in unix_stream_splice_read()
2531 static int unix_shutdown(struct socket *sock, int mode) in unix_shutdown() argument
2533 struct sock *sk = sock->sk; in unix_shutdown()
2534 struct sock *other; in unix_shutdown()
2577 long unix_inq_len(struct sock *sk) in unix_inq_len()
2601 long unix_outq_len(struct sock *sk) in unix_outq_len()
2607 static int unix_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) in unix_ioctl() argument
2609 struct sock *sk = sock->sk; in unix_ioctl()
2632 static unsigned int unix_poll(struct file *file, struct socket *sock, poll_table *wait) in unix_poll() argument
2634 struct sock *sk = sock->sk; in unix_poll()
2667 static unsigned int unix_dgram_poll(struct file *file, struct socket *sock, in unix_dgram_poll() argument
2670 struct sock *sk = sock->sk, *other; in unix_dgram_poll()
2732 static struct sock *unix_from_bucket(struct seq_file *seq, loff_t *pos) in unix_from_bucket()
2736 struct sock *sk; in unix_from_bucket()
2749 static struct sock *unix_next_socket(struct seq_file *seq, in unix_next_socket()
2750 struct sock *sk, in unix_next_socket()
2755 while (sk > (struct sock *)SEQ_START_TOKEN) { in unix_next_socket()
2809 struct sock *s = v; in unix_seq_show()