CUBRID Engine  latest
broker_shm.c File Reference
#include <stdio.h>
#include <sys/types.h>
#include <errno.h>
#include <assert.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <netdb.h>
#include "cas_common.h"
#include "broker_shm.h"
#include "broker_error.h"
#include "broker_filename.h"
#include "broker_util.h"
Include dependency graph for broker_shm.c:

Go to the source code of this file.

Macros

#define SHMODE   0644
 

Functions

static int get_host_ip (unsigned char *ip_addr)
 
static void broker_shm_set_as_info (T_SHM_APPL_SERVER *shm_appl, T_APPL_SERVER_INFO *as_info_p, T_BROKER_INFO *br_info_p, int as_index)
 
static void shard_shm_set_shard_conn_info (T_SHM_APPL_SERVER *shm_as_p, T_SHM_PROXY *shm_proxy_p)
 
static void get_access_log_file_name (char *access_log_file, char *access_log_path, char *broker_name, int len)
 
static void get_error_log_file_name (char *access_log_file, char *error_log_path, char *broker_name, int len)
 
static const char * get_appl_server_name (int appl_server_type)
 
void * uw_shm_open (int shm_key, int which_shm, T_SHM_MODE shm_mode)
 
void * uw_shm_create (int shm_key, int size, int which_shm)
 
int uw_shm_destroy (int shm_key)
 
T_SHM_BROKERbroker_shm_initialize_shm_broker (int master_shm_id, T_BROKER_INFO *br_info, int br_num, int acl_flag, char *acl_file)
 
T_SHM_APPL_SERVERbroker_shm_initialize_shm_as (T_BROKER_INFO *br_info_p, T_SHM_PROXY *shm_proxy_p)
 
void uw_shm_detach (void *p)
 
int uw_sem_init (sem_t *sem)
 
int uw_sem_wait (sem_t *sem)
 
int uw_sem_post (sem_t *sem)
 
int uw_sem_destroy (sem_t *sem)
 

Macro Definition Documentation

#define SHMODE   0644

Definition at line 55 of file broker_shm.c.

Referenced by uw_shm_create(), uw_shm_destroy(), and uw_shm_open().

Function Documentation

T_SHM_APPL_SERVER* broker_shm_initialize_shm_as ( T_BROKER_INFO br_info_p,
T_SHM_PROXY shm_proxy_p 
)

Definition at line 471 of file broker_shm.c.

References t_broker_info::access_log, t_shm_appl_server::access_log, t_broker_info::access_log_file, t_shm_appl_server::access_log_file, t_broker_info::access_log_max_size, t_shm_appl_server::access_log_max_size, t_broker_info::access_mode, t_shm_appl_server::access_mode, t_appl_server_info::advance_activate_flag, t_broker_info::appl_server, t_broker_info::appl_server_hard_limit, t_shm_appl_server::appl_server_hard_limit, t_broker_info::appl_server_max_num, t_broker_info::appl_server_max_size, t_shm_appl_server::appl_server_max_size, t_shm_appl_server::appl_server_name, t_broker_info::appl_server_num, t_broker_info::appl_server_shm_id, t_shm_appl_server::as_info, t_shard_info::as_info_index_base, assert, t_shm_appl_server::broker_name, t_shm_appl_server::broker_port, broker_shm_set_as_info(), t_broker_info::cache_user_info, t_shm_appl_server::cache_user_info, t_broker_info::cas_rctime, t_shm_appl_server::cas_rctime, t_broker_info::cci_default_autocommit, t_shm_appl_server::cci_default_autocommit, t_broker_info::cci_pconnect, t_shm_appl_server::cci_pconnect, t_broker_info::connect_order, t_shm_appl_server::connect_order, t_appl_server_info::database_passwd, t_appl_server_info::database_user, t_broker_info::db_connection_file, t_shm_appl_server::db_connection_file, t_shard_conn_info::db_password, t_shard_conn_info::db_user, t_broker_info::err_log_dir, t_shm_appl_server::err_log_dir, t_broker_info::error_log_file, t_shm_appl_server::error_log_file, t_appl_server_info::fixed_shard_user, t_proxy_info::fixed_shard_user, t_appl_server_info::force_reconnect, get_appl_server_name(), t_max_heap_node::id, t_broker_info::jdbc_cache, t_shm_appl_server::jdbc_cache, t_broker_info::jdbc_cache_life_time, t_shm_appl_server::jdbc_cache_life_time, t_broker_info::jdbc_cache_only_hint, t_shm_appl_server::jdbc_cache_only_hint, t_shm_appl_server::job_queue, t_broker_info::job_queue_size, t_shm_appl_server::job_queue_size, t_broker_info::keep_connection, t_shm_appl_server::keep_connection, t_broker_info::log_dir, t_shm_appl_server::log_dir, t_broker_info::long_query_time, t_shm_appl_server::long_query_time, t_broker_info::long_transaction_time, t_shm_appl_server::long_transaction_time, t_shard_info::max_appl_server, t_broker_info::max_num_delayed_hosts_lookup, t_shm_appl_server::max_num_delayed_hosts_lookup, t_broker_info::max_prepared_stmt_count, t_shm_appl_server::max_prepared_stmt_count, t_broker_info::max_string_length, t_shm_appl_server::max_string_length, t_broker_info::monitor_hang_flag, t_shm_appl_server::monitor_hang_flag, t_broker_info::monitor_server_flag, t_shm_appl_server::monitor_server_flag, t_broker_info::mysql_keepalive_interval, t_shm_appl_server::mysql_keepalive_interval, t_broker_info::mysql_read_timeout, t_shm_appl_server::mysql_read_timeout, t_broker_info::name, NULL, t_shm_appl_server::num_appl_server, t_shm_proxy::num_proxy, t_proxy_info::num_shard_conn, OFF, t_broker_info::port, t_shm_appl_server::port_name, t_broker_info::preferred_hosts, t_shm_appl_server::preferred_hosts, t_broker_info::proxy_conn_wait_timeout, t_appl_server_info::proxy_conn_wait_timeout, proxy_id, t_appl_server_info::proxy_id, t_shm_proxy::proxy_info, proxy_info_p, t_broker_info::proxy_log_dir, t_shm_appl_server::proxy_log_dir, t_broker_info::proxy_log_max_size, t_shm_appl_server::proxy_log_max_size, t_broker_info::query_timeout, t_shm_appl_server::query_timeout, t_broker_info::replica_only_flag, t_shm_appl_server::replica_only_flag, t_broker_info::session_timeout, t_shm_appl_server::session_timeout, t_appl_server_info::shard_cas_id, t_shm_appl_server::shard_conn_info, t_broker_info::shard_flag, t_shm_appl_server::shard_flag, t_appl_server_info::shard_id, t_proxy_info::shard_info, shard_shm_set_shard_conn_info(), SHM_APPL_SERVER, shm_as_p, SHM_PROXY_NAME_MAX, t_broker_info::slow_log_dir, t_shm_appl_server::slow_log_dir, t_broker_info::slow_log_mode, t_shm_appl_server::slow_log_mode, t_broker_info::sql_log2, t_shm_appl_server::sql_log2, t_broker_info::sql_log_max_size, t_shm_appl_server::sql_log_max_size, t_broker_info::sql_log_mode, t_shm_appl_server::sql_log_mode, t_broker_info::statement_pooling, t_shm_appl_server::statement_pooling, t_broker_info::stripped_column_name, t_shm_appl_server::stripped_column_name, strncpy_bufsize, t_broker_info::trigger_action_flag, t_shm_appl_server::trigger_action_flag, t_shm_appl_server::unusable_databases_cnt, ut_get_broker_port_name(), and uw_shm_create().

Referenced by admin_on_cmd(), and admin_start_cmd().

Here is the caller graph for this function:

static void broker_shm_set_as_info ( T_SHM_APPL_SERVER shm_appl,
T_APPL_SERVER_INFO as_info_p,
T_BROKER_INFO br_info_p,
int  as_index 
)
static
static void get_access_log_file_name ( char *  access_log_file,
char *  access_log_path,
char *  broker_name,
int  len 
)
static

Definition at line 926 of file broker_shm.c.

Referenced by broker_shm_initialize_shm_broker().

Here is the caller graph for this function:

static const char * get_appl_server_name ( int  appl_server_type)
static
static void get_error_log_file_name ( char *  access_log_file,
char *  error_log_path,
char *  broker_name,
int  len 
)
static

Definition at line 932 of file broker_shm.c.

Referenced by broker_shm_initialize_shm_broker().

Here is the caller graph for this function:

static int get_host_ip ( unsigned char *  ip_addr)
static

Definition at line 742 of file broker_shm.c.

References CUB_MAXHOSTNAMELEN, FALSE, NULL, and uw_sem_init().

Referenced by broker_shm_initialize_shm_broker(), net_connect_proxy(), and write_buffer().

Here is the caller graph for this function:

int uw_sem_destroy ( sem_t *  sem)

Definition at line 919 of file broker_shm.c.

Referenced by br_inactivate(), and uw_sem_post().

Here is the caller graph for this function:

int uw_sem_init ( sem_t *  sem)

Definition at line 834 of file broker_shm.c.

References uw_sem_wait().

Referenced by access_control_set_shm(), and get_host_ip().

Here is the caller graph for this function:

int uw_sem_post ( sem_t *  sem)

Definition at line 893 of file broker_shm.c.

References NULL, and uw_sem_destroy().

Referenced by access_control_check_right(), access_control_read_config_file(), record_ip_access_time(), and uw_sem_wait().

Here is the caller graph for this function:

int uw_sem_wait ( sem_t *  sem)

Definition at line 867 of file broker_shm.c.

References uw_sem_post().

Referenced by access_control_check_right(), access_control_read_config_file(), record_ip_access_time(), and uw_sem_init().

Here is the caller graph for this function:

void* uw_shm_create ( int  shm_key,
int  size,
int  which_shm 
)

Definition at line 334 of file broker_shm.c.

References MAGIC_NUMBER, NULL, p, SHM_APPL_SERVER, SHM_BROKER, SHM_PROXY, and SHMODE.

Referenced by broker_shm_initialize_shm_as(), broker_shm_initialize_shm_broker(), shard_shm_initialize_shm_proxy(), and uw_shm_open().

Here is the caller graph for this function:

int uw_shm_destroy ( int  shm_key)

Definition at line 391 of file broker_shm.c.

References SHMODE.

Referenced by admin_off_cmd(), admin_on_cmd(), admin_start_cmd(), admin_stop_cmd(), and shard_shm_initialize_shm_proxy().

Here is the caller graph for this function: