add function log_try_init2

posix_api
YuQing 2022-02-14 09:41:21 +08:00
parent e9d186ce99
commit 3331b927b3
3 changed files with 25 additions and 3 deletions

View File

@ -153,10 +153,10 @@ gcc -o a.out $tmp_src_filename 2>/dev/null && ./a.out
}
tmp_filename=fast_dirent_macros.txt
check_dirent_field d_namlen > $tmp_filename
check_dirent_field d_type > $tmp_filename
check_dirent_field d_reclen >> $tmp_filename
check_dirent_field d_namlen >> $tmp_filename
check_dirent_field d_off >> $tmp_filename
check_dirent_field d_type >> $tmp_filename
cat <<EOF > src/_os_define.h
#ifndef _OS_DEFINE_H

View File

@ -145,6 +145,7 @@ static inline int log_try_init()
*/
int log_init2();
#define log_reopen() log_reopen_ex(&g_log_context)
#define log_set_prefix(base_path, filename_prefix) \
@ -273,6 +274,24 @@ void log_take_over_stderr_ex(LogContext *pContext);
*/
void log_take_over_stdout_ex(LogContext *pContext);
/** init function using global log context
* do nothing when already inited
* return: 0 for success, != 0 fail
*/
static inline int log_try_init2()
{
int result;
if ((result=log_try_init()) != 0)
{
return result;
}
log_take_over_stderr();
log_take_over_stdout();
return 0;
}
/** set compress_log_flags to true
* parameters:
* pContext: the log context

View File

@ -33,8 +33,11 @@
#define SUB_NET_TYPE_INNER_172_STR3 "inner172"
#define SUB_NET_TYPE_INNER_192_STR3 "inner192"
#if defined(IOV_MAX) && IOV_MAX > 256
#define FC_IOV_BATCH_SIZE 256
#else
#define FC_IOV_BATCH_SIZE IOV_MAX
#endif
#if defined(OS_LINUX) || defined(OS_FREEBSD)
#include <ifaddrs.h>