CUBRID Engine  latest
broker_util.h File Reference
#include <time.h>
#include "cas_common.h"
#include "porting.h"
Include dependency graph for broker_util.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PROXY_INVALID_ID   (-1)
 
#define PROXY_INVALID_SHARD   (PROXY_INVALID_ID)
 
#define PROXY_INVALID_CAS   (PROXY_INVALID_ID)
 
#define SHARD_INVALID_ID   (PROXY_INVALID_SHARD)
 
#define CAS_INVALID_ID   (PROXY_INVALID_CAS)
 
#define SERVICE_READY_WAIT_COUNT   6000
 
#define MAKE_FILEPATH(dest, src, dest_len)
 

Functions

int ut_kill_process (int pid)
 
int ut_kill_broker_process (int pid, char *br_name)
 
int ut_kill_proxy_process (int pid, char *br_name, int proxy_id)
 
int ut_kill_as_process (int pid, char *br_name, int as_id, int shard_flag)
 
void ut_cd_work_dir (void)
 
void ut_cd_root_dir (void)
 
int ut_set_keepalive (int sock)
 
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)
 
void ut_get_as_pid_name (char *pid_name, char *br_name, int as_index, int len)
 
int ut_time_string (char *buf, struct timeval *log_time)
 
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)
 

Macro Definition Documentation

#define CAS_INVALID_ID   (PROXY_INVALID_CAS)

Definition at line 45 of file broker_util.h.

#define MAKE_FILEPATH (   dest,
  src,
  dest_len 
)
Value:
do { \
char _buf[BROKER_PATH_MAX]; \
if ((src) == NULL || (src)[0] == 0) { \
(dest)[0] = 0; \
} else if (realpath ((src), _buf) != NULL) { \
strncpy ((dest), _buf, (dest_len)); \
(dest)[(dest_len) - 1] = 0; \
} else { \
strncpy ((dest), (src), (dest_len)); \
(dest)[(dest_len) - 1] = 0; \
} \
} while (0)
#define BROKER_PATH_MAX
Definition: broker_config.h:91
#define NULL
Definition: freelistheap.h:34
if(extra_options)
Definition: dynamic_load.c:958

Definition at line 49 of file broker_util.h.

Referenced by access_control_repath_file(), admin_conf_change(), and broker_config_read_internal().

#define PROXY_INVALID_ID   (-1)
#define SERVICE_READY_WAIT_COUNT   6000

Definition at line 47 of file broker_util.h.

Referenced by check_shard_as_conn(), and ut_is_appl_server_ready().

#define SHARD_INVALID_ID   (PROXY_INVALID_SHARD)

Definition at line 44 of file broker_util.h.

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 *  br_name,
int  as_id,
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 *  br_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 *  br_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 *  log_time 
)

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: