Lines Matching full:socket
3 * NET An implementation of the SOCKET network access protocol.
5 * Version: @(#)socket.c 1.1.93 18/02/95
31 * Linus : Argh. removed all the socket allocation
49 * This module is effectively the top level interface to the BSD socket
58 #include <linux/socket.h>
139 struct socket *sock = f->private_data; in sock_show_fdinfo()
150 …* Socket files have a set of 'special' operations as well as the generic file ones. These don't ap…
232 * Move socket addresses back and forth across the kernel/user
237 * move_addr_to_kernel - copy a socket address into kernel space
311 init_waitqueue_head(&ei->socket.wq.wait); in sock_alloc_inode()
312 ei->socket.wq.fasync_list = NULL; in sock_alloc_inode()
313 ei->socket.wq.flags = 0; in sock_alloc_inode()
315 ei->socket.state = SS_UNCONNECTED; in sock_alloc_inode()
316 ei->socket.flags = 0; in sock_alloc_inode()
317 ei->socket.ops = NULL; in sock_alloc_inode()
318 ei->socket.sk = NULL; in sock_alloc_inode()
319 ei->socket.file = NULL; in sock_alloc_inode()
362 return dynamic_dname(buffer, buflen, "socket:[%lu]", in sockfs_dname()
439 * to socket after mapping. If one day we will need it, this
449 * sock_alloc_file - Bind a &socket to a &file
450 * @sock: socket
462 struct file *sock_alloc_file(struct socket *sock, int flags, const char *dname) in sock_alloc_file()
485 static int sock_map_fd(struct socket *sock, int flags) in sock_map_fd()
505 * sock_from_file - Return the &socket bounded to @file.
511 struct socket *sock_from_file(struct file *file) in sock_from_file()
521 * sockfd_lookup - Go from a file number to its socket slot
525 * The file handle passed in is locked and the socket it is bound
528 * for both invalid handles and passing a handle which is not a socket.
530 * On a success the socket object pointer is returned.
533 struct socket *sockfd_lookup(int fd, int *err) in sockfd_lookup()
536 struct socket *sock; in sockfd_lookup()
553 static struct socket *sockfd_lookup_light(int fd, int *err, int *fput_needed) in sockfd_lookup_light()
556 struct socket *sock; in sockfd_lookup_light()
605 struct socket *sock = SOCKET_I(d_inode(dentry)); in sockfs_setattr()
622 * sock_alloc - allocate a socket
624 * Allocate a new inode and socket object. The two are bound together
625 * and initialised. The socket is then returned. If we are out of inodes
629 struct socket *sock_alloc(void) in sock_alloc()
632 struct socket *sock; in sock_alloc()
650 static void __sock_release(struct socket *sock, struct inode *inode) in __sock_release()
678 * sock_release - close a socket
679 * @sock: socket to close
681 * The socket is released from the protocol stack if it has a release
682 * callback, and the inode is then released if the socket is bound to
685 void sock_release(struct socket *sock) in sock_release()
700 * free running cycle counter for timestamp if socket is bound in __sock_tx_timestamp()
717 INDIRECT_CALLABLE_DECLARE(int inet_sendmsg(struct socket *, struct msghdr *,
719 INDIRECT_CALLABLE_DECLARE(int inet6_sendmsg(struct socket *, struct msghdr *,
728 static inline int sock_sendmsg_nosec(struct socket *sock, struct msghdr *msg) in sock_sendmsg_nosec()
740 static int __sock_sendmsg(struct socket *sock, struct msghdr *msg) in __sock_sendmsg()
750 * @sock: socket
756 int sock_sendmsg(struct socket *sock, struct msghdr *msg) in sock_sendmsg()
778 * @sock: socket
788 int kernel_sendmsg(struct socket *sock, struct msghdr *msg, in kernel_sendmsg()
812 struct socket *sock = sk->sk_socket; in kernel_sendmsg_locked()
828 * in recvmsg, since skbs received on a local socket will never in skb_is_err_queue()
839 * option SO_TIMESTAMP_OLD(NS) is enabled on the socket, even when the skb has a
1033 INDIRECT_CALLABLE_DECLARE(int inet_recvmsg(struct socket *, struct msghdr *,
1035 INDIRECT_CALLABLE_DECLARE(int inet6_recvmsg(struct socket *, struct msghdr *,
1043 static inline int sock_recvmsg_nosec(struct socket *sock, struct msghdr *msg, in sock_recvmsg_nosec()
1057 * @sock: socket
1064 int sock_recvmsg(struct socket *sock, struct msghdr *msg, int flags) in sock_recvmsg()
1073 * kernel_recvmsg - Receive a message from a socket (kernel space)
1074 * @sock: The socket to receive the message from
1088 int kernel_recvmsg(struct socket *sock, struct msghdr *msg, in kernel_recvmsg()
1101 struct socket *sock = file->private_data; in sock_splice_read()
1113 struct socket *sock = file->private_data; in sock_splice_eof()
1124 struct socket *sock = file->private_data; in sock_read_iter()
1146 struct socket *sock = file->private_data; in sock_write_iter()
1212 static long sock_do_ioctl(struct net *net, struct socket *sock, in sock_do_ioctl()
1252 struct socket *sock; in sock_ioctl()
1348 * sock_create_lite - creates a socket
1352 * @res: new socket
1354 * Creates a new socket and assigns it to @res, passing through LSM.
1355 * The new socket initialization is not complete, see kernel_accept().
1360 int sock_create_lite(int family, int type, int protocol, struct socket **res) in sock_create_lite()
1363 struct socket *sock = NULL; in sock_create_lite()
1393 struct socket *sock = file->private_data; in sock_poll()
1405 /* if this socket can poll_ll, tell the system call */ in sock_poll()
1414 struct socket *sock = file->private_data; in sock_mmap()
1426 * Update the socket async list
1430 * 1. fasync_list is modified only under process context socket lock
1433 * or under socket lock
1438 struct socket *sock = filp->private_data; in sock_fasync()
1486 * __sock_create - creates a socket
1491 * @res: new socket
1494 * Creates a new socket and assigns it to @res, passing through LSM.
1496 * be set to true if the socket resides in kernel space.
1501 struct socket **res, int kern) in __sock_create()
1504 struct socket *sock; in __sock_create()
1531 * Allocate the socket and allow the family to set things up. if in __sock_create()
1537 net_warn_ratelimited("socket: no more sockets\n"); in __sock_create()
1577 * socket at sock_release time we decrement its refcnt. in __sock_create()
1610 * sock_create - creates a socket
1614 * @res: new socket
1620 int sock_create(int family, int type, int protocol, struct socket **res) in sock_create()
1627 * sock_create_kern - creates a socket (kernel space)
1632 * @res: new socket
1638 int sock_create_kern(struct net *net, int family, int type, int protocol, struct socket **res) in sock_create_kern()
1644 static struct socket *__sys_socket_create(int family, int type, int protocol) in __sys_socket_create()
1646 struct socket *sock; in __sys_socket_create()
1668 struct socket *sock; in __sys_socket_file()
1682 /* A hook for bpf progs to attach to and update socket protocol.
1703 struct socket *sock; in __sys_socket()
1718 SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol) in SYSCALL_DEFINE3() argument
1729 struct socket *sock1, *sock2; in __sys_socketpair()
1765 * Obtain the first socket and check if the underlying protocol in __sys_socketpair()
1826 * Bind a name to a socket. Nothing much to do here since it's
1829 * We move the socket address to kernel space before we call
1835 struct socket *sock; in __sys_bind()
1863 * necessary for a listen, and if that works, we mark the socket as
1869 struct socket *sock; in __sys_listen()
1897 struct socket *sock, *newsock; in do_accept()
1916 * We don't need try_module_get here, as the listening socket (sock) in do_accept()
1980 * For accept, we attempt to create a new socket, set up the link
1984 * we open the socket then return an error.
2020 * Attempt to connect to a socket with the server address. The address
2034 struct socket *sock; in __sys_connect_file()
2079 * Get the local address ('name') of a socket object. Move the obtained
2086 struct socket *sock; in __sys_getsockname()
2117 * Get the remote address ('name') of a socket object. Move the obtained
2124 struct socket *sock; in __sys_getpeername()
2162 struct socket *sock; in __sys_sendto()
2207 * Send a datagram down a socket.
2217 * Receive a frame from the socket and optionally record the address of the
2229 struct socket *sock; in __sys_recvfrom()
2264 * Receive a datagram from a socket.
2273 static bool sock_use_custom_sol_socket(const struct socket *sock) in sock_use_custom_sol_socket()
2278 int do_sock_setsockopt(struct socket *sock, bool compat, int level, in do_sock_setsockopt()
2319 /* Set a socket option. Because we don't know the option lengths we have
2328 struct socket *sock; in __sys_setsockopt()
2349 int do_sock_getsockopt(struct socket *sock, bool compat, int level, in do_sock_getsockopt()
2387 * Get a socket option. Because we don't know the option lengths we have
2394 struct socket *sock; in __sys_getsockopt()
2416 * Shutdown a socket.
2419 int __sys_shutdown_sock(struct socket *sock, int how) in __sys_shutdown_sock()
2433 struct socket *sock; in __sys_shutdown()
2527 static int ____sys_sendmsg(struct socket *sock, struct msghdr *msg_sys, in ____sys_sendmsg()
2623 static int ___sys_sendmsg(struct socket *sock, struct user_msghdr __user *msg, in ___sys_sendmsg()
2647 long __sys_sendmsg_sock(struct socket *sock, struct msghdr *msg, in __sys_sendmsg_sock()
2658 struct socket *sock; in __sys_sendmsg()
2687 struct socket *sock; in __sys_sendmmsg()
2777 static int ____sys_recvmsg(struct socket *sock, struct msghdr *msg_sys, in ____sys_recvmsg()
2833 static int ___sys_recvmsg(struct socket *sock, struct user_msghdr __user *msg, in ___sys_recvmsg()
2854 long __sys_recvmsg_sock(struct socket *sock, struct msghdr *msg, in __sys_recvmsg_sock()
2866 struct socket *sock; in __sys_recvmsg()
2897 struct socket *sock; in do_recvmmsg()
3198 * sock_register - add a socket protocol handler
3203 * socket interface. The value ops->family corresponds to the
3204 * socket system call protocol family.
3236 * new socket creation.
3411 static int compat_sock_ioctl_trans(struct file *file, struct socket *sock, in compat_sock_ioctl_trans()
3511 struct socket *sock = file->private_data; in compat_sock_ioctl()
3535 * kernel_bind - bind an address to a socket (kernel space)
3536 * @sock: socket
3543 int kernel_bind(struct socket *sock, struct sockaddr *addr, int addrlen) in kernel_bind()
3555 * kernel_listen - move socket to listening state (kernel space)
3556 * @sock: socket
3562 int kernel_listen(struct socket *sock, int backlog) in kernel_listen()
3570 * @sock: listening socket
3571 * @newsock: new connected socket
3579 int kernel_accept(struct socket *sock, struct socket **newsock, int flags) in kernel_accept()
3606 * kernel_connect - connect a socket (kernel space)
3607 * @sock: socket
3618 int kernel_connect(struct socket *sock, struct sockaddr *addr, int addrlen, in kernel_connect()
3631 * kernel_getsockname - get the address which the socket is bound (kernel space)
3632 * @sock: socket
3635 * Fills the @addr pointer with the address which the socket is bound.
3639 int kernel_getsockname(struct socket *sock, struct sockaddr *addr) in kernel_getsockname()
3646 * kernel_getpeername - get the address which the socket is connected (kernel space)
3647 * @sock: socket
3650 * Fills the @addr pointer with the address which the socket is connected.
3654 int kernel_getpeername(struct socket *sock, struct sockaddr *addr) in kernel_getpeername()
3662 * @sock: socket
3668 int kernel_sock_shutdown(struct socket *sock, enum sock_shutdown_cmd how) in kernel_sock_shutdown()
3675 * kernel_sock_ip_overhead - returns the IP overhead imposed by a socket
3676 * @sk: socket
3678 * This routine returns the IP overhead imposed by a socket i.e.
3680 * this is an IPv4 or IPv6 socket and the length from IP options turned
3681 * on at the socket. Assumes that the caller has a lock on the socket.
3717 default: /* Returns 0 overhead if the socket is not ipv4 or ipv6 */ in kernel_sock_ip_overhead()