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
56 #include <linux/socket.h>
135 struct socket *sock = f->private_data; in sock_show_fdinfo()
145 …* Socket files have a set of 'special' operations as well as the generic file ones. These don't ap…
177 * Move socket addresses back and forth across the kernel/user
182 * move_addr_to_kernel - copy a socket address into kernel space
256 init_waitqueue_head(&ei->socket.wq.wait); in sock_alloc_inode()
257 ei->socket.wq.fasync_list = NULL; in sock_alloc_inode()
258 ei->socket.wq.flags = 0; in sock_alloc_inode()
260 ei->socket.state = SS_UNCONNECTED; in sock_alloc_inode()
261 ei->socket.flags = 0; in sock_alloc_inode()
262 ei->socket.ops = NULL; in sock_alloc_inode()
263 ei->socket.sk = NULL; in sock_alloc_inode()
264 ei->socket.file = NULL; in sock_alloc_inode()
307 return dynamic_dname(dentry, buffer, buflen, "socket:[%lu]", in sockfs_dname()
384 * to socket after mapping. If one day we will need it, this
394 * sock_alloc_file - Bind a &socket to a &file
395 * @sock: socket
405 struct file *sock_alloc_file(struct socket *sock, int flags, const char *dname) in sock_alloc_file()
427 static int sock_map_fd(struct socket *sock, int flags) in sock_map_fd()
447 * sock_from_file - Return the &socket bounded to @file.
454 struct socket *sock_from_file(struct file *file, int *err) in sock_from_file()
465 * sockfd_lookup - Go from a file number to its socket slot
469 * The file handle passed in is locked and the socket it is bound
472 * for both invalid handles and passing a handle which is not a socket.
474 * On a success the socket object pointer is returned.
477 struct socket *sockfd_lookup(int fd, int *err) in sockfd_lookup()
480 struct socket *sock; in sockfd_lookup()
495 static struct socket *sockfd_lookup_light(int fd, int *err, int *fput_needed) in sockfd_lookup_light()
498 struct socket *sock; in sockfd_lookup_light()
545 struct socket *sock = SOCKET_I(d_inode(dentry)); in sockfs_setattr()
562 * sock_alloc - allocate a socket
564 * Allocate a new inode and socket object. The two are bound together
565 * and initialised. The socket is then returned. If we are out of inodes
569 struct socket *sock_alloc(void) in sock_alloc()
572 struct socket *sock; in sock_alloc()
590 static void __sock_release(struct socket *sock, struct inode *inode) in __sock_release()
616 * sock_release - close a socket
617 * @sock: socket to close
619 * The socket is released from the protocol stack if it has a release
620 * callback, and the inode is then released if the socket is bound to
623 void sock_release(struct socket *sock) in sock_release()
646 INDIRECT_CALLABLE_DECLARE(int inet_sendmsg(struct socket *, struct msghdr *,
648 INDIRECT_CALLABLE_DECLARE(int inet6_sendmsg(struct socket *, struct msghdr *,
650 static inline int sock_sendmsg_nosec(struct socket *sock, struct msghdr *msg) in sock_sendmsg_nosec()
661 * @sock: socket
667 int sock_sendmsg(struct socket *sock, struct msghdr *msg) in sock_sendmsg()
678 * @sock: socket
688 int kernel_sendmsg(struct socket *sock, struct msghdr *msg, in kernel_sendmsg()
712 struct socket *sock = sk->sk_socket; in kernel_sendmsg_locked()
727 * in recvmsg, since skbs received on a local socket will never in skb_is_err_queue()
738 * option SO_TIMESTAMP_OLD(NS) is enabled on the socket, even when the skb has a
879 INDIRECT_CALLABLE_DECLARE(int inet_recvmsg(struct socket *, struct msghdr *,
881 INDIRECT_CALLABLE_DECLARE(int inet6_recvmsg(struct socket *, struct msghdr *,
883 static inline int sock_recvmsg_nosec(struct socket *sock, struct msghdr *msg, in sock_recvmsg_nosec()
893 * @sock: socket
900 int sock_recvmsg(struct socket *sock, struct msghdr *msg, int flags) in sock_recvmsg()
909 * kernel_recvmsg - Receive a message from a socket (kernel space)
910 * @sock: The socket to receive the message from
924 int kernel_recvmsg(struct socket *sock, struct msghdr *msg, in kernel_recvmsg()
936 struct socket *sock; in sock_sendpage()
952 struct socket *sock = file->private_data; in sock_splice_read()
963 struct socket *sock = file->private_data; in sock_read_iter()
985 struct socket *sock = file->private_data; in sock_write_iter()
1042 static long sock_do_ioctl(struct net *net, struct socket *sock, in sock_do_ioctl()
1088 struct socket *sock; in sock_ioctl()
1195 * sock_create_lite - creates a socket
1199 * @res: new socket
1201 * Creates a new socket and assigns it to @res, passing through LSM.
1202 * The new socket initialization is not complete, see kernel_accept().
1207 int sock_create_lite(int family, int type, int protocol, struct socket **res) in sock_create_lite()
1210 struct socket *sock = NULL; in sock_create_lite()
1240 struct socket *sock = file->private_data; in sock_poll()
1251 /* if this socket can poll_ll, tell the system call */ in sock_poll()
1260 struct socket *sock = file->private_data; in sock_mmap()
1272 * Update the socket async list
1276 * 1. fasync_list is modified only under process context socket lock
1279 * or under socket lock
1284 struct socket *sock = filp->private_data; in sock_fasync()
1332 * __sock_create - creates a socket
1337 * @res: new socket
1340 * Creates a new socket and assigns it to @res, passing through LSM.
1342 * be set to true if the socket resides in kernel space.
1347 struct socket **res, int kern) in __sock_create()
1350 struct socket *sock; in __sock_create()
1377 * Allocate the socket and allow the family to set things up. if in __sock_create()
1383 net_warn_ratelimited("socket: no more sockets\n"); in __sock_create()
1423 * socket at sock_release time we decrement its refcnt. in __sock_create()
1456 * sock_create - creates a socket
1460 * @res: new socket
1466 int sock_create(int family, int type, int protocol, struct socket **res) in sock_create()
1473 * sock_create_kern - creates a socket (kernel space)
1478 * @res: new socket
1484 int sock_create_kern(struct net *net, int family, int type, int protocol, struct socket **res) in sock_create_kern()
1493 struct socket *sock; in __sys_socket()
1517 SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol) in SYSCALL_DEFINE3() argument
1528 struct socket *sock1, *sock2; in __sys_socketpair()
1564 * Obtain the first socket and check if the underlying protocol in __sys_socketpair()
1625 * Bind a name to a socket. Nothing much to do here since it's
1628 * We move the socket address to kernel space before we call
1634 struct socket *sock; in __sys_bind()
1662 * necessary for a listen, and if that works, we mark the socket as
1668 struct socket *sock; in __sys_listen()
1696 struct socket *sock, *newsock; in do_accept()
1713 * We don't need try_module_get here, as the listening socket (sock) in do_accept()
1780 * For accept, we attempt to create a new socket, set up the link
1784 * we open the socket then return an error.
1821 * Attempt to connect to a socket with the server address. The address
1835 struct socket *sock; in __sys_connect_file()
1878 * Get the local address ('name') of a socket object. Move the obtained
1885 struct socket *sock; in __sys_getsockname()
1916 * Get the remote address ('name') of a socket object. Move the obtained
1923 struct socket *sock; in __sys_getpeername()
1959 struct socket *sock; in __sys_sendto()
2003 * Send a datagram down a socket.
2013 * Receive a frame from the socket and optionally record the address of the
2020 struct socket *sock; in __sys_recvfrom()
2066 * Receive a datagram from a socket.
2075 static bool sock_use_custom_sol_socket(const struct socket *sock) in sock_use_custom_sol_socket()
2087 * Set a socket option. Because we don't know the option lengths we have
2096 struct socket *sock; in __sys_setsockopt()
2142 * Get a socket option. Because we don't know the option lengths we have
2149 struct socket *sock; in __sys_getsockopt()
2187 * Shutdown a socket.
2190 int __sys_shutdown_sock(struct socket *sock, int how) in __sys_shutdown_sock()
2204 struct socket *sock; in __sys_shutdown()
2301 static int ____sys_sendmsg(struct socket *sock, struct msghdr *msg_sys, in ____sys_sendmsg()
2396 static int ___sys_sendmsg(struct socket *sock, struct user_msghdr __user *msg, in ___sys_sendmsg()
2420 long __sys_sendmsg_sock(struct socket *sock, struct msghdr *msg, in __sys_sendmsg_sock()
2431 struct socket *sock; in __sys_sendmsg()
2460 struct socket *sock; in __sys_sendmmsg()
2550 static int ____sys_recvmsg(struct socket *sock, struct msghdr *msg_sys, in ____sys_recvmsg()
2606 static int ___sys_recvmsg(struct socket *sock, struct user_msghdr __user *msg, in ___sys_recvmsg()
2627 long __sys_recvmsg_sock(struct socket *sock, struct msghdr *msg, in __sys_recvmsg_sock()
2639 struct socket *sock; in __sys_recvmsg()
2670 struct socket *sock; in do_recvmmsg()
2971 * sock_register - add a socket protocol handler
2976 * socket interface. The value ops->family corresponds to the
2977 * socket system call protocol family.
3009 * new socket creation.
3163 static int compat_ifreq_ioctl(struct net *net, struct socket *sock, in compat_ifreq_ioctl()
3260 static int compat_sock_ioctl_trans(struct file *file, struct socket *sock, in compat_sock_ioctl_trans()
3365 struct socket *sock = file->private_data; in compat_sock_ioctl()
3388 * kernel_bind - bind an address to a socket (kernel space)
3389 * @sock: socket
3396 int kernel_bind(struct socket *sock, struct sockaddr *addr, int addrlen) in kernel_bind()
3403 * kernel_listen - move socket to listening state (kernel space)
3404 * @sock: socket
3410 int kernel_listen(struct socket *sock, int backlog) in kernel_listen()
3418 * @sock: listening socket
3419 * @newsock: new connected socket
3427 int kernel_accept(struct socket *sock, struct socket **newsock, int flags) in kernel_accept()
3453 * kernel_connect - connect a socket (kernel space)
3454 * @sock: socket
3465 int kernel_connect(struct socket *sock, struct sockaddr *addr, int addrlen, in kernel_connect()
3473 * kernel_getsockname - get the address which the socket is bound (kernel space)
3474 * @sock: socket
3477 * Fills the @addr pointer with the address which the socket is bound.
3481 int kernel_getsockname(struct socket *sock, struct sockaddr *addr) in kernel_getsockname()
3488 * kernel_getpeername - get the address which the socket is connected (kernel space)
3489 * @sock: socket
3492 * Fills the @addr pointer with the address which the socket is connected.
3496 int kernel_getpeername(struct socket *sock, struct sockaddr *addr) in kernel_getpeername()
3503 * kernel_sendpage - send a &page through a socket (kernel space)
3504 * @sock: socket
3513 int kernel_sendpage(struct socket *sock, struct page *page, int offset, in kernel_sendpage()
3540 struct socket *sock = sk->sk_socket; in kernel_sendpage_locked()
3552 * @sock: socket
3558 int kernel_sock_shutdown(struct socket *sock, enum sock_shutdown_cmd how) in kernel_sock_shutdown()
3565 * kernel_sock_ip_overhead - returns the IP overhead imposed by a socket
3566 * @sk: socket
3568 * This routine returns the IP overhead imposed by a socket i.e.
3570 * this is an IPv4 or IPv6 socket and the length from IP options turned
3571 * on at the socket. Assumes that the caller has a lock on the socket.
3607 default: /* Returns 0 overhead if the socket is not ipv4 or ipv6 */ in kernel_sock_ip_overhead()