CUBRID Engine  latest
porting.c File Reference
#include "config.h"
#include <stdio.h>
#include <assert.h>
#include <errno.h>
#include <signal.h>
#include <ctype.h>
#include <time.h>
#include <unistd.h>
#include <curses.h>
#include "porting.h"
#include <stdarg.h>
#include <sys/types.h>
#include <string.h>
Include dependency graph for porting.c:

Go to the source code of this file.

Functions

char * strdup (const char *str)
 
int vasprintf (char **ptr, const char *format, va_list ap)
 
int asprintf (char **ptr, const char *format,...)
 
int cub_dirname_r (const char *path, char *pathbuf, size_t buflen)
 
char * dirname (const char *path)
 
int basename_r (const char *path, char *pathbuf, size_t buflen)
 
char * basename (const char *path)
 
char * stristr (const char *s, const char *find)
 
char * getuserid (char *string, int size)
 
int os_rename_file (const char *src_path, const char *dest_path)
 
SIGNAL_HANDLER_FUNCTION os_set_signal_handler (const int sig_no, SIGNAL_HANDLER_FUNCTION sig_handler)
 
void os_send_signal (const int sig_no)
 
INT64 timeval_diff_in_msec (const struct timeval *end_time, const struct timeval *start_time)
 
int timeval_add_msec (struct timeval *added_time, const struct timeval *start_time, int msec)
 
int timeval_to_timespec (struct timespec *to, const struct timeval *from)
 
FILE * port_open_memstream (char **ptr, size_t *sizeloc)
 
void port_close_memstream (FILE *fp, char **ptr, size_t *sizeloc)
 
char * trim (char *str)
 
int parse_int (int *ret_p, const char *str_p, int base)
 
int parse_bigint (INT64 *ret_p, const char *str_p, int base)
 
int str_to_int32 (int *ret_p, char **end_p, const char *str_p, int base)
 
int str_to_uint32 (unsigned int *ret_p, char **end_p, const char *str_p, int base)
 
int str_to_int64 (INT64 *ret_p, char **end_p, const char *str_p, int base)
 
int str_to_uint64 (UINT64 *ret_p, char **end_p, const char *str_p, int base)
 
int str_to_double (double *ret_p, char **end_p, const char *str_p)
 
int str_to_float (float *ret_p, char **end_p, const char *str_p)
 
size_t strlcpy (char *dst, const char *src, size_t siz)
 
int msleep (const long msec)
 

Function Documentation

int asprintf ( char **  ptr,
const char *  format,
  ... 
)
int basename_r ( const char *  path,
char *  pathbuf,
size_t  buflen 
)

Definition at line 1082 of file porting.c.

References PATH_CURRENT, PATH_SEPARATOR, and strlen.

Referenced by basename(), boot_get_host_name(), boot_set_server_session_key(), broker_config_read(), and clientids::set_program_name().

Here is the caller graph for this function:

int cub_dirname_r ( const char *  path,
char *  pathbuf,
size_t  buflen 
)

Definition at line 989 of file porting.c.

References PATH_CURRENT, PATH_SEPARATOR, and strlen.

Referenced by dirname(), er_file_backup(), er_file_open(), event_file_open(), fileio_lock_la_dbname(), ha_mkdir(), javasp_open_info_dir(), xboot_copy(), and xboot_initialize_server().

Here is the caller graph for this function:

char* getuserid ( char *  string,
int  size 
)

Definition at line 1271 of file porting.c.

References NULL.

Referenced by boot_initialize_client(), boot_restart_client(), css_sprintf_conn_infoids(), fileio_check_lockby_file(), fileio_lock(), fileio_lock_la_log_path(), and tran_unilaterally_abort().

Here is the caller graph for this function:

int msleep ( const long  msec)

Definition at line 2657 of file porting.c.

References assert, and error().

Referenced by db_sleep().

Here is the caller graph for this function:

int os_rename_file ( const char *  src_path,
const char *  dest_path 
)

Definition at line 1294 of file porting.c.

