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
57 #include <linux/socket.h>
136 struct socket *sock = f->private_data; in sock_show_fdinfo()
146 …* Socket files have a set of 'special' operations as well as the generic file ones. These don't ap…
227 * Move socket addresses back and forth across the kernel/user
232 * move_addr_to_kernel - copy a socket address into kernel space
306 init_waitqueue_head(&ei->socket.wq.wait); in sock_alloc_inode()
307 ei->socket.wq.fasync_list = NULL; in sock_alloc_inode()
308 ei->socket.wq.flags = 0; in sock_alloc_inode()
310 ei->socket.state = SS_UNCONNECTED; in sock_alloc_inode()
311 ei->socket.flags = 0; in sock_alloc_inode()
312 ei->socket.ops = NULL; in sock_alloc_inode()
313 ei->socket.sk = NULL; in sock_alloc_inode()
314 ei->socket.file = NULL; in sock_alloc_inode()
357 return dynamic_dname(dentry, buffer, buflen, "socket:[%lu]", in sockfs_dname()
434 * to socket after mapping. If one day we will need it, this
444 * sock_alloc_file - Bind a &socket to a &file
445 * @sock: socket
455 struct file *sock_alloc_file(struct socket *sock, int flags, const char *dname) in sock_alloc_file()
477 static int sock_map_fd(struct socket *sock, int flags) in sock_map_fd()
497 * sock_from_file - Return the &socket bounded to @file.
503 struct socket *sock_from_file(struct file *file) in sock_from_file()
513 * sockfd_lookup - Go from a file number to its socket slot
517 * The file handle passed in is locked and the socket it is bound
520 * for both invalid handles and passing a handle which is not a socket.
522 * On a success the socket object pointer is returned.
525 struct socket *sockfd_lookup(int fd, int *err) in sockfd_lookup()
528 struct socket *sock; in sockfd_lookup()
545 static struct socket *sockfd_lookup_light(int fd, int *err, int *fput_needed) in sockfd_lookup_light()
548 struct socket *sock; in sockfd_lookup_light()
597 struct socket *sock = SOCKET_I(d_inode(dentry)); in sockfs_setattr()
614 * sock_alloc - allocate a socket
616 * Allocate a new inode and socket object. The two are bound together
617 * and initialised. The socket is then returned. If we are out of inodes
621 struct socket *sock_alloc(void) in sock_alloc()
624 struct socket *sock; in sock_alloc()
642 static void __sock_release(struct socket *sock, struct inode *inode) in __sock_release()
668 * sock_release - close a socket
669 * @sock: socket to close
671 * The socket is released from the protocol stack if it has a release
672 * callback, and the inode is then released if the socket is bound to
675 void sock_release(struct socket *sock) in sock_release()
698 INDIRECT_CALLABLE_DECLARE(int inet_sendmsg(struct socket *, struct msghdr *,
700 INDIRECT_CALLABLE_DECLARE(int inet6_sendmsg(struct socket *, struct msghdr *,
702 static inline int sock_sendmsg_nosec(struct socket *sock, struct msghdr *msg) in sock_sendmsg_nosec()
713 * @sock: socket
719 int sock_sendmsg(struct socket *sock, struct msghdr *msg) in sock_sendmsg()
730 * @sock: socket
740 int kernel_sendmsg(struct socket *sock, struct msghdr *msg, in kernel_sendmsg()
764 struct socket *sock = sk->sk_socket; in kernel_sendmsg_locked()
779 * in recvmsg, since skbs received on a local socket will never in skb_is_err_queue()
790 * option SO_TIMESTAMP_OLD(NS) is enabled on the socket, even when the skb has a
937 INDIRECT_CALLABLE_DECLARE(int inet_recvmsg(struct socket *, struct msghdr *,
939 INDIRECT_CALLABLE_DECLARE(int inet6_recvmsg(struct socket *, struct msghdr *,
941 static inline int sock_recvmsg_nosec(struct socket *sock, struct msghdr *msg, in sock_recvmsg_nosec()
951 * @sock: socket
958 int sock_recvmsg(struct socket *sock, struct msghdr *msg, int flags) in sock_recvmsg()
967 * kernel_recvmsg - Receive a message from a socket (kernel space)
968 * @sock: The socket to receive the message from
982 int kernel_recvmsg(struct socket *sock, struct msghdr *msg, in kernel_recvmsg()
994 struct socket *sock; in sock_sendpage()
1010 struct socket *sock = file->private_data; in sock_splice_read()
1021 struct socket *sock = file->private_data; in sock_read_iter()
1043 struct socket *sock = file->private_data; in sock_write_iter()
1109 static long sock_do_ioctl(struct net *net, struct socket *sock, in sock_do_ioctl()
1147 struct socket *sock; in sock_ioctl()
1242 * sock_create_lite - creates a socket
1246 * @res: new socket
1248 * Creates a new socket and assigns it to @res, passing through LSM.
1249 * The new socket initialization is not complete, see kernel_accept().
1254 int sock_create_lite(int family, int type, int protocol, struct socket **res) in sock_create_lite()
1257 struct socket *sock = NULL; in sock_create_lite()
1287 struct socket *sock = file->private_data; in sock_poll()
1298 /* if this socket can poll_ll, tell the system call */ in sock_poll()
1307 struct socket *sock = file->private_data; in sock_mmap()
1319 * Update the socket async list
1323 * 1. fasync_list is modified only under process context socket lock
1326 * or under socket lock
1331 struct socket *sock = filp->private_data; in sock_fasync()
1379 * __sock_create - creates a socket
1384 * @res: new socket
1387 * Creates a new socket and assigns it to @res, passing through LSM.
1389 * be set to true if the socket resides in kernel space.
1394 struct socket **res, int kern) in __sock_create()
1397 struct socket *sock; in __sock_create()
1424 * Allocate the socket and allow the family to set things up. if in __sock_create()
1430 net_warn_ratelimited("socket: no more sockets\n"); in __sock_create()
1470 * socket at sock_release time we decrement its refcnt. in __sock_create()
1503 * sock_create - creates a socket
1507 * @res: new socket
1513 int sock_create(int family, int type, int protocol, struct socket **res) in sock_create()
1520 * sock_create_kern - creates a socket (kernel space)
1525 * @res: new socket
1531 int sock_create_kern(struct net *net, int family, int type, int protocol, struct socket **res) in sock_create_kern()
1540 struct socket *sock; in __sys_socket()
1564 SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol) in SYSCALL_DEFINE3() argument
1575 struct socket *sock1, *sock2; in __sys_socketpair()
1611 * Obtain the first socket and check if the underlying protocol in __sys_socketpair()
1672 * Bind a name to a socket. Nothing much to do here since it's
1675 * We move the socket address to kernel space before we call
1681 struct socket *sock; in __sys_bind()
1709 * necessary for a listen, and if that works, we mark the socket as
1715 struct socket *sock; in __sys_listen()
1743 struct socket *sock, *newsock; in do_accept()
1760 * We don't need try_module_get here, as the listening socket (sock) in do_accept()
1827 * For accept, we attempt to create a new socket, set up the link
1831 * we open the socket then return an error.
1868 * Attempt to connect to a socket with the server address. The address
1882 struct socket *sock; in __sys_connect_file()
1927 * Get the local address ('name') of a socket object. Move the obtained
1934 struct socket *sock; in __sys_getsockname()
1965 * Get the remote address ('name') of a socket object. Move the obtained
1972 struct socket *sock; in __sys_getpeername()
2008 struct socket *sock; in __sys_sendto()
2052 * Send a datagram down a socket.
2062 * Receive a frame from the socket and optionally record the address of the
2069 struct socket *sock; in __sys_recvfrom()
2115 * Receive a datagram from a socket.
2124 static bool sock_use_custom_sol_socket(const struct socket *sock) in sock_use_custom_sol_socket()
2136 * Set a socket option. Because we don't know the option lengths we have
2145 struct socket *sock; in __sys_setsockopt()
2194 * Get a socket option. Because we don't know the option lengths we have
2201 struct socket *sock; in __sys_getsockopt()
2239 * Shutdown a socket.
2242 int __sys_shutdown_sock(struct socket *sock, int how) in __sys_shutdown_sock()
2256 struct socket *sock; in __sys_shutdown()
2353 static int ____sys_sendmsg(struct socket *sock, struct msghdr *msg_sys, in ____sys_sendmsg()
2448 static int ___sys_sendmsg(struct socket *sock, struct user_msghdr __user *msg, in ___sys_sendmsg()
2472 long __sys_sendmsg_sock(struct socket *sock, struct msghdr *msg, in __sys_sendmsg_sock()
2483 struct socket *sock; in __sys_sendmsg()
2512 struct socket *sock; in __sys_sendmmsg()
2602 static int ____sys_recvmsg(struct socket *sock, struct msghdr *msg_sys, in ____sys_recvmsg()
2658 static int ___sys_recvmsg(struct socket *sock, struct user_msghdr __user *msg, in ___sys_recvmsg()
2679 long __sys_recvmsg_sock(struct socket *sock, struct msghdr *msg, in __sys_recvmsg_sock()
2691 struct socket *sock; in __sys_recvmsg()
2722 struct socket *sock; in do_recvmmsg()
3023 * sock_register - add a socket protocol handler
3028 * socket interface. The value ops->family corresponds to the
3029 * socket system call protocol family.
3061 * new socket creation.
3251 static int compat_sock_ioctl_trans(struct file *file, struct socket *sock, in compat_sock_ioctl_trans()
3350 struct socket *sock = file->private_data; in compat_sock_ioctl()
3373 * kernel_bind - bind an address to a socket (kernel space)
3374 * @sock: socket
3381 int kernel_bind(struct socket *sock, struct sockaddr *addr, int addrlen) in kernel_bind()
3388 * kernel_listen - move socket to listening state (kernel space)
3389 * @sock: socket
3395 int kernel_listen(struct socket *sock, int backlog) in kernel_listen()
3403 * @sock: listening socket
3404 * @newsock: new connected socket
3412 int kernel_accept(struct socket *sock, struct socket **newsock, int flags) in kernel_accept()
3438 * kernel_connect - connect a socket (kernel space)
3439 * @sock: socket
3450 int kernel_connect(struct socket *sock, struct sockaddr *addr, int addrlen, in kernel_connect()
3458 * kernel_getsockname - get the address which the socket is bound (kernel space)
3459 * @sock: socket
3462 * Fills the @addr pointer with the address which the socket is bound.
3466 int kernel_getsockname(struct socket *sock, struct sockaddr *addr) in kernel_getsockname()
3473 * kernel_getpeername - get the address which the socket is connected (kernel space)
3474 * @sock: socket
3477 * Fills the @addr pointer with the address which the socket is connected.
3481 int kernel_getpeername(struct socket *sock, struct sockaddr *addr) in kernel_getpeername()
3488 * kernel_sendpage - send a &page through a socket (kernel space)
3489 * @sock: socket
3498 int kernel_sendpage(struct socket *sock, struct page *page, int offset, in kernel_sendpage()
3525 struct socket *sock = sk->sk_socket; in kernel_sendpage_locked()
3537 * @sock: socket
3543 int kernel_sock_shutdown(struct socket *sock, enum sock_shutdown_cmd how) in kernel_sock_shutdown()
3550 * kernel_sock_ip_overhead - returns the IP overhead imposed by a socket
3551 * @sk: socket
3553 * This routine returns the IP overhead imposed by a socket i.e.
3555 * this is an IPv4 or IPv6 socket and the length from IP options turned
3556 * on at the socket. Assumes that the caller has a lock on the socket.
3592 default: /* Returns 0 overhead if the socket is not ipv4 or ipv6 */ in kernel_sock_ip_overhead()