Skip to content

File util_func.c

FileList > base > util_func.c

Go to the source code of this file

  • #include "config.h"
  • #include <stdio.h>
  • #include <string.h>
  • #include <signal.h>
  • #include <assert.h>
  • #include <chrono>
  • #include <time.h>
  • #include <stdarg.h>
  • #include <sys/timeb.h>
  • #include <sys/time.h>
  • #include "util_func.h"
  • #include "porting.h"
  • #include "error_code.h"
  • #include "utility.h"
  • #include "system_parameter.h"
  • #include "environment_variable.h"
  • #include "memory_wrapper.hpp"

Public Static Attributes

Type Name
SIG_HANDLER user_interrupt_handler = [**NULL**](freelistheap_8h.md#define-null)
SIG_HANDLER user_quit_handler = [**NULL**](freelistheap_8h.md#define-null)
char util_Log_buffer
char * util_Log_filename = [**NULL**](freelistheap_8h.md#define-null)
char util_Log_filename_buf

Public Functions

Type Name
unsigned int hashpjw (const char * s)
void util_arm_signal_handlers (SIG_HANDLER sigint_handler, SIG_HANDLER sigquit_handler)
int util_bsearch (const void * key, const void * base, int n_elems, unsigned int sizeof_elem, int(*)(const void *, const void *) func_compare, bool * out_found)
int util_compare_filepath (const char * file1, const char * file2)
void util_disarm_signal_handlers (void)
void util_free_string_array (char ** array)
void util_get_second_and_ms_since_epoch (time_t * secs, int * msec)
void util_get_seconds_and_rest_since_epoch (std::chrono::seconds & secs, Duration & rest)
int util_log_write_command (int argc, char * argv, int util_name_pos)
int util_log_write_errid (int message_id, ...)
int util_log_write_errstr (const char * format, ...)
int util_log_write_result (int error)
int util_log_write_warnstr (const char * format, ...)
void util_shuffle_string_array (char ** array, int count)
char ** util_split_string (const char * str, const char * delim)
time_t util_str_to_time_since_epoch (char * str)

Public Static Functions

Type Name
FILE * fopen_and_lock (const char * path)
void system_interrupt_handler (int sig)
void system_quit_handler (int sig)
void util_get_seconds_and_rest_since_epoch (std::chrono::seconds & secs, Duration & rest)
FILE * util_log_file_backup (FILE * fp, const char * path)
FILE * util_log_file_fopen (const char * path)
int util_log_header (char * buf, size_t buf_len)
int util_log_write_internal (const char * msg, const char * prefix_str)

Macros

Type Name
define MAX_RETRY_COUNT 10
define UTIL_LOG_BUFFER_SIZE ([**UTIL\_LOG\_MAX\_MSG\_SIZE**](util__func_8c.md#define-util_log_max_msg_size) + [**UTIL\_LOG\_MAX\_HEADER\_LEN**](util__func_8c.md#define-util_log_max_header_len))
define UTIL_LOG_FILENAME "cubrid\_utility.log"
define UTIL_LOG_MAX_HEADER_LEN (40)
define UTIL_LOG_MAX_MSG_SIZE (1024)

Public Static Attributes Documentation

variable user_interrupt_handler

SIG_HANDLER user_interrupt_handler;

variable user_quit_handler

SIG_HANDLER user_quit_handler;

variable util_Log_buffer

char util_Log_buffer[((1024)+(40))];

variable util_Log_filename

char* util_Log_filename;

variable util_Log_filename_buf

char util_Log_filename_buf[PATH_MAX];

Public Functions Documentation

function hashpjw

unsigned  int hashpjw (
    const  char * s
) 

function util_arm_signal_handlers

void util_arm_signal_handlers (
    SIG_HANDLER sigint_handler,
    SIG_HANDLER sigquit_handler
) 

function util_bsearch

int util_bsearch (
    const  void * key,
    const  void * base,
    int n_elems,
    unsigned  int sizeof_elem,
    int (*)( const  void *, const  void *) func_compare,
    bool * out_found
) 

function util_compare_filepath

int util_compare_filepath (
    const  char * file1,
    const  char * file2
) 

function util_disarm_signal_handlers

void util_disarm_signal_handlers (
    void
) 

function util_free_string_array

void util_free_string_array (
    char ** array
) 

function util_get_second_and_ms_since_epoch

void util_get_second_and_ms_since_epoch (
    time_t * secs,
    int * msec
) 

function util_get_seconds_and_rest_since_epoch

template<typename  Duration>
void util_get_seconds_and_rest_since_epoch (
    std::chrono::seconds & secs,
    Duration & rest
) 

function util_log_write_command

int util_log_write_command (
    int argc,
    char * argv,
    int util_name_pos
) 

function util_log_write_errid

int util_log_write_errid (
    int message_id,
    ...
) 

function util_log_write_errstr

int util_log_write_errstr (
    const  char * format,
    ...
) 

function util_log_write_result

int util_log_write_result (
    int error
) 

function util_log_write_warnstr

int util_log_write_warnstr (
    const  char * format,
    ...
) 

function util_shuffle_string_array

void util_shuffle_string_array (
    char ** array,
    int count
) 

function util_split_string

char ** util_split_string (
    const  char * str,
    const  char * delim
) 

function util_str_to_time_since_epoch

time_t util_str_to_time_since_epoch (
    char * str
) 

Public Static Functions Documentation

function fopen_and_lock

static FILE * fopen_and_lock (
    const  char * path
) 

function system_interrupt_handler

static void system_interrupt_handler (
    int sig
) 

function system_quit_handler

static void system_quit_handler (
    int sig
) 

function util_get_seconds_and_rest_since_epoch

template<typename  Duration>
static void util_get_seconds_and_rest_since_epoch (
    std::chrono::seconds & secs,
    Duration & rest
) 

function util_log_file_backup

static FILE * util_log_file_backup (
    FILE * fp,
    const  char * path
) 

function util_log_file_fopen

static FILE * util_log_file_fopen (
    const  char * path
) 

function util_log_header

static int util_log_header (
    char * buf,
    size_t buf_len
) 

function util_log_write_internal

static int util_log_write_internal (
    const  char * msg,
    const  char * prefix_str
) 

Macro Definition Documentation

define MAX_RETRY_COUNT

#define MAX_RETRY_COUNT `10`

define UTIL_LOG_BUFFER_SIZE

#define UTIL_LOG_BUFFER_SIZE `( UTIL_LOG_MAX_MSG_SIZE + UTIL_LOG_MAX_HEADER_LEN )`

define UTIL_LOG_FILENAME

#define UTIL_LOG_FILENAME `"cubrid_utility.log"`

define UTIL_LOG_MAX_HEADER_LEN

#define UTIL_LOG_MAX_HEADER_LEN `(40)`

define UTIL_LOG_MAX_MSG_SIZE

#define UTIL_LOG_MAX_MSG_SIZE `(1024)`


The documentation for this class was generated from the following file cubrid/src/base/util_func.c