Referenced by es_posix_final(), fileio_rename(), fileio_unformat_and_rename(), logpb_archive_active_log(), and logpb_restore().

Here is the caller graph for this function:

void os_send_signal ( const int  sig_no)

Definition at line 1378 of file porting.c.

References assert, bool, COND_BROADCAST, cubregex::count(), FALSE, mutex, NULL, p, pthread_mutex_destroy, pthread_mutex_init, strlen, THREAD_CALLING_CONVENTION, THREAD_RET_T, and TRUE.

Referenced by signal_stop().

Here is the caller graph for this function:

int parse_bigint ( INT64 *  ret_p,
const char *  str_p,
int  base 
)

Definition at line 2318 of file porting.c.

References assert, error(), and str_to_int64().

Referenced by ldr_int_db_bigint(), ldr_int_elem(), sp_make_int_sp_value_from_string(), cubload::to_db_bigint(), cubload::to_int_generic(), and util_put_option_value().

Here is the caller graph for this function:

void port_close_memstream ( FILE *  fp,
char **  ptr,
size_t *  sizeloc 
)

Definition at line 2220 of file porting.c.

References NULL.

Referenced by do_send_plan_trace_to_session(), lock_detect_local_deadlock(), pt_plan_query(), qexec_clear_regu_variable_list(), qo_top_plan_print_text(), and session_get_trace_stats().

Here is the caller graph for this function:

FILE* port_open_memstream ( char **  ptr,
size_t *  sizeloc 
)
int str_to_double ( double *  ret_p,
char **  end_p,
const char *  str_p 
)

Definition at line 2479 of file porting.c.

References assert, and NULL.

int str_to_float ( float *  ret_p,
char **  end_p,
const char *  str_p 
)

Definition at line 2509 of file porting.c.

References assert, and NULL.

int str_to_int64 ( INT64 *  ret_p,
char **  end_p,
const char *  str_p,
int  base 
)

Definition at line 2419 of file porting.c.

References assert, LLONG_MAX, LLONG_MIN, and NULL.

Referenced by ldr_elo_ext_elem(), parse_bigint(), and cubload::to_db_elo_ext().

Here is the caller graph for this function:

int str_to_uint32 ( unsigned int *  ret_p,
char **  end_p,
const char *  str_p,
int  base 
)

Definition at line 2382 of file porting.c.

References assert, and NULL.

Referenced by load_console_conv_data(), load_unicode_data(), and string_to_int_array().

Here is the caller graph for this function:

int str_to_uint64 ( UINT64 *  ret_p,
char **  end_p,
const char *  str_p,
int  base 
)

Definition at line 2449 of file porting.c.

References assert, NULL, and ULLONG_MAX.

Referenced by sysprm_generate_new_value().

Here is the caller graph for this function:

char* strdup ( const char *  str)

Definition at line 901 of file porting.c.

References assert, strlen, and vasprintf().

Referenced by access_log_open(), add_fk_info_result(), alloc_dynamic(), applylogdb(), area_create(), au_user_name_dup(), boot_restart_server(), build_attr_change_map(), build_query_graph_function_index(), cfg_new_db(), cfg_update_db(), chksum_get_prev_checksum_results(), classobj_btid_from_property_value(), classobj_check_index_exist(), classobj_make_foreign_key_ref(), conf_file_has_been_loaded(), create_child_process(), csql(), csql_help_info(), csql_set_column_width_info(), css_init(), cub_catopen(), db_query_plan_dump_file(), db_set_preferred_hosts(), disk_get_remarks(), dl_validate_file_entry(), do_alter_index_rebuild(), do_promote_partition_by_name(), do_reclaim_class_addresses(), do_remove_partition_pre(), dumplocale(), er_dump_call_stack_to_string(), er_file_open(), event_file_open(), fh_create(), fileio_get_volume_label(), genlocale(), get_args(), hb_resource_job_proc_start(), heap_cache_class_info(), heap_get_class_info_from_record(), heap_get_class_name_alloc_if_diff(), heap_get_indexinfo_of_btid(), if(), ini_table_set(), init_default_conn_info(), init_tester_info(), installdb(), JSON_VALIDATOR::JSON_VALIDATOR(), jsp_check_stored_procedure_name(), jsp_start_server(), la_add_repl_filter(), load_console_conv_data(), load_properties(), locale_check_and_set_shared_data(), locale_compile_locale(), locator_initialize(), log_open(), log_prepare(), log_recovery_resetlog(), log_top(), main(), make_node_info(), method_initialize_vacomm_buffer(), msgcat_open(), object_to_trigger(), or_get_constraint_comment(), or_get_current_representation(), or_install_btids_class(), or_install_btids_filter_pred(), or_install_btids_foreign_key(), or_install_btids_foreign_key_ref(), or_install_btids_function_info(), pp_add_whenever_to_scope(), pp_new_cursor(), pp_new_stmt(), pp_new_structdef(), pp_new_symbol(), prm_file_has_been_loaded(), prm_set_force(), process_bind(), pt_fillin_type_size(), pt_get_attr_name(), pt_get_node_title(), pt_node_to_function_index(), qexec_execute_build_indexes(), qmgr_set_query_error(), query_info_add(), query_info_add_ne(), read_conf(), save_constraint_info_from_pt_node(), session_add_variable(), sm_save_constraint_info(), sp_create_parser(), sql_info_add(), sql_info_write(), start_include_collation(), start_one_alphabet(), start_one_collation(), stmt_exec_batch_query_internal(), stmt_exec_prepared_batch_internal(), stmt_make_error_info(), stmt_reset_session_and_parse(), sysprm_generate_new_value(), sysprm_set_sysprm_value_from_parameter(), sysprm_set_value(), sysprm_unpack_sysprm_value(), tr_create_trigger(), tr_drop_trigger(), tr_process_name(), tr_rename_trigger(), tr_set_comment(), tzc_compile_data(), tzc_compile_ds_rules(), tzc_index_raw_subdata(), uc_change_config(), update_locksets_for_multiple_rename(), util_make_ha_conf(), util_put_option_value(), util_split_string(), util_str_to_time_since_epoch(), xlocator_reserve_class_name(), xlogtb_get_pack_tran_table(), and xstrdup().

char* stristr ( const char *  s,
const char *  find 
)

Definition at line 1242 of file porting.c.

References NULL, and strlen.

Referenced by pt_get_hint().

Here is the caller graph for this function:

size_t strlcpy ( char *  dst,
const char *  src,
size_t  siz 
)

Definition at line 2584 of file porting.c.

References assert.

Referenced by boot_restart_server(), cub_catopen(), envvar_expand(), es_posix_init(), xtx_add_lob_locator(), and xtx_change_state_of_locator().

Here is the caller graph for this function:

int timeval_add_msec ( struct timeval *  added_time,
const struct timeval *  start_time,
int  msec 
)

Definition at line 2152 of file porting.c.

Referenced by dwb_wait_for_block_completion(), dwb_wait_for_strucure_modification(), logpb_flush_pages(), and pgbuf_flush_chkpt_seq_list().

Here is the caller graph for this function:

INT64 timeval_diff_in_msec ( const struct timeval *  end_time,
const struct timeval *  start_time 
)

Definition at line 2133 of file porting.c.

Referenced by pgbuf_flush_seq_list().

Here is the caller graph for this function:

int timeval_to_timespec ( struct timespec *  to,
const struct timeval *  from 
)

Definition at line 2173 of file porting.c.

References assert.

Referenced by dwb_wait_for_block_completion(), dwb_wait_for_strucure_modification(), and logpb_flush_pages().

Here is the caller graph for this function:

int vasprintf ( char **  ptr,
const char *  format,
va_list  ap 
)

Definition at line 936 of file porting.c.

References cubregex::count(), and NULL.

Referenced by asprintf(), pt_frob_error(), pt_frob_warning(), and strdup().

Here is the caller graph for this function: