CUBRID Engine  latest
area_alloc.c File Reference
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "area_alloc.h"
#include "set_object.h"
#include "work_space.h"
Include dependency graph for area_alloc.c:

Go to the source code of this file.

Macros

#define pthread_mutex_init(a, b)
 
#define pthread_mutex_destroy(a)
 
#define pthread_mutex_lock(a)   0
 
#define pthread_mutex_unlock(a)
 
#define AREA_PREFIX_SIZE   sizeof(double)
 
#define LF_AREA_BITMAP_USAGE_RATIO   LF_BITMAP_FULL_USAGE_RATIO
 
#define VOLATILE_ACCESS(v, t)   (*((t volatile *) &(v)))
 
#define ER_AREA_ALREADY_STARTED   ER_GENERIC_ERROR
 

Enumerations

enum  { AREA_PREFIX_INITED = 0, AREA_PREFIX_FREED = 0x01010101 }
 

Functions

static void area_info (AREA *area, FILE *fp)
 
static AREA_BLOCKarea_alloc_block (AREA *area)
 
static AREA_BLOCKSET_LISTarea_alloc_blockset (AREA *area)
 
static int area_insert_block (AREA *area, AREA_BLOCK *new_block)
 
static AREA_BLOCKarea_find_block (AREA *area, const void *ptr)
 
void area_init (void)
 
void area_final (void)
 
AREAarea_create (const char *name, size_t element_size, size_t alloc_count)
 
void area_destroy (AREA *area)
 
void * area_alloc (AREA *area)
 
int area_validate (AREA *area, const void *address)
 
int area_free (AREA *area, void *ptr)
 
void area_flush (AREA *area)
 
void area_dump (FILE *fp)
 

Variables

static int rv
 
static AREAarea_List = NULL
 

Macro Definition Documentation

#define AREA_PREFIX_SIZE   sizeof(double)

Definition at line 59 of file area_alloc.c.

Referenced by area_alloc(), area_create(), area_free(), and area_info().

#define ER_AREA_ALREADY_STARTED   ER_GENERIC_ERROR

Referenced by area_init().

#define LF_AREA_BITMAP_USAGE_RATIO   LF_BITMAP_FULL_USAGE_RATIO

Definition at line 79 of file area_alloc.c.

Referenced by area_alloc_block().

#define pthread_mutex_lock (   a)    0

Definition at line 50 of file area_alloc.c.

