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>
141 struct socket *sock = f->private_data; in sock_show_fdinfo()
152 …* Socket files have a set of 'special' operations as well as the generic file ones. These don't ap…
233 * Move socket addresses back and forth across the kernel/user
238 * move_addr_to_kernel - copy a socket address into kernel space
312 init_waitqueue_head(&ei->socket.wq.wait); in sock_alloc_inode()
313 ei->socket.wq.fasync_list = NULL; in sock_alloc_inode()
314 ei->socket.wq.flags = 0; in sock_alloc_inode()
316 ei->socket.state = SS_UNCONNECTED; in sock_alloc_inode()
317 ei->socket.flags = 0; in sock_alloc_inode()
318 ei->socket.ops = NULL; in sock_alloc_inode()
319 ei->socket.sk = NULL; in sock_alloc_inode()
320 ei->socket.file = NULL; in sock_alloc_inode()
363 return dynamic_dname(buffer, buflen, "socket:[%lu]", in sockfs_dname()
440 * to socket after mapping. If one day we will need it, this
450 * sock_alloc_file - Bind a &socket to a &file
451 * @sock: socket
463 struct file *sock_alloc_file(struct socket *sock, int flags, const char *dname) in sock_alloc_file()
491 static int sock_map_fd(struct socket *sock, int flags) in sock_map_fd()
511 * sock_from_file - Return the &socket bounded to @file.
517 struct socket *sock_from_file(struct file *file) in sock_from_file()
527 * sockfd_lookup - Go from a file number to its socket slot
531 * The file handle passed in is locked and the socket it is bound
534 * for both invalid handles and passing a handle which is not a socket.
536 * On a success the socket object pointer is returned.
539 struct socket *sockfd_lookup(int fd, int *err) in sockfd_lookup()
542 struct socket *sock; in sockfd_lookup()
593 struct socket *sock = SOCKET_I(d_inode(dentry)); in sockfs_setattr()
610 * sock_alloc - allocate a socket
612 * Allocate a new inode and socket object. The two are bound together
613 * and initialised. The socket is then returned. If we are out of inodes
617 struct socket *sock_alloc(void) in sock_alloc()
620 struct socket *sock; in sock_alloc()
638 static void __sock_release(struct socket *sock, struct inode *inode) in __sock_release()
666 * sock_release - close a socket
667 * @sock: socket to close
669 * The socket is released from the protocol stack if it has a release
670 * callback, and the inode is then released if the socket is bound to
673 void sock_release(struct socket *sock) in sock_release()
688 * free running cycle counter for timestamp if socket is bound in __sock_tx_timestamp()
705 INDIRECT_CALLABLE_DECLARE(int inet_sendmsg(struct socket *, struct msghdr *,
707 INDIRECT_CALLABLE_DECLARE(int inet6_sendmsg(struct socket *, struct msghdr *,
716 static inline int sock_sendmsg_nosec(struct socket *sock, struct msghdr *msg) in sock_sendmsg_nosec()
728 static int __sock_sendmsg(struct socket *sock, struct msghdr *msg) in __sock_sendmsg()
738 * @sock: socket
744 int sock_sendmsg(struct socket *sock, struct msghdr *msg) in sock_sendmsg()
766 * @sock: socket
776 int kernel_sendmsg(struct socket *sock, struct msghdr *msg, in kernel_sendmsg()
788 * in recvmsg, since skbs received on a local socket will never in skb_is_err_queue()
799 * option SO_TIMESTAMP_OLD(NS) is enabled on the socket, even when the skb has a
1010 INDIRECT_CALLABLE_DECLARE(int inet_recvmsg(struct socket *, struct msghdr *,
1012 INDIRECT_CALLABLE_DECLARE(int inet6_recvmsg(struct socket *, struct msghdr *,
1020 static inline int sock_recvmsg_nosec(struct socket *sock, struct msghdr *msg, in sock_recvmsg_nosec()
1034 * @sock: socket
1041 int sock_recvmsg(struct socket *sock, struct msghdr *msg, int flags) in sock_recvmsg()
1050 * kernel_recvmsg - Receive a message from a socket (kernel space)
1051 * @sock: The socket to receive the message from
1065 int kernel_recvmsg(struct socket *sock, struct msghdr *msg, in kernel_recvmsg()
1078 struct socket *sock = file->private_data; in sock_splice_read()
1090 struct socket *sock = file->private_data; in sock_splice_eof()
1101 struct socket *sock = file->private_data; in sock_read_iter()
1123 struct socket *sock = file->private_data; in sock_write_iter()
1186 static long sock_do_ioctl(struct net *net, struct socket *sock, in sock_do_ioctl()
1226 struct socket *sock; in sock_ioctl()
1324 * sock_create_lite - creates a socket
1328 * @res: new socket
1330 * Creates a new socket and assigns it to @res, passing through LSM.
1331 * The new socket initialization is not complete, see kernel_accept().
1336 int sock_create_lite(int family, int type, int protocol, struct socket **res) in sock_create_lite()
1339 struct socket *sock = NULL; in sock_create_lite()
1369 struct socket *sock = file->private_data; in sock_poll()
1381 /* if this socket can poll_ll, tell the system call */ in sock_poll()
1390 struct socket *sock = file->private_data; in sock_mmap()
1402 * Update the socket async list
1406 * 1. fasync_list is modified only under process context socket lock
1409 * or under socket lock
1414 struct socket *sock = filp->private_data; in sock_fasync()
1462 * __sock_create - creates a socket
1467 * @res: new socket
1470 * Creates a new socket and assigns it to @res, passing through LSM.
1472 * be set to true if the socket resides in kernel space.
1477 struct socket **res, int kern) in __sock_create()
1480 struct socket *sock; in __sock_create()
1507 * Allocate the socket and allow the family to set things up. if in __sock_create()
1513 net_warn_ratelimited("socket: no more sockets\n"); in __sock_create()
1560 * socket at sock_release time we decrement its refcnt. in __sock_create()
1593 * sock_create - creates a socket
1597 * @res: new socket
1603 int sock_create(int family, int type, int protocol, struct socket **res) in sock_create()
1610 * sock_create_kern - creates a socket (kernel space)
1615 * @res: new socket
1621 int sock_create_kern(struct net *net, int family, int type, int protocol, struct socket **res) in sock_create_kern()
1627 static struct socket *__sys_socket_create(int family, int type, int protocol) in __sys_socket_create()
1629 struct socket *sock; in __sys_socket_create()
1651 struct socket *sock; in __sys_socket_file()
1665 /* A hook for bpf progs to attach to and update socket protocol.
1686 struct socket *sock; in __sys_socket()
1701 SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol) in SYSCALL_DEFINE3() argument
1712 struct socket *sock1, *sock2; in __sys_socketpair()
1748 * Obtain the first socket and check if the underlying protocol in __sys_socketpair()
1808 int __sys_bind_socket(struct socket *sock, struct sockaddr_storage *address, in __sys_bind_socket()
1823 * Bind a name to a socket. Nothing much to do here since it's
1826 * We move the socket address to kernel space before we call
1832 struct socket *sock; in __sys_bind()
1857 * necessary for a listen, and if that works, we mark the socket as
1860 int __sys_listen_socket(struct socket *sock, int backlog) in __sys_listen_socket()
1877 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()
1981 * For accept, we attempt to create a new socket, set up the link
1985 * we open the socket then return an error.
2016 * Attempt to connect to a socket with the server address. The address
2030 struct socket *sock; in __sys_connect_file()
2073 * Get the local address ('name') of a socket object. Move the obtained
2080 struct socket *sock; in __sys_getsockname()
2110 * Get the remote address ('name') of a socket object. Move the obtained
2117 struct socket *sock; in __sys_getpeername()
2154 struct socket *sock; in __sys_sendto()
2197 * Send a datagram down a socket.
2207 * Receive a frame from the socket and optionally record the address of the
2219 struct socket *sock; in __sys_recvfrom()
2255 * Receive a datagram from a socket.
2264 static bool sock_use_custom_sol_socket(const struct socket *sock) in sock_use_custom_sol_socket()
2269 int do_sock_setsockopt(struct socket *sock, bool compat, int level, in do_sock_setsockopt()
2310 /* Set a socket option. Because we don't know the option lengths we have
2318 struct socket *sock; in __sys_setsockopt()
2339 int do_sock_getsockopt(struct socket *sock, bool compat, int level, in do_sock_getsockopt()
2377 * Get a socket option. Because we don't know the option lengths we have
2383 struct socket *sock; in __sys_getsockopt()
2403 * Shutdown a socket.
2406 int __sys_shutdown_sock(struct socket *sock, int how) in __sys_shutdown_sock()
2419 struct socket *sock; in __sys_shutdown()
2515 static int ____sys_sendmsg(struct socket *sock, struct msghdr *msg_sys, in ____sys_sendmsg()
2611 static int ___sys_sendmsg(struct socket *sock, struct user_msghdr __user *msg, in ___sys_sendmsg()
2635 long __sys_sendmsg_sock(struct socket *sock, struct msghdr *msg, in __sys_sendmsg_sock()
2645 struct socket *sock; in __sys_sendmsg()
2674 struct socket *sock; in __sys_sendmmsg()
2766 static int ____sys_recvmsg(struct socket *sock, struct msghdr *msg_sys, in ____sys_recvmsg()
2822 static int ___sys_recvmsg(struct socket *sock, struct user_msghdr __user *msg, in ___sys_recvmsg()
2843 long __sys_recvmsg_sock(struct socket *sock, struct msghdr *msg, in __sys_recvmsg_sock()
2854 struct socket *sock; in __sys_recvmsg()
2885 struct socket *sock; in do_recvmmsg()
3183 * sock_register - add a socket protocol handler
3188 * socket interface. The value ops->family corresponds to the
3189 * socket system call protocol family.
3221 * new socket creation.
3396 static int compat_sock_ioctl_trans(struct file *file, struct socket *sock, in compat_sock_ioctl_trans()
3496 struct socket *sock = file->private_data; in compat_sock_ioctl()
3520 * kernel_bind - bind an address to a socket (kernel space)
3521 * @sock: socket
3528 int kernel_bind(struct socket *sock, struct sockaddr *addr, int addrlen) in kernel_bind()
3540 * kernel_listen - move socket to listening state (kernel space)
3541 * @sock: socket
3547 int kernel_listen(struct socket *sock, int backlog) in kernel_listen()
3555 * @sock: listening socket
3556 * @newsock: new connected socket
3564 int kernel_accept(struct socket *sock, struct socket **newsock, int flags) in kernel_accept()
3595 * kernel_connect - connect a socket (kernel space)
3596 * @sock: socket
3607 int kernel_connect(struct socket *sock, struct sockaddr *addr, int addrlen, in kernel_connect()
3620 * kernel_getsockname - get the address which the socket is bound (kernel space)
3621 * @sock: socket
3624 * Fills the @addr pointer with the address which the socket is bound.
3628 int kernel_getsockname(struct socket *sock, struct sockaddr *addr) in kernel_getsockname()
3635 * kernel_getpeername - get the address which the socket is connected (kernel space)
3636 * @sock: socket
3639 * Fills the @addr pointer with the address which the socket is connected.
3643 int kernel_getpeername(struct socket *sock, struct sockaddr *addr) in kernel_getpeername()
3651 * @sock: socket
3657 int kernel_sock_shutdown(struct socket *sock, enum sock_shutdown_cmd how) in kernel_sock_shutdown()
3664 * kernel_sock_ip_overhead - returns the IP overhead imposed by a socket
3665 * @sk: socket
3667 * This routine returns the IP overhead imposed by a socket i.e.
3669 * this is an IPv4 or IPv6 socket and the length from IP options turned
3670 * on at the socket. Assumes that the caller has a lock on the socket.
3706 default: /* Returns 0 overhead if the socket is not ipv4 or ipv6 */ in kernel_sock_ip_overhead()