mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 09:41:54 +00:00
Merge commit 'd776540811cdf672dc113f29feef2415465589c6' into integrated
This commit is contained in:
commit
9dd29a1337
@ -54,7 +54,8 @@ fi
|
||||
AC_SUBST(CONFIG_FILE)
|
||||
AC_SUBST(CONTROL_SOCKET)
|
||||
|
||||
AC_SEARCH_LIBS(clock_gettime,[c rt posix4])
|
||||
AC_SEARCH_LIBS(clock_gettime, [c rt posix4], ,
|
||||
AC_MSG_ERROR([[Function clock_gettime not available.]]))
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
@ -240,8 +241,9 @@ if test "$enable_client" = yes ; then
|
||||
AC_CHECK_LIB(ncurses, tgetent, USE_TERMCAP_LIB=-lncurses,
|
||||
AC_CHECK_LIB(curses, tgetent, USE_TERMCAP_LIB=-lcurses,
|
||||
AC_CHECK_LIB(tinfow, tgetent, USE_TERMCAP_LIB=-ltinfow,
|
||||
AC_CHECK_LIB(tinfo, tgetent, USE_TERMCAP_LIB=-ltinfo
|
||||
AC_CHECK_LIB(termcap, tgetent, USE_TERMCAP_LIB=-ltermcap)))))
|
||||
AC_CHECK_LIB(tinfo, tgetent, USE_TERMCAP_LIB=-ltinfo,
|
||||
AC_CHECK_LIB(termcap, tgetent, USE_TERMCAP_LIB=-ltermcap,
|
||||
AC_MSG_ERROR([[The client requires ncurses library. Either install the library or use --disable-client to compile without the client.]]))))))
|
||||
AC_CHECK_LIB(readline, rl_callback_read_char, CLIENT_LIBS="-lreadline $CLIENT_LIBS $USE_TERMCAP_LIB",
|
||||
AC_MSG_ERROR([[The client requires GNU readline library 2.1 or newer. Either install the library or use --disable-client to compile without the client.]]), $USE_TERMCAP_LIB)
|
||||
AC_CHECK_LIB(readline, rl_crlf, AC_DEFINE(HAVE_RL_CRLF),,$USE_TERMCAP_LIB)
|
||||
|
@ -39,14 +39,21 @@ static const int rate_limit_count = 5;
|
||||
#ifdef USE_PTHREADS
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
static pthread_mutex_t log_mutex;
|
||||
static inline void log_lock(void) { pthread_mutex_lock(&log_mutex); }
|
||||
static inline void log_unlock(void) { pthread_mutex_unlock(&log_mutex); }
|
||||
|
||||
static pthread_t main_thread;
|
||||
void main_thread_init(void) { main_thread = pthread_self(); }
|
||||
static int main_thread_self(void) { return pthread_equal(pthread_self(), main_thread); }
|
||||
|
||||
#else
|
||||
|
||||
static inline void log_lock(void) { }
|
||||
static inline void log_unlock(void) { }
|
||||
void main_thread_init(void) { }
|
||||
static int main_thread_self(void) { return 1; }
|
||||
|
||||
#endif
|
||||
|
||||
@ -128,8 +135,9 @@ log_commit(int class, buffer *buf)
|
||||
}
|
||||
log_unlock();
|
||||
|
||||
/* FIXME: cli_echo is not thread-safe */
|
||||
cli_echo(class, buf->start);
|
||||
/* cli_echo is not thread-safe, so call it just from the main thread */
|
||||
if (main_thread_self())
|
||||
cli_echo(class, buf->start);
|
||||
|
||||
buf->pos = buf->start;
|
||||
}
|
||||
|
@ -797,6 +797,8 @@ main(int argc, char **argv)
|
||||
dup2(0, 2);
|
||||
}
|
||||
|
||||
main_thread_init();
|
||||
|
||||
write_pid_file();
|
||||
|
||||
signal_init();
|
||||
|
@ -60,6 +60,7 @@ void krt_io_init(void);
|
||||
|
||||
/* log.c */
|
||||
|
||||
void main_thread_init(void);
|
||||
void log_init_debug(char *); /* Initialize debug dump to given file (NULL=stderr, ""=off) */
|
||||
void log_switch(int debug, list *l, char *); /* Use l=NULL for initial switch */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user