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()
383 * to socket after mapping. If one day we will need it, this
393 * sock_alloc_file - Bind a &socket to a &file
394 * @sock: socket
404 struct file *sock_alloc_file(struct socket *sock, int flags, const char *dname) in sock_alloc_file()
426 static int sock_map_fd(struct socket *sock, int flags) in sock_map_fd()
446 * sock_from_file - Return the &socket bounded to @file.
453 struct socket *sock_from_file(struct file *file, int *err) in sock_from_file()
464 * sockfd_lookup - Go from a file number to its socket slot
468 * The file handle passed in is locked and the socket it is bound
471 * for both invalid handles and passing a handle which is not a socket.
473 * On a success the socket object pointer is returned.
476 struct socket *sockfd_lookup(int fd, int *err) in sockfd_lookup()
479 struct socket *sock; in sockfd_lookup()
494 static struct socket *sockfd_lookup_light(int fd, int *err, int *fput_needed) in sockfd_lookup_light()
497 struct socket *sock; in sockfd_lookup_light()
544 struct socket *sock = SOCKET_I(d_inode(dentry)); in sockfs_setattr()
561 * sock_alloc - allocate a socket
563 * Allocate a new inode and socket object. The two are bound together
564 * and initialised. The socket is then returned. If we are out of inodes
568 struct socket *sock_alloc(void) in sock_alloc()
571 struct socket *sock; in sock_alloc()
589 static void __sock_release(struct socket *sock, struct inode *inode) in __sock_release()
615 * sock_release - close a socket
616 * @sock: socket to close
618 * The socket is released from the protocol stack if it has a release
619 * callback, and the inode is then released if the socket is bound to
622 void sock_release(struct socket *sock) in sock_release()
645 INDIRECT_CALLABLE_DECLARE(int inet_sendmsg(struct socket *, struct msghdr *,
647 INDIRECT_CALLABLE_DECLARE(int inet6_sendmsg(struct socket *, struct msghdr *,
649 static inline int sock_sendmsg_nosec(struct socket *sock, struct msghdr *msg) in sock_sendmsg_nosec()
660 * @sock: socket
666 int sock_sendmsg(struct socket *sock, struct msghdr *msg) in sock_sendmsg()
677 * @sock: socket
687 int kernel_sendmsg(struct socket *sock, struct msghdr *msg, in kernel_sendmsg()
711 struct socket *sock = sk->sk_socket; in kernel_sendmsg_locked()
726 * in recvmsg, since skbs received on a local socket will never in skb_is_err_queue()
737 * option SO_TIMESTAMP_OLD(NS) is enabled on the socket, even when the skb has a
878 INDIRECT_CALLABLE_DECLARE(int inet_recvmsg(struct socket *, struct msghdr *,
880 INDIRECT_CALLABLE_DECLARE(int inet6_recvmsg(struct socket *, struct msghdr *,
882 static inline int sock_recvmsg_nosec(struct socket *sock, struct msghdr *msg, in sock_recvmsg_nosec()
892 * @sock: socket
899 int sock_recvmsg(struct socket *sock, struct msghdr *msg, int flags) in sock_recvmsg()
908 * kernel_recvmsg - Receive a message from a socket (kernel space)
909 * @sock: The socket to receive the message from
923 int kernel_recvmsg(struct socket *sock, struct msghdr *msg, in kernel_recvmsg()
935 struct socket *sock; in sock_sendpage()
951 struct socket *sock = file->private_data; in sock_splice_read()
962 struct socket *sock = file->private_data; in sock_read_iter()
984 struct socket *sock = file->private_data; in sock_write_iter()
1041 static long sock_do_ioctl(struct net *net, struct socket *sock, in sock_do_ioctl()
1087 struct socket *sock; in sock_ioctl()
1194 * sock_create_lite - creates a socket
1198 * @res: new socket
1200 * Creates a new socket and assigns it to @res, passing through LSM.
1201 * The new socket initialization is not complete, see kernel_accept().
1206 int sock_create_lite(int family, int type, int protocol, struct socket **res) in sock_create_lite()
1209 struct socket *sock = NULL; in sock_create_lite()
1239 struct socket *sock = file->private_data; in sock_poll()
1250 /* if this socket can poll_ll, tell the system call */ in sock_poll()
1259 struct socket *sock = file->private_data; in sock_mmap()
1271 * Update the socket async list
1275 * 1. fasync_list is modified only under process context socket lock
1278 * or under socket lock
1283 struct socket *sock = filp->private_data; in sock_fasync()
1331 * __sock_create - creates a socket
1336 * @res: new socket
1339 * Creates a new socket and assigns it to @res, passing through LSM.
1341 * be set to true if the socket resides in kernel space.
1346 struct socket **res, int kern) in __sock_create()
1349 struct socket *sock; in __sock_create()
1376 * Allocate the socket and allow the family to set things up. if in __sock_create()
1382 net_warn_ratelimited("socket: no more sockets\n"); in __sock_create()
1422 * socket at sock_release time we decrement its refcnt. in __sock_create()
1455 * sock_create - creates a socket
1459 * @res: new socket
1465 int sock_create(int family, int type, int protocol, struct socket **res) in sock_create()
1472 * sock_create_kern - creates a socket (kernel space)
1477 * @res: new socket
1483 int sock_create_kern(struct net *net, int family, int type, int protocol, struct socket **res) in sock_create_kern()
1492 struct socket *sock; in __sys_socket()
1516 SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol) in SYSCALL_DEFINE3() argument
1527 struct socket *sock1, *sock2; in __sys_socketpair()
1563 * Obtain the first socket and check if the underlying protocol in __sys_socketpair()
1624 * Bind a name to a socket. Nothing much to do here since it's
1627 * We move the socket address to kernel space before we call
1633 struct socket *sock; in __sys_bind()
1661 * necessary for a listen, and if that works, we mark the socket as
1667 struct socket *sock; in __sys_listen()
1696 struct socket *sock, *newsock; in __sys_accept4_file()
1720 * We don't need try_module_get here, as the listening socket (sock) in __sys_accept4_file()
1774 * For accept, we attempt to create a new socket, set up the link
1778 * we open the socket then return an error.
1815 * Attempt to connect to a socket with the server address. The address
1829 struct socket *sock; in __sys_connect_file()
1872 * Get the local address ('name') of a socket object. Move the obtained
1879 struct socket *sock; in __sys_getsockname()
1910 * Get the remote address ('name') of a socket object. Move the obtained
1917 struct socket *sock; in __sys_getpeername()
1953 struct socket *sock; in __sys_sendto()
1997 * Send a datagram down a socket.
2007 * Receive a frame from the socket and optionally record the address of the
2014 struct socket *sock; in __sys_recvfrom()
2060 * Receive a datagram from a socket.
2069 static bool sock_use_custom_sol_socket(const struct socket *sock) in sock_use_custom_sol_socket()
2081 * Set a socket option. Because we don't know the option lengths we have
2090 struct socket *sock; in __sys_setsockopt()
2136 * Get a socket option. Because we don't know the option lengths we have
2143 struct socket *sock; in __sys_getsockopt()
2181 * Shutdown a socket.
2187 struct socket *sock; in __sys_shutdown()
2286 static int ____sys_sendmsg(struct socket *sock, struct msghdr *msg_sys, in ____sys_sendmsg()
2381 static int ___sys_sendmsg(struct socket *sock, struct user_msghdr __user *msg, in ___sys_sendmsg()
2405 long __sys_sendmsg_sock(struct socket *sock, struct msghdr *msg, in __sys_sendmsg_sock()
2420 struct socket *sock; in __sys_sendmsg()
2449 struct socket *sock; in __sys_sendmmsg()
2539 static int ____sys_recvmsg(struct socket *sock, struct msghdr *msg_sys, in ____sys_recvmsg()
2595 static int ___sys_recvmsg(struct socket *sock, struct user_msghdr __user *msg, in ___sys_recvmsg()
2616 long __sys_recvmsg_sock(struct socket *sock, struct msghdr *msg, in __sys_recvmsg_sock()
2634 struct socket *sock; in __sys_recvmsg()
2665 struct socket *sock; in do_recvmmsg()
2966 * sock_register - add a socket protocol handler
2971 * socket interface. The value ops->family corresponds to the
2972 * socket system call protocol family.
3004 * new socket creation.
3158 static int compat_ifreq_ioctl(struct net *net, struct socket *sock, in compat_ifreq_ioctl()
3255 static int compat_sock_ioctl_trans(struct file *file, struct socket *sock, in compat_sock_ioctl_trans()
3360 struct socket *sock = file->private_data; in compat_sock_ioctl()
3383 * kernel_bind - bind an address to a socket (kernel space)
3384 * @sock: socket
3391 int kernel_bind(struct socket *sock, struct sockaddr *addr, int addrlen) in kernel_bind()
3398 * kernel_listen - move socket to listening state (kernel space)
3399 * @sock: socket
3405 int kernel_listen(struct socket *sock, int backlog) in kernel_listen()
3413 * @sock: listening socket
3414 * @newsock: new connected socket
3422 int kernel_accept(struct socket *sock, struct socket **newsock, int flags) in kernel_accept()
3448 * kernel_connect - connect a socket (kernel space)
3449 * @sock: socket
3460 int kernel_connect(struct socket *sock, struct sockaddr *addr, int addrlen, in kernel_connect()
3468 * kernel_getsockname - get the address which the socket is bound (kernel space)
3469 * @sock: socket
3472 * Fills the @addr pointer with the address which the socket is bound.
3476 int kernel_getsockname(struct socket *sock, struct sockaddr *addr) in kernel_getsockname()
3483 * kernel_getpeername - get the address which the socket is connected (kernel space)
3484 * @sock: socket
3487 * Fills the @addr pointer with the address which the socket is connected.
3491 int kernel_getpeername(struct socket *sock, struct sockaddr *addr) in kernel_getpeername()
3498 * kernel_sendpage - send a &page through a socket (kernel space)
3499 * @sock: socket
3508 int kernel_sendpage(struct socket *sock, struct page *page, int offset, in kernel_sendpage()
3535 struct socket *sock = sk->sk_socket; in kernel_sendpage_locked()
3547 * @sock: socket
3553 int kernel_sock_shutdown(struct socket *sock, enum sock_shutdown_cmd how) in kernel_sock_shutdown()
3560 * kernel_sock_ip_overhead - returns the IP overhead imposed by a socket
3561 * @sk: socket
3563 * This routine returns the IP overhead imposed by a socket i.e.
3565 * this is an IPv4 or IPv6 socket and the length from IP options turned
3566 * on at the socket. Assumes that the caller has a lock on the socket.
3602 default: /* Returns 0 overhead if the socket is not ipv4 or ipv6 */ in kernel_sock_ip_overhead()