Referenced by area_alloc(), area_create(), area_destroy(), area_dump(), broker_add_new_cas(), broker_add_proxy_conn(), broker_delete_proxy_conn_by_fd(), broker_delete_proxy_conn_by_proxy_id(), broker_destroy_proxy_conn(), broker_drop_one_cas_by_time_to_kill(), broker_find_available_proxy(), broker_get_proxy_conn_maxfd(), broker_get_readable_proxy_conn(), broker_register_proxy_conn(), broker_set_proxy_fds(), csect_check_own_critical_section(), csect_demote_critical_section(), csect_enter_critical_section(), csect_enter_critical_section_as_reader(), csect_exit_critical_section(), csect_promote_critical_section(), css_check_master_socket_exception(), css_check_master_socket_input(), css_connection_handler_thread(), css_count_transaction_worker_threads_mapfunc(), css_decrement_num_conn(), css_get_next_client_id(), css_hostname_to_ip(), css_increment_num_conn(), css_master_select_error(), css_master_timeout(), css_sockaddr(), disk_cache_lock_reserve(), disk_lock_extend(), dispatch_thr_f(), css_server_task::execute(), css_server_external_task::execute(), css_connection_task::execute(), file_tempcache_retire_entry(), find_add_as_index(), find_drop_as_index(), find_idle_cas(), hb_check_request_eligibility(), hb_cleanup_conn_and_start_process(), hb_cluster_cleanup(), hb_cluster_initialize(), hb_cluster_job_calc_score(), hb_cluster_job_check_ping(), hb_cluster_job_check_valid_ping_server(), hb_cluster_job_demote(), hb_cluster_job_failback(), hb_cluster_job_failover(), hb_cluster_job_heartbeat(), hb_cluster_job_initialize(), hb_cluster_receive_heartbeat(), hb_deregister_by_args(), hb_deregister_by_pid(), hb_disable_er_log(), hb_enable_er_log(), hb_get_admin_info_string(), hb_get_node_info_string(), hb_get_ping_host_info_string(), hb_get_process_info_string(), hb_help_sprint_jobs_info(), hb_hostname_to_sin_addr(), hb_is_deactivation_ready(), hb_is_hang_process(), hb_is_registered_process(), hb_job_dequeue(), hb_job_queue(), hb_job_set_expire_and_reorder(), hb_job_shutdown(), hb_kill_all_heartbeat_process(), hb_prepare_deactivate_heartbeat(), hb_register_new_process(), hb_reload_config(), hb_resource_cleanup(), hb_resource_initialize(), hb_resource_job_change_mode(), hb_resource_job_cleanup_all(), hb_resource_job_confirm_cleanup_all(), hb_resource_job_confirm_dereg(), hb_resource_job_confirm_start(), hb_resource_job_demote_confirm_shutdown(), hb_resource_job_demote_start_shutdown(), hb_resource_job_initialize(), hb_resource_job_proc_dereg(), hb_resource_job_proc_start(), hb_resource_receive_changemode(), hb_resource_receive_get_eof(), hb_return_proc_state_by_fd(), hb_start_util_process(), hb_thread_check_disk_failure(), cubthread::entry::lock(), lock_clear_deadlock_victim(), lock_demote_class_lock(), lock_detect_local_deadlock(), lockfree::hashmap< Key, T >::lock_entry_mutex(), lock_get_class_lock(), lock_get_lock_holder_tran_index(), lock_get_object_lock(), lock_has_lock_on_object(), lock_has_xlock(), lock_notify_isolation_incons(), lock_unlock_all_shared_get_all_exclusive(), lock_wait_state_to_string(), logwr_log_ha_filestat_to_string(), parser_allocate_string_buffer(), parser_create_node(), parser_create_node_block(), parser_create_parser(), parser_create_string_block(), parser_free_node(), perfmon_finalize(), pt_find_string_block(), pt_free_a_string_block(), pt_free_node_blocks(), pt_free_string_blocks(), pt_register_parser(), pt_unregister_parser(), px_sort_assign(), px_sort_myself(), receiver_thr_f(), rmutex_dump_statistics(), rmutex_lock(), run_appl_server(), run_proxy_server(), rwlock_dump_statistics(), rwlock_read_lock(), rwlock_read_unlock(), rwlock_write_lock(), shard_dispatch_thr_f(), sort_inphase_sort(), sync_allocate_sync_stats(), sync_deallocate_sync_stats(), thread_suspend_with_other_mutex(), tp_domain_cache(), vacuum_notify_all_workers_dropped_file(), xcache_find_xasl_id_for_execute(), and xcache_retire_clone().

#define pthread_mutex_unlock (   a)

Definition at line 51 of file area_alloc.c.

Referenced by area_alloc(), area_create(), area_destroy(), area_dump(), broker_add_new_cas(), broker_add_proxy_conn(), broker_delete_proxy_conn_by_fd(), broker_delete_proxy_conn_by_proxy_id(), broker_destroy_proxy_conn(), broker_drop_one_cas_by_time_to_kill(), broker_find_available_proxy(), broker_get_proxy_conn_maxfd(), broker_get_readable_proxy_conn(), broker_register_proxy_conn(), broker_set_proxy_fds(), csect_check_own_critical_section(), csect_demote_critical_section(), csect_enter_critical_section(), csect_enter_critical_section_as_reader(), csect_exit_critical_section(), csect_promote_critical_section(), css_check_master_socket_exception(), css_check_master_socket_input(), css_connection_handler_thread(), css_count_transaction_worker_threads_mapfunc(), css_decrement_num_conn(), css_get_next_client_id(), css_hostname_to_ip(), css_increment_num_conn(), css_internal_request_handler(), css_master_select_error(), css_master_timeout(), css_sockaddr(), disk_cache_unlock_reserve(), disk_unlock_extend(), dispatch_thr_f(), lf_hash_table_cpp< Key, T >::erase_locked(), file_tempcache_unlock(), find_add_as_index(), find_drop_as_index(), find_idle_cas(), fpcache_claim(), fpcache_remove_by_class(), fpcache_retire(), hb_check_request_eligibility(), hb_cleanup_conn_and_start_process(), hb_cluster_cleanup(), hb_cluster_initialize(), hb_cluster_job_calc_score(), hb_cluster_job_check_ping(), hb_cluster_job_check_valid_ping_server(), hb_cluster_job_demote(), hb_cluster_job_failback(), hb_cluster_job_failover(), hb_cluster_job_heartbeat(), hb_cluster_job_initialize(), hb_cluster_receive_heartbeat(), hb_deregister_by_args(), hb_deregister_by_pid(), hb_disable_er_log(), hb_enable_er_log(), hb_get_admin_info_string(), hb_get_node_info_string(), hb_get_ping_host_info_string(), hb_get_process_info_string(), hb_help_sprint_jobs_info(), hb_hostname_to_sin_addr(), hb_is_deactivation_ready(), hb_is_hang_process(), hb_is_registered_process(), hb_job_dequeue(), hb_job_queue(), hb_job_set_expire_and_reorder(), hb_job_shutdown(), hb_kill_all_heartbeat_process(), hb_prepare_deactivate_heartbeat(), hb_register_new_process(), hb_reload_config(), hb_resource_cleanup(), hb_resource_initialize(), hb_resource_job_change_mode(), hb_resource_job_cleanup_all(), hb_resource_job_confirm_cleanup_all(), hb_resource_job_confirm_dereg(), hb_resource_job_confirm_start(), hb_resource_job_demote_confirm_shutdown(), hb_resource_job_demote_start_shutdown(), hb_resource_job_initialize(), hb_resource_job_proc_dereg(), hb_resource_job_proc_start(), hb_resource_receive_changemode(), hb_resource_receive_get_eof(), hb_return_proc_state_by_fd(), hb_start_util_process(), hb_thread_check_disk_failure(), lock_clear_deadlock_victim(), lock_demote_class_lock(), lock_detect_local_deadlock(), lock_find_tran_hold_entry(), lock_get_class_lock(), lock_get_lock_holder_tran_index(), lock_get_object_lock(), lock_has_lock_on_object(), lock_has_xlock(), lock_notify_isolation_incons(), lock_unlock_all_shared_get_all_exclusive(), lock_wait_state_to_string(), logwr_log_ha_filestat_to_string(), net_server_conn_down(), parser_allocate_string_buffer(), parser_create_node(), parser_create_node_block(), parser_create_parser(), parser_create_string_block(), parser_free_node(), perfmon_finalize(), pt_find_string_block(), pt_free_a_string_block(), pt_free_node_blocks(), pt_free_string_blocks(), pt_register_parser(), pt_unregister_parser(), px_sort_assign(), px_sort_myself(), receiver_thr_f(), rmutex_dump_statistics(), rmutex_unlock(), run_appl_server(), run_proxy_server(), rwlock_dump_statistics(), rwlock_read_lock(), rwlock_read_unlock(), rwlock_write_unlock(), shard_dispatch_thr_f(), sort_inphase_sort(), sync_allocate_sync_stats(), sync_deallocate_sync_stats(), thread_suspend_timeout_wakeup_and_unlock_entry(), thread_suspend_wakeup_and_unlock_entry(), thread_suspend_with_other_mutex(), tp_domain_cache(), cubthread::entry::unlock(), lf_hash_table_cpp< Key, T >::unlock(), lockfree::hashmap< Key, T >::unlock_entry_mutex_force(), lockfree::hashmap< Key, T >::unlock_entry_mutex_if_locked(), vacuum_notify_all_workers_dropped_file(), xcache_find_xasl_id_for_execute(), and xcache_retire_clone().

Enumeration Type Documentation

anonymous enum
Enumerator
AREA_PREFIX_INITED 
AREA_PREFIX_FREED 

Definition at line 61 of file area_alloc.c.

Function Documentation

static AREA_BLOCKSET_LIST * area_alloc_blockset ( AREA area)
static
void area_destroy ( AREA area)

Definition at line 247 of file area_alloc.c.

References area_flush(), assert, free_and_init, area::next, NULL, pthread_mutex_lock, pthread_mutex_unlock, and rv.

