From 191c51187ee54201954e5c73492a8bd5902044c7 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 16 Jul 2009 12:55:22 +0200 Subject: calls to prctl() need to be based on configure results (cross-platform issue) --- configure.ac | 4 ++-- runtime/wtp.c | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 6d22566b..2fa496c7 100644 --- a/configure.ac +++ b/configure.ac @@ -63,7 +63,7 @@ AC_SUBST(DL_LIBS) AC_HEADER_RESOLV AC_HEADER_STDC AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS([arpa/inet.h libgen.h fcntl.h locale.h netdb.h netinet/in.h paths.h stddef.h stdlib.h string.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h sys/stat.h syslog.h unistd.h utmp.h sys/epoll.h]) +AC_CHECK_HEADERS([arpa/inet.h libgen.h fcntl.h locale.h netdb.h netinet/in.h paths.h stddef.h stdlib.h string.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h sys/stat.h syslog.h unistd.h utmp.h sys/epoll.h sys/prctl.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST @@ -98,7 +98,7 @@ AC_TYPE_SIGNAL AC_FUNC_STAT AC_FUNC_STRERROR_R AC_FUNC_VPRINTF -AC_CHECK_FUNCS([flock basename alarm clock_gettime gethostbyname gethostname gettimeofday localtime_r memset mkdir regcomp select setid socket strcasecmp strchr strdup strerror strndup strnlen strrchr strstr strtol strtoul uname ttyname_r epoll_wait getline malloc_trim]) +AC_CHECK_FUNCS([flock basename alarm clock_gettime gethostbyname gethostname gettimeofday localtime_r memset mkdir regcomp select setid socket strcasecmp strchr strdup strerror strndup strnlen strrchr strstr strtol strtoul uname ttyname_r epoll_wait getline malloc_trim prctl]) # Check for MAXHOSTNAMELEN AC_MSG_CHECKING(for MAXHOSTNAMELEN) diff --git a/runtime/wtp.c b/runtime/wtp.c index 02662cde..87c3b324 100644 --- a/runtime/wtp.c +++ b/runtime/wtp.c @@ -40,11 +40,12 @@ #include #include #include -#include +#if HAVE_SYS_PRCTL_H +# include +#endif #ifdef OS_SOLARIS # include -# define pthread_yield() sched_yield() #endif #include "rsyslog.h" @@ -434,10 +435,12 @@ wtpWorker(void *arg) /* the arg is actually a wti object, even though we are in sigfillset(&sigSet); pthread_sigmask(SIG_BLOCK, &sigSet, NULL); +# if HAVE_PRCTL && defined PR_SET_NAME /* set thread name - we ignore if the call fails, has no harsh consequences... */ if(prctl(PR_SET_NAME, wtpGetDbgHdr(pThis), 0, 0, 0) != 0) { DBGPRINTF("prctl failed, not setting thread name for '%s'\n", wtpGetDbgHdr(pThis)); } +# endif BEGIN_MTX_PROTECTED_OPERATIONS(&pThis->mut, LOCK_MUTEX); -- cgit From 1d0806b9e3c6e83443c8daa9da8f25bd4df75f9b Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 16 Jul 2009 13:51:52 +0200 Subject: calls to prctl() need to be based on configure results (cross-platform issue) This is for another prctl() call, not present in the beta version (looks like it would make sense to stick these into a utility function) --- runtime/stream.c | 7 +++++-- runtime/wti.c | 1 - 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/runtime/stream.c b/runtime/stream.c index a0571a61..605a9771 100644 --- a/runtime/stream.c +++ b/runtime/stream.c @@ -48,7 +48,9 @@ #include "stream.h" #include "unicode-helper.h" #include "module-template.h" -#include +#if HAVE_SYS_PRCTL_H +# include +#endif #define inline @@ -891,9 +893,11 @@ asyncWriterThread(void *pPtr) ISOBJ_TYPE_assert(pThis, strm); BEGINfunc +# if HAVE_PRCTL && defined PR_SET_NAME if(prctl(PR_SET_NAME, "rs:asyn strmwr", 0, 0, 0) != 0) { DBGPRINTF("prctl failed, not setting thread name for '%s'\n", "stream writer"); } +#endif while(1) { /* loop broken inside */ d_pthread_mutex_lock(&pThis->mut); @@ -904,7 +908,6 @@ asyncWriterThread(void *pPtr) goto finalize_it; /* break main loop */ } if(bTimedOut && pThis->iBufPtr > 0) { -RUNLOG_STR("XXX: we had a timeout in stream writer"); /* if we timed out, we need to flush pending data */ strmFlush(pThis); bTimedOut = 0; diff --git a/runtime/wti.c b/runtime/wti.c index 156d8116..abdf4add 100644 --- a/runtime/wti.c +++ b/runtime/wti.c @@ -41,7 +41,6 @@ #ifdef OS_SOLARIS # include -# define pthread_yield() sched_yield() #endif #include "rsyslog.h" -- cgit