diff --git a/make.sh b/make.sh index 981a18f..940bf4c 100755 --- a/make.sh +++ b/make.sh @@ -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 < src/_os_define.h #ifndef _OS_DEFINE_H diff --git a/src/logger.h b/src/logger.h index 1930052..128e151 100644 --- a/src/logger.h +++ b/src/logger.h @@ -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 diff --git a/src/sockopt.c b/src/sockopt.c index 7d6b058..127c407 100644 --- a/src/sockopt.c +++ b/src/sockopt.c @@ -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