CUBRID Engine  latest
broker_util.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <assert.h>
#include <ctype.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/timeb.h>
#include <netinet/tcp.h>
#include "porting.h"
#include "cas_common.h"
#include "broker_env_def.h"
#include "broker_util.h"
#include "broker_filename.h"
#include "environment_variable.h"
#include "util_func.h"

Go to the source code of this file.

Functions

int ut_kill_process (int pid)
 
int ut_kill_broker_process (int pid, char *broker_name)
 
int ut_kill_proxy_process (int pid, char *broker_name, int proxy_id)
 
int ut_kill_as_process (int pid, char *broker_name, int as_index, int shard_flag)
 
int ut_set_keepalive (int sock)
 
void ut_cd_work_dir (void)
 
void ut_cd_root_dir (void)
 
void as_pid_file_create (char *br_name, int as_index)
 
void as_db_err_log_set (char *br_name, int proxy_index, int shard_id, int shard_cas_id, int as_index, int shard_flag)
 
int ut_time_string (char *buf, struct timeval *time_val)
 
char * ut_get_ipv4_string (char *ip_str, int len, const unsigned char *ip_addr)
 
float ut_get_avg_from_array (int array[], int size)
 
bool ut_is_appl_server_ready (int pid, char *ready_flag)
 
void ut_get_broker_port_name (char *port_name, char *broker_name, int len)
 
void ut_get_proxy_port_name (char *port_name, char *broker_name, int proxy_id, int len)
 
void ut_get_as_port_name (char *port_name, char *broker_name, int as_id, int len)
 
double ut_size_string_to_kbyte (const char *size_str, const char *default_unit)
 
double ut_time_string_to_sec (const char *time_str, const char *default_unit)
 
void ut_get_as_pid_name (char *pid_name, char *br_name, int as_index, int len)
 

Variables

char db_err_log_file [BROKER_PATH_MAX]
 

Function Documentation

void as_db_err_log_set ( char *  br_name,
int  proxy_index,
int  shard_id,
int  shard_cas_id,
int  as_index,
int  shard_flag 
)

Definition at line 401 of file broker_util.c.

References BROKER_PATH_MAX, db_err_log_file, FID_CUBRID_ERR_DIR, get_cubrid_file(), and ON.

Referenced by cas_init(), and cas_main().

Here is the caller graph for this function:

void as_pid_file_create ( char *  br_name,
int  as_index 
)

Definition at line 385 of file broker_util.c.

References BROKER_PATH_MAX, and ut_get_as_pid_name().

Referenced by cas_init().

Here is the caller graph for this function:

void ut_cd_root_dir ( void  )

Definition at line 343 of file broker_util.c.

References envvar_root(), and pid.

Referenced by admin_conf_change(), and main().

Here is the caller graph for this function:

void ut_cd_work_dir ( void  )

Definition at line 335 of file broker_util.c.

References BROKER_PATH_MAX, and envvar_bindir_file().

Referenced by admin_common(), admin_conf_change(), and main().

Here is the caller graph for this function:

void ut_get_as_pid_name ( char *  pid_name,
char *  br_name,
int  as_index,
int  len 
)

Definition at line 702 of file broker_util.c.

References assert, BROKER_PATH_MAX, FID_AS_PID_DIR, and get_cubrid_file().

Referenced by as_pid_file_create(), restart_appl_server(), and ut_kill_as_process().

Here is the caller graph for this function:

void ut_get_as_port_name ( char *  port_name,
char *  broker_name,
int  as_id,
int  len 
)

Definition at line 570 of file broker_util.c.

References assert, BROKER_PATH_MAX, FID_SOCK_DIR, and get_cubrid_file().

Referenced by as_activate(), cas_main(), connect_srv(), run_appl_server(), and ut_kill_as_process().

Here is the caller graph for this function:

float ut_get_avg_from_array ( int  array[],
int  size 
)

Definition at line 486 of file broker_util.c.

References i.

Referenced by hang_check_thr_f().

Here is the caller graph for this function:

void ut_get_broker_port_name ( char *  port_name,
char *  broker_name,
int  len 
)

Definition at line 542 of file broker_util.c.

References assert, BROKER_PATH_MAX, FID_SOCK_DIR, and get_cubrid_file().

Referenced by broker_shm_initialize_shm_as(), and ut_kill_broker_process().

Here is the caller graph for this function:

char* ut_get_ipv4_string ( char *  ip_str,
int  len,
const unsigned char *  ip_addr 
)

Definition at line 474 of file broker_util.c.

References assert, and NULL.

Referenced by appl_info_display(), cas_access_log(), cas_log_query_cancel(), cas_log_write_client_ip(), cas_main(), and uc_as_info().

Here is the caller graph for this function:

void ut_get_proxy_port_name ( char *  port_name,
char *  broker_name,
int  proxy_id,
int  len 
)

Definition at line 556 of file broker_util.c.

References assert, BROKER_PATH_MAX, FID_SOCK_DIR, and get_cubrid_file().

Referenced by net_connect_proxy(), proxy_activate_internal(), and ut_kill_proxy_process().

Here is the caller graph for this function:

bool ut_is_appl_server_ready ( int  pid,
char *  ready_flag 
)

Definition at line 498 of file broker_util.c.

References FALSE, i, NULL, SERVICE_READY_WAIT_COUNT, and SLEEP_MILISEC.

Referenced by admin_restart_cmd(), as_activate(), br_activate(), and run_appl_server().

Here is the caller graph for this function:

int ut_kill_as_process ( int  pid,
char *  broker_name,
int  as_index,
int  shard_flag 
)

Definition at line 260 of file broker_util.c.

References BROKER_PATH_MAX, NULL, OFF, ut_get_as_pid_name(), ut_get_as_port_name(), and ut_kill_process().

Referenced by admin_restart_cmd(), as_inactivate(), connect_srv(), restart_appl_server(), and stop_appl_server().

Here is the caller graph for this function:

int ut_kill_broker_process ( int  pid,
char *  broker_name 
)

Definition at line 224 of file broker_util.c.

References BROKER_PATH_MAX, NULL, ut_get_broker_port_name(), and ut_kill_process().

Referenced by br_inactivate().

Here is the caller graph for this function:

int ut_kill_process ( int  pid)

Definition at line 195 of file broker_util.c.

References i, and SLEEP_MILISEC.

Referenced by ut_kill_as_process(), ut_kill_broker_process(), and ut_kill_proxy_process().

Here is the caller graph for this function:

int ut_kill_proxy_process ( int  pid,
char *  broker_name,
int  proxy_id 
)

Definition at line 242 of file broker_util.c.

References BROKER_PATH_MAX, NULL, ut_get_proxy_port_name(), and ut_kill_process().

Referenced by proxy_inactivate(), and stop_proxy_server().

Here is the caller graph for this function:

int ut_set_keepalive ( int  sock)

Definition at line 289 of file broker_util.c.

References FALSE, and NULL.

Referenced by cas_main(), and receiver_thr_f().

Here is the caller graph for this function:

double ut_size_string_to_kbyte ( const char *  size_str,
const char *  default_unit 
)

Definition at line 584 of file broker_util.c.

References assert, NULL, ONE_K, and ONE_M.

Referenced by admin_conf_change(), and broker_config_read_internal().

Here is the caller graph for this function:

int ut_time_string ( char *  buf,
struct timeval *  time_val 
)

Definition at line 421 of file broker_util.c.

References NULL, and util_get_second_and_ms_since_epoch().

Referenced by cas_log_debug(), cas_log_write_internal(), and proxy_log_write_internal().

Here is the caller graph for this function:

double ut_time_string_to_sec ( const char *  time_str,
const char *  default_unit 
)

Definition at line 643 of file broker_util.c.

References assert, NULL, ONE_HOUR, ONE_MIN, and ONE_SEC.

Referenced by admin_conf_change(), and broker_config_read_internal().

Here is the caller graph for this function:

Variable Documentation

char db_err_log_file[BROKER_PATH_MAX]

Definition at line 64 of file broker_util.c.

Referenced by as_db_err_log_set().