MySQL 8.0.30
Source Code Documentation
mysql_socket.h File Reference
#include <errno.h>
#include <string.h>
#include "my_psi_config.h"
#include "my_compiler.h"
#include "my_dir.h"
#include "my_io.h"
#include "mysql/psi/psi_socket.h"
#include <netinet/in.h>
#include "my_macros.h"
#include "mysql/components/services/bits/mysql_socket_bits.h"
#include "pfs_socket_provider.h"

Go to the source code of this file.

Macros

#define SOCKBUF_T   void
 
#define mysql_socket_register(P1, P2, P3)    inline_mysql_socket_register(P1, P2, P3)
 Socket registration. More...
 
#define MYSQL_SOCKET_WAIT_VARIABLES(LOCKER, STATE)
 Instrumentation helper for socket waits. More...
 
#define MYSQL_START_SOCKET_WAIT(LOCKER, STATE, SOCKET, OP, COUNT)
 Instrumentation helper for socket waits. More...
 
#define MYSQL_END_SOCKET_WAIT(LOCKER, COUNT)    inline_mysql_end_socket_wait(LOCKER, COUNT)
 Instrumentation helper for socket waits. More...
 
#define MYSQL_SOCKET_SET_STATE(SOCKET, STATE)    inline_mysql_socket_set_state(SOCKET, STATE)
 Set the state (IDLE, ACTIVE) of an instrumented socket. More...
 
#define mysql_socket_socket(K, D, T, P)   inline_mysql_socket_socket(K, D, T, P)
 Create a socket. More...
 
#define mysql_socket_bind(FD, AP, L)    inline_mysql_socket_bind(__FILE__, __LINE__, FD, AP, L)
 Bind a socket to a local port number and IP address mysql_socket_bind is a replacement for bind. More...
 
#define mysql_socket_getsockname(FD, AP, LP)    inline_mysql_socket_getsockname(__FILE__, __LINE__, FD, AP, LP)
 Return port number and IP address of the local host mysql_socket_getsockname is a replacement for getsockname. More...
 
#define mysql_socket_connect(FD, AP, L)    inline_mysql_socket_connect(__FILE__, __LINE__, FD, AP, L)
 Establish a connection to a remote host. More...
 
#define mysql_socket_getpeername(FD, AP, LP)    inline_mysql_socket_getpeername(__FILE__, __LINE__, FD, AP, LP)
 Get port number and IP address of remote host that a socket is connected to. More...
 
#define mysql_socket_send(FD, B, N, FL)    inline_mysql_socket_send(__FILE__, __LINE__, FD, B, N, FL)
 Send data from the buffer, B, to a connected socket. More...
 
#define mysql_socket_recv(FD, B, N, FL)    inline_mysql_socket_recv(__FILE__, __LINE__, FD, B, N, FL)
 Receive data from a connected socket. More...
 
#define mysql_socket_sendto(FD, B, N, FL, AP, L)    inline_mysql_socket_sendto(__FILE__, __LINE__, FD, B, N, FL, AP, L)
 Send data to a socket at the specified address. More...
 
#define mysql_socket_recvfrom(FD, B, N, FL, AP, LP)    inline_mysql_socket_recvfrom(__FILE__, __LINE__, FD, B, N, FL, AP, LP)
 Receive data from a socket and return source address information mysql_socket_recvfrom is a replacement for recvfrom. More...
 
#define mysql_socket_getsockopt(FD, LV, ON, OP, OL)    inline_mysql_socket_getsockopt(__FILE__, __LINE__, FD, LV, ON, OP, OL)
 Get a socket option for the specified socket. More...
 
#define mysql_socket_setsockopt(FD, LV, ON, OP, OL)    inline_mysql_socket_setsockopt(__FILE__, __LINE__, FD, LV, ON, OP, OL)
 Set a socket option for the specified socket. More...
 
#define mysql_sock_set_nonblocking(FD)    inline_mysql_sock_set_nonblocking(__FILE__, __LINE__, FD)
 Set socket to non-blocking. More...
 
#define mysql_socket_listen(FD, N)    inline_mysql_socket_listen(__FILE__, __LINE__, FD, N)
 Set socket state to listen for an incoming connection. More...
 
#define mysql_socket_accept(K, FD, AP, LP)    inline_mysql_socket_accept(__FILE__, __LINE__, K, FD, AP, LP)
 Accept a connection from any remote host; TCP only. More...
 
#define mysql_socket_close(FD)   inline_mysql_socket_close(__FILE__, __LINE__, FD)
 Close a socket and sever any connections. More...
 
#define mysql_socket_shutdown(FD, H)    inline_mysql_socket_shutdown(__FILE__, __LINE__, FD, H)
 Disable receives and/or sends on a socket. More...
 

Functions

static void mysql_socket_set_address (MYSQL_SOCKET socket, const struct sockaddr *addr, socklen_t addr_len)
 Set socket descriptor and address. More...
 
static void mysql_socket_set_thread_owner (MYSQL_SOCKET socket)
 Assign the current thread instrumentation to the socket. More...
 
static my_socket mysql_socket_getfd (MYSQL_SOCKET mysql_socket)
 MYSQL_SOCKET helper. More...
 
static void mysql_socket_setfd (MYSQL_SOCKET *mysql_socket, my_socket fd)
 MYSQL_SOCKET helper. More...
 
static struct PSI_socket_lockerinline_mysql_start_socket_wait (PSI_socket_locker_state *state, MYSQL_SOCKET mysql_socket, enum PSI_socket_operation op, size_t byte_count, const char *src_file, int src_line)
 Instrumentation calls for MYSQL_START_SOCKET_WAIT. More...
 
static void inline_mysql_end_socket_wait (struct PSI_socket_locker *locker, size_t byte_count)
 Instrumentation calls for MYSQL_END_SOCKET_WAIT. More...
 
static void inline_mysql_socket_set_state (MYSQL_SOCKET socket, enum PSI_socket_state state)
 Set the state (IDLE, ACTIVE) of an instrumented socket. More...
 
static void inline_mysql_socket_register (const char *category, PSI_socket_info *info, int count)
 
static MYSQL_SOCKET inline_mysql_socket_socket (PSI_socket_key key, int domain, int type, int protocol)
 mysql_socket_socket More...
 
static int inline_mysql_socket_bind (const char *src_file, uint src_line, MYSQL_SOCKET mysql_socket, const struct sockaddr *addr, socklen_t len)
 mysql_socket_bind More...
 
static int inline_mysql_socket_getsockname (const char *src_file, uint src_line, MYSQL_SOCKET mysql_socket, struct sockaddr *addr, socklen_t *len)
 mysql_socket_getsockname More...
 
static int inline_mysql_socket_connect (const char *src_file, uint src_line, MYSQL_SOCKET mysql_socket, const struct sockaddr *addr, socklen_t len)
 mysql_socket_connect More...
 
static int inline_mysql_socket_getpeername (const char *src_file, uint src_line, MYSQL_SOCKET mysql_socket, struct sockaddr *addr, socklen_t *len)
 mysql_socket_getpeername More...
 
static ssize_t inline_mysql_socket_send (const char *src_file, uint src_line, MYSQL_SOCKET mysql_socket, const SOCKBUF_T *buf, size_t n, int flags)
 mysql_socket_send More...
 
static ssize_t inline_mysql_socket_recv (const char *src_file, uint src_line, MYSQL_SOCKET mysql_socket, SOCKBUF_T *buf, size_t n, int flags)
 mysql_socket_recv More...
 
static ssize_t inline_mysql_socket_sendto (const char *src_file, uint src_line, MYSQL_SOCKET mysql_socket, const SOCKBUF_T *buf, size_t n, int flags, const struct sockaddr *addr, socklen_t addr_len)
 mysql_socket_sendto More...
 
static ssize_t inline_mysql_socket_recvfrom (const char *src_file, uint src_line, MYSQL_SOCKET mysql_socket, SOCKBUF_T *buf, size_t n, int flags, struct sockaddr *addr, socklen_t *addr_len)
 mysql_socket_recvfrom More...
 
static int inline_mysql_socket_getsockopt (const char *src_file, uint src_line, MYSQL_SOCKET mysql_socket, int level, int optname, SOCKBUF_T *optval, socklen_t *optlen)
 mysql_socket_getsockopt More...
 
static int inline_mysql_socket_setsockopt (const char *src_file, uint src_line, MYSQL_SOCKET mysql_socket, int level, int optname, const SOCKBUF_T *optval, socklen_t optlen)
 mysql_socket_setsockopt More...
 
static int set_socket_nonblock (my_socket fd)
 set_socket_nonblock More...
 
static int inline_mysql_sock_set_nonblocking (const char *src_file, uint src_line, MYSQL_SOCKET mysql_socket)
 mysql_socket_set_nonblocking More...
 
static int inline_mysql_socket_listen (const char *src_file, uint src_line, MYSQL_SOCKET mysql_socket, int backlog)
 mysql_socket_listen More...
 
static MYSQL_SOCKET inline_mysql_socket_accept (const char *src_file, uint src_line, PSI_socket_key key, MYSQL_SOCKET socket_listen, struct sockaddr *addr, socklen_t *addr_len)
 mysql_socket_accept More...
 
static int inline_mysql_socket_close (const char *src_file, uint src_line, MYSQL_SOCKET mysql_socket)
 mysql_socket_close More...
 
static int inline_mysql_socket_shutdown (const char *src_file, uint src_line, MYSQL_SOCKET mysql_socket, int how)
 mysql_socket_shutdown More...
 

Macro Definition Documentation

◆ SOCKBUF_T

#define SOCKBUF_T   void