adapt to FreeBSD 13
parent
7f699688c0
commit
fef0a4a7f3
3
HISTORY
3
HISTORY
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
Version 1.74 2024-04-08
|
||||
Version 1.74 2024-05-18
|
||||
* add functions: get_log_level and get_log_level_caption
|
||||
* adapt to FreeBSD 13
|
||||
|
||||
Version 1.73 2024-03-05
|
||||
* add macro FC_SET_STRING_EMPTY
|
||||
|
|
|
|||
5
make.sh
5
make.sh
|
|
@ -99,6 +99,7 @@ else
|
|||
CFLAGS="$CFLAGS -g -O3"
|
||||
fi
|
||||
|
||||
INCS=''
|
||||
LIBS='-lm -ldl'
|
||||
if [ -f /usr/include/curl/curl.h ] || [ -f /usr/local/include/curl/curl.h ]; then
|
||||
CFLAGS="$CFLAGS -DUSE_LIBCURL"
|
||||
|
|
@ -121,6 +122,9 @@ elif [ "$uname" = "FreeBSD" ] || [ "$uname" = "Darwin" ]; then
|
|||
if [ "$uname" = "Darwin" ]; then
|
||||
CFLAGS="$CFLAGS -DDARWIN"
|
||||
TARGET_PREFIX=$TARGET_PREFIX/local
|
||||
else
|
||||
INCS="$INCS -I/usr/local/include"
|
||||
LIBS="$LIBS -L/usr/local/lib"
|
||||
fi
|
||||
|
||||
if [ -f /usr/include/sys/vmmeter.h ]; then
|
||||
|
|
@ -247,6 +251,7 @@ sed_replace()
|
|||
cd src
|
||||
cp Makefile.in Makefile
|
||||
sed_replace "s#\\\$(CFLAGS)#$CFLAGS#g" Makefile
|
||||
sed_replace "s#\\\$(INCS)#$INCS#g" Makefile
|
||||
sed_replace "s#\\\$(LIBS)#$LIBS#g" Makefile
|
||||
sed_replace "s#\\\$(TARGET_PREFIX)#$TARGET_PREFIX#g" Makefile
|
||||
sed_replace "s#\\\$(LIB_VERSION)#$LIB_VERSION#g" Makefile
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
.SUFFIXES: .c .o .lo
|
||||
|
||||
COMPILE = $(CC) $(CFLAGS)
|
||||
INC_PATH =
|
||||
INC_PATH = $(INCS)
|
||||
LIB_PATH = $(LIBS)
|
||||
TARGET_LIB = $(TARGET_PREFIX)/$(LIB_VERSION)
|
||||
|
||||
|
|
|
|||
|
|
@ -203,10 +203,12 @@ extern int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int kind);
|
|||
#define st_ctimensec st_ctim.tv_nsec
|
||||
#endif
|
||||
#elif defined(OS_FREEBSD)
|
||||
#ifndef st_atimensec
|
||||
#define st_atimensec st_atimespec.tv_nsec
|
||||
#define st_mtimensec st_mtimespec.tv_nsec
|
||||
#define st_ctimensec st_ctimespec.tv_nsec
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
|||
|
|
@ -102,7 +102,9 @@ int ioevent_loop(struct nio_thread_data *thread_data,
|
|||
time_t last_check_time;
|
||||
int save_extra_events;
|
||||
int count;
|
||||
#ifdef OS_LINUX
|
||||
uint32_t sched_counter;
|
||||
#endif
|
||||
bool sched_pull;
|
||||
|
||||
memset(&ev_notify, 0, sizeof(ev_notify));
|
||||
|
|
@ -123,7 +125,10 @@ int ioevent_loop(struct nio_thread_data *thread_data,
|
|||
}
|
||||
thread_data->ev_puller.extra_events = save_extra_events; //restore
|
||||
|
||||
#ifdef OS_LINUX
|
||||
sched_counter = 0;
|
||||
#endif
|
||||
|
||||
thread_data->deleted_list = NULL;
|
||||
last_check_time = g_current_time;
|
||||
while (*continue_flag)
|
||||
|
|
|
|||
|
|
@ -2911,8 +2911,16 @@ int parseAddress(char *src, char *parts[2])
|
|||
|
||||
int64_t get_current_time_ns()
|
||||
{
|
||||
#ifdef CLOCK_MONOTONIC_RAW
|
||||
#define MY_NS_CLK_ID CLOCK_MONOTONIC_RAW
|
||||
#elif defined(CLOCK_MONOTONIC_PRECISE)
|
||||
#define MY_NS_CLK_ID CLOCK_MONOTONIC_PRECISE
|
||||
#else
|
||||
#define MY_NS_CLK_ID CLOCK_MONOTONIC
|
||||
#endif
|
||||
|
||||
struct timespec ts;
|
||||
if (clock_gettime(CLOCK_MONOTONIC_RAW, &ts) != 0)
|
||||
if (clock_gettime(MY_NS_CLK_ID, &ts) != 0)
|
||||
{
|
||||
logError("file: "__FILE__", line: %d, "
|
||||
"call clock_gettime fail, "
|
||||
|
|
|
|||
|
|
@ -2849,9 +2849,13 @@ bool tcp_socket_connected(int sock)
|
|||
struct tcp_info info;
|
||||
#else
|
||||
#include <netinet/tcp_fsm.h>
|
||||
#define TCP_INFO TCP_CONNECTION_INFO
|
||||
#define TCP_ESTABLISHED TCPS_ESTABLISHED
|
||||
#ifndef TCP_INFO
|
||||
#define TCP_INFO TCP_CONNECTION_INFO
|
||||
struct tcp_connection_info info;
|
||||
#else
|
||||
struct tcp_info info;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
len = sizeof(info);
|
||||
|
|
|
|||
|
|
@ -72,7 +72,8 @@ int get_sys_total_mem_size(int64_t *mem_size)
|
|||
size_t len;
|
||||
|
||||
mib[0] = CTL_HW;
|
||||
mib[1] = HW_MEMSIZE;
|
||||
//mib[1] = HW_MEMSIZE;
|
||||
mib[1] = HW_PHYSMEM;
|
||||
len = sizeof(*mem_size);
|
||||
if (sysctl(mib, 2, mem_size, &len, NULL, 0) != 0)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue