From: Igor Pashev pashev.igor@gmail.com
--- lib/log_format.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/lib/log_format.c b/lib/log_format.c index 6071a30..0cbb543 100644 --- a/lib/log_format.c +++ b/lib/log_format.c @@ -51,10 +51,14 @@ static struct syslog_names prioritynames[] = {
struct syslog_names facilitynames[] = { {"auth", LOG_AUTH}, +#if defined(LOG_AUTHPRIV) {"authpriv", LOG_AUTHPRIV}, +#endif {"cron", LOG_CRON}, {"daemon", LOG_DAEMON}, +#if defined(LOG_FTP) {"ftp", LOG_FTP}, +#endif {"kern", LOG_KERN}, {"lpr", LOG_LPR}, {"mail", LOG_MAIL},
From: Igor Pashev pashev.igor@gmail.com
--- lib/ipc_us.c | 8 -------- 1 file changed, 8 deletions(-)
diff --git a/lib/ipc_us.c b/lib/ipc_us.c index 2db87ec..06aa086 100644 --- a/lib/ipc_us.c +++ b/lib/ipc_us.c @@ -327,11 +327,7 @@ qb_ipcc_us_sock_connect(const char *socket_name, int32_t * sock_pt) struct sockaddr_un address; int32_t res = 0;
-#if defined(QB_SOLARIS) request_fd = socket(PF_UNIX, SOCK_STREAM, 0); -#else - request_fd = socket(PF_LOCAL, SOCK_STREAM, 0); -#endif if (request_fd == -1) { return -errno; } @@ -501,11 +497,7 @@ qb_ipcs_us_publish(struct qb_ipcs_service * s) /* * Create socket for IPC clients, name socket, listen for connections */ -#if defined(QB_SOLARIS) s->server_sock = socket(PF_UNIX, SOCK_STREAM, 0); -#else - s->server_sock = socket(PF_LOCAL, SOCK_STREAM, 0); -#endif if (s->server_sock == -1) { res = -errno; qb_util_perror(LOG_ERR, "Cannot create server socket");
A bit reworked but originally from Igor Pashev: https://github.com/ip1981/libqb/commit/84c47f8160a9a78f068cc5b0d40b3901c065c...
Note: __EXTENSIONS__ also defines _GNU_SOURCE, so removing it as well.
Signed-off-by: Angus Salkeld asalkeld@redhat.com --- configure.ac | 10 ++++++++++ include/os_base.h | 4 ---- lib/ipc_us.c | 15 ++++++++++----- 3 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/configure.ac b/configure.ac index fda5ea4..6e3e8dc 100644 --- a/configure.ac +++ b/configure.ac @@ -8,6 +8,8 @@ AC_INIT([libqb], [quarterback-devel@fedorahosted.org]) AC_CONFIG_SRCDIR([lib/ringbuffer.c]) AC_CONFIG_HEADERS([include/config.h include/qb/qbconfig.h]) +AC_USE_SYSTEM_EXTENSIONS + AM_INIT_AUTOMAKE([-Wno-portability dist-xz color-tests parallel-tests]) dnl automake >= 1.11 offers --enable-silent-rules for suppressing the output from dnl normal compilation. When a failure occurs, it will then display the full @@ -18,6 +20,7 @@ LT_PREREQ([2.2.6]) LT_INIT
AC_CONFIG_MACRO_DIR([m4]) + AC_CANONICAL_HOST AC_PROG_LIBTOOL AC_LANG([C]) @@ -136,6 +139,13 @@ AC_TYPE_UINT32_T AC_TYPE_UINT64_T AC_TYPE_UINT8_T
+AC_CHECK_MEMBER([struct sockaddr_un.sun_len], + [AC_DEFINE([HAVE_STRUCT_SOCKADDR_UN_SUN_LEN], + 1, + [Define to 1 if struct sockaddr_un has a member sun_len])], + [], + [#include <sys/un.h>]) + # Checks for library functions. AC_FUNC_CHOWN AC_FUNC_FORK diff --git a/include/os_base.h b/include/os_base.h index 4dd0555..63ac8d6 100644 --- a/include/os_base.h +++ b/include/os_base.h @@ -25,10 +25,6 @@ #include <config.h> #endif /* HAVE_CONFIG_H */
-#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif /* _GNU_SOURCE */ - #include <stdio.h> #include <stdarg.h> #include <limits.h> diff --git a/lib/ipc_us.c b/lib/ipc_us.c index 06aa086..82b5f43 100644 --- a/lib/ipc_us.c +++ b/lib/ipc_us.c @@ -48,10 +48,15 @@ #define UNIX_PATH_MAX 108 #endif /* UNIX_PATH_MAX */
-#if defined(QB_LINUX) || defined(QB_SOLARIS) -#define QB_SUN_LEN(a) sizeof(*(a)) +/* + * SUN_LEN() does a strlen() on sun_path, but if you are trying to use the + * "Linux abstract namespace" (you have to set sun_path[0] == '\0') then + * the strlen() doesn't work. + */ +#if defined(SUN_LEN) +#define QB_SUN_LEN(a) ((a)->sun_path[0] == '\0') ? sizeof(*(a)) : SUN_LEN(a) #else -#define QB_SUN_LEN(a) SUN_LEN(a) +#define QB_SUN_LEN(a) sizeof(*(a)) #endif
struct ipc_us_control { @@ -341,8 +346,8 @@ qb_ipcc_us_sock_connect(const char *socket_name, int32_t * sock_pt)
memset(&address, 0, sizeof(struct sockaddr_un)); address.sun_family = AF_UNIX; -#if defined(QB_BSD) || defined(QB_DARWIN) - address.sun_len = SUN_LEN(&address); +#ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN + address.sun_len = QB_SUN_LEN(&address); #endif
#if defined(QB_LINUX)
Signed-off-by: Angus Salkeld asalkeld@redhat.com --- include/tlist.h | 2 +- lib/util.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/tlist.h b/include/tlist.h index e9d25c2..18b6f6e 100644 --- a/include/tlist.h +++ b/include/tlist.h @@ -32,7 +32,7 @@ typedef void *timer_handle; #define TIMER_HANDLE #endif
-static int64_t timerlist_hertz = HZ; +static int64_t timerlist_hertz;
struct timerlist { struct qb_list_head timer_head; diff --git a/lib/util.c b/lib/util.c index a044368..ef5ba25 100644 --- a/lib/util.c +++ b/lib/util.c @@ -197,7 +197,7 @@ qb_util_nano_current_get(void) uint64_t qb_util_nano_monotonic_hz(void) { - return HZ; + return sysconf(_SC_CLK_TCK); }
void
Thanks again to Igor Pashev.
Signed-off-by: Angus Salkeld asalkeld@redhat.com --- configure.ac | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac index 6e3e8dc..ace78b4 100644 --- a/configure.ac +++ b/configure.ac @@ -6,6 +6,7 @@ AC_PREREQ([2.61]) AC_INIT([libqb], m4_esyscmd([build-aux/git-version-gen .tarball-version]), [quarterback-devel@fedorahosted.org]) +AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_SRCDIR([lib/ringbuffer.c]) AC_CONFIG_HEADERS([include/config.h include/qb/qbconfig.h]) AC_USE_SYSTEM_EXTENSIONS @@ -97,10 +98,15 @@ case $exec_prefix in esac
# Checks for libraries. -AC_CHECK_LIB([rt], [mq_open]) -AC_CHECK_LIB([dl], [dlopen]) -AC_CHECK_LIB([pthread], [pthread_create]) -AC_CHECK_LIB([socket], [socket]) +dnl librt from glibc NEEDs libpthread +dnl so. if test for libpthread after librt +dnl it will always be "none needed", but it is not true +dnl when linking libraries. Looks like a bug. +AC_SEARCH_LIBS([pthread_create], [pthread]) +AC_SEARCH_LIBS([mq_open], [rt]) +AC_SEARCH_LIBS([dlopen], [dl]) +AC_SEARCH_LIBS([socket], [socket]) +AC_SEARCH_LIBS([gethostbyname], [nsl])
# look for testing harness "check" PKG_CHECK_MODULES([CHECK], [check >= 0.9.4],[with_check=yes],[with_check=no])
Signed-off-by: Angus Salkeld asalkeld@redhat.com --- .gitignore | 15 +-------------- build-aux/.gitignore | 7 +++++++ include/.gitignore | 5 +++++ lib/.gitignore | 1 + 4 files changed, 14 insertions(+), 14 deletions(-) create mode 100644 build-aux/.gitignore create mode 100644 include/.gitignore create mode 100644 lib/.gitignore
diff --git a/.gitignore b/.gitignore index 8bed236..2d42454 100644 --- a/.gitignore +++ b/.gitignore @@ -10,30 +10,17 @@ *.log Makefile Makefile.in -include/config.* -include/qb/qbconfig.h -include/stamp-h1 aclocal.m4 autom4te.cache/ -config.guess -config.log config.status -config.sub configure -depcomp -install-sh -missing .libs m4 libtool -compile -ltmain.sh -libqb-* -lib/run_splint.sh .version .tarball-version libqb.spec -include/qb/stamp-h2 +libqb-* cov compat_reports abi_dumps \ No newline at end of file diff --git a/build-aux/.gitignore b/build-aux/.gitignore new file mode 100644 index 0000000..22646bc --- /dev/null +++ b/build-aux/.gitignore @@ -0,0 +1,7 @@ +compile +config.guess +config.sub +depcomp +install-sh +ltmain.sh +missing diff --git a/include/.gitignore b/include/.gitignore new file mode 100644 index 0000000..8c67c55 --- /dev/null +++ b/include/.gitignore @@ -0,0 +1,5 @@ +config.h +config.h.in +qb/qbconfig.h +qb/stamp-h2 +stamp-h1 diff --git a/lib/.gitignore b/lib/.gitignore new file mode 100644 index 0000000..bf12fd7 --- /dev/null +++ b/lib/.gitignore @@ -0,0 +1 @@ +run_splint.sh
quarterback-devel@lists.fedorahosted.org