Referenced by classobj_area_final(), obt_area_final(), pr_area_final(), set_area_final(), test_area(), tp_final(), and ws_area_final().

Here is the caller graph for this function:

void area_dump ( FILE *  fp)

Definition at line 853 of file area_alloc.c.

References area_info(), area::next, NULL, pthread_mutex_lock, pthread_mutex_unlock, and rv.

Referenced by ws_dump().

Here is the caller graph for this function:

void area_final ( void  )
static AREA_BLOCK * area_find_block ( AREA area,
const void *  ptr 
)
static
void area_init ( void  )
static int area_insert_block ( AREA area,
AREA_BLOCK new_block 
)
static
int area_validate ( AREA area,
const void *  address 
)

Definition at line 487 of file area_alloc.c.

References area_find_block(), ARG_FILE_LINE, assert, ER_AREA_ILLEGAL_POINTER, ER_ERROR_SEVERITY, er_set(), error(), NO_ERROR, NULL, and p.

Referenced by ml_ext_free().

Here is the caller graph for this function:

Variable Documentation

AREA* area_List = NULL
static

Definition at line 71 of file area_alloc.c.

Referenced by area_create().

int rv
static

Definition at line 52 of file area_alloc.c.

Referenced by _DEFUN(), area_alloc(), area_create(), area_destroy(), area_dump(), btree_check_by_class_oid(), css_check_master_socket_exception(), css_check_master_socket_input(), css_connection_handler_thread(), css_get_next_client_id(), css_master_select_error(), css_master_timeout(), css_process_deregister_ha_process(), hb_check_request_eligibility(), hb_cleanup_conn_and_start_process(), hb_cluster_cleanup(), hb_cluster_initialize(), hb_cluster_job_calc_score(), hb_cluster_job_check_ping(), hb_cluster_job_check_valid_ping_server(), hb_cluster_job_demote(), hb_cluster_job_failover(), hb_cluster_job_heartbeat(), hb_cluster_job_initialize(), hb_cluster_receive_heartbeat(), hb_create_master_reader(), hb_disable_er_log(), hb_enable_er_log(), hb_get_admin_info_string(), hb_get_node_info_string(), hb_get_ping_host_info_string(), hb_get_process_info_string(), hb_help_sprint_jobs_info(), hb_is_hang_process(), hb_job_dequeue(), hb_job_queue(), hb_job_shutdown(), hb_kill_all_heartbeat_process(), hb_prepare_deactivate_heartbeat(), hb_register_new_process(), hb_reload_config(), hb_resource_initialize(), hb_resource_job_change_mode(), hb_resource_job_cleanup_all(), hb_resource_job_confirm_cleanup_all(), hb_resource_job_confirm_dereg(), hb_resource_job_confirm_start(), hb_resource_job_demote_confirm_shutdown(), hb_resource_job_demote_start_shutdown(), hb_resource_job_initialize(), hb_resource_job_proc_dereg(), hb_resource_job_proc_start(), hb_resource_receive_changemode(), hb_resource_receive_get_eof(), hb_return_proc_state_by_fd(), hb_thread_check_disk_failure(), hb_thread_initialize(), locator_check_by_class_oid(), locator_check_class(), lock_clear_deadlock_victim(), lock_demote_class_lock(), lock_detect_local_deadlock(), lock_get_class_lock(), lock_get_lock_holder_tran_index(), lock_get_object_lock(), lock_has_lock_on_object(), lock_has_xlock(), lock_notify_isolation_incons(), lock_unlock_all_shared_get_all_exclusive(), lock_wait_state_to_string(), logwr_log_ha_filestat_to_string(), parser_allocate_string_buffer(), parser_create_node(), parser_create_node_block(), parser_create_parser(), parser_create_string_block(), parser_free_node(), pt_find_string_block(), pt_free_a_string_block(), pt_free_node_blocks(), pt_free_string_blocks(), pt_register_parser(), pt_unregister_parser(), px_sort_assign(), px_sort_myself(), qmgr_free_list_temp_file(), qmgr_get_temp_file_from_list(), qmgr_initialize_temp_file_list(), qmgr_put_temp_file_into_list(), sort_inphase_sort(), sort_listfile(), sort_return_used_resources(), and tp_domain_cache().