MySQL 8.3.0
Source Code Documentation
pfs_global.cc File Reference

Miscellaneous global dependencies (implementation). More...

#include "storage/perfschema/pfs_global.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "my_inttypes.h"
#include "my_sys.h"
#include "sql/log.h"
#include "storage/perfschema/pfs_builtin_memory.h"
#include <unistd.h>
#include <arpa/inet.h>
#include <netinet/in.h>

Functions

void * pfs_malloc (PFS_builtin_memory_class *klass, size_t size, myf flags)
 Memory allocation for the performance schema. More...
 
void pfs_free (PFS_builtin_memory_class *klass, size_t size, void *ptr)
 Free memory allocated with. More...
 
void * pfs_malloc_array (PFS_builtin_memory_class *klass, size_t n, size_t size, myf flags)
 Array allocation for the performance schema. More...
 
void pfs_free_array (PFS_builtin_memory_class *klass, size_t n, size_t size, void *ptr)
 Free array allocated by. More...
 
bool is_overflow (size_t product, size_t n1, size_t n2)
 Detect multiplication overflow. More...
 
void pfs_print_error (const char *format,...)
 
uint pfs_get_socket_address (char *host, uint host_len, uint *port, const struct sockaddr_storage *src_addr, socklen_t)
 Convert raw ip address into readable format. More...
 

Variables

bool pfs_initialized = false
 True when the performance schema is initialized. More...
 

Detailed Description

Miscellaneous global dependencies (implementation).

Function Documentation

◆ is_overflow()

bool is_overflow ( size_t  product,
size_t  n1,
size_t  n2 
)

Detect multiplication overflow.

Parameters
productmultiplication product
n1operand
n2operand
Returns
true if multiplication caused an overflow.

◆ pfs_free()

void pfs_free ( PFS_builtin_memory_class klass,
size_t  size,
void *  ptr 
)

Free memory allocated with.

See also
pfs_malloc.

◆ pfs_free_array()

void pfs_free_array ( PFS_builtin_memory_class klass,
size_t  n,
size_t  size,
void *  ptr 
)

Free array allocated by.

Free memory allocated with.

See also
pfs_malloc_array.
Parameters
klassperformance schema memory class
nnumber of array elements
sizeelement size
ptrpointer to memory

◆ pfs_get_socket_address()

uint pfs_get_socket_address ( char *  host,
uint  host_len,
uint *  port,
const struct sockaddr_storage *  src_addr,
socklen_t  src_len 
)

Convert raw ip address into readable format.

Do not do a reverse DNS lookup.

◆ pfs_malloc()

void * pfs_malloc ( PFS_builtin_memory_class klass,
size_t  size,
myf  flags 
)

Memory allocation for the performance schema.

The memory used internally in the performance schema implementation. It is allocated at startup, or during runtime with scalable buffers.

◆ pfs_malloc_array()

void * pfs_malloc_array ( PFS_builtin_memory_class klass,
size_t  n,
size_t  size,
myf  flags 
)

Array allocation for the performance schema.

Allocate an array of structures with overflow check.

Checks for overflow of n * size before allocating.

Parameters
klassperformance schema memory class
nnumber of array elements
sizeelement size
flagsmalloc flags
Returns
pointer to memory on success, else nullptr

◆ pfs_print_error()

void pfs_print_error ( const char *  format,
  ... 
)

Variable Documentation

◆ pfs_initialized

bool pfs_initialized = false

True when the performance schema is initialized.