From owner-svn-ports-all@freebsd.org Wed Mar 23 10:49:19 2016 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C141CAB4E0C; Wed, 23 Mar 2016 10:49:19 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8AD5C1AE3; Wed, 23 Mar 2016 10:49:19 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u2NAnItv013110; Wed, 23 Mar 2016 10:49:18 GMT (envelope-from tijl@FreeBSD.org) Received: (from tijl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u2NAnH7K013100; Wed, 23 Mar 2016 10:49:17 GMT (envelope-from tijl@FreeBSD.org) Message-Id: <201603231049.u2NAnH7K013100@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tijl set sender to tijl@FreeBSD.org using -f From: Tijl Coosemans Date: Wed, 23 Mar 2016 10:49:17 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r411695 - in head/devel: . libqb libqb/files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Mar 2016 10:49:19 -0000 Author: tijl Date: Wed Mar 23 10:49:17 2016 New Revision: 411695 URL: https://svnweb.freebsd.org/changeset/ports/411695 Log: Add devel/libqb. libqb is a library with the primary purpose of providing high performance client server reusable features. It provides high performance logging, tracing, ipc, and poll. PR: 208181 Submitted by: David Shane Holden Added: head/devel/libqb/ head/devel/libqb/Makefile (contents, props changed) head/devel/libqb/distinfo (contents, props changed) head/devel/libqb/files/ head/devel/libqb/files/patch-lib-ipc_int.h (contents, props changed) head/devel/libqb/files/patch-lib-ipc_setup.c (contents, props changed) head/devel/libqb/files/patch-lib-ipc_socket.c (contents, props changed) head/devel/libqb/files/patch-lib-log.c (contents, props changed) head/devel/libqb/files/patch-lib-unix.c (contents, props changed) head/devel/libqb/pkg-descr (contents, props changed) head/devel/libqb/pkg-plist (contents, props changed) Modified: head/devel/Makefile Modified: head/devel/Makefile ============================================================================== --- head/devel/Makefile Wed Mar 23 10:44:10 2016 (r411694) +++ head/devel/Makefile Wed Mar 23 10:49:17 2016 (r411695) @@ -1301,6 +1301,7 @@ SUBDIR += libpololu-avr SUBDIR += libpru SUBDIR += libpthread-stubs + SUBDIR += libqb SUBDIR += libqcow SUBDIR += libqxt SUBDIR += libr3 Added: head/devel/libqb/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/libqb/Makefile Wed Mar 23 10:49:17 2016 (r411695) @@ -0,0 +1,31 @@ +# Created by: dpejesh@yahoo.com +# $FreeBSD$ + +PORTNAME= libqb +PORTVERSION= 0.17.2 +CATEGORIES= devel +MASTER_SITES= https://github.com/ClusterLabs/libqb/releases/download/v${PORTVERSION}/ + +MAINTAINER= dpejesh@yahoo.com +COMMENT= High performance logging, tracing, ipc, and polling library + +LICENSE= LGPL21 +LICENSE_FILE= ${WRKSRC}/COPYING + +QB_SOCKET_DIR?= /var/run/qb +PLIST_SUB+= QB_SOCKET_DIR=${QB_SOCKET_DIR} + +USE_LDCONFIG= yes +USES= gmake libtool pathfix pkgconfig tar:xz +GNU_CONFIGURE= yes +CONFIGURE_ARGS= --disable-silent-rules --with-socket-dir=${QB_SOCKET_DIR} +INSTALL_TARGET= install-strip + +OPTIONS_DEFINE= DOXYGEN +OPTIONS_SUB= yes +DOXYGEN_BUILD_DEPENDS= doxygen:${PORTSDIR}/devel/doxygen + +post-install: + ${MKDIR} ${STAGEDIR}${QB_SOCKET_DIR} + +.include Added: head/devel/libqb/distinfo ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/libqb/distinfo Wed Mar 23 10:49:17 2016 (r411695) @@ -0,0 +1,2 @@ +SHA256 (libqb-0.17.2.tar.xz) = 9a419c649ed51f275dc780da8a15babb8a5d33633567bd9e0cb6193b6e21f4fe +SIZE (libqb-0.17.2.tar.xz) = 373540 Added: head/devel/libqb/files/patch-lib-ipc_int.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/libqb/files/patch-lib-ipc_int.h Wed Mar 23 10:49:17 2016 (r411695) @@ -0,0 +1,10 @@ +--- lib/ipc_int.h.orig 2015-08-18 19:55:43 UTC ++++ lib/ipc_int.h +@@ -91,6 +91,7 @@ struct qb_ipcc_funcs { + struct qb_ipcc_connection { + char name[NAME_MAX]; + int32_t needs_sock_for_poll; ++ gid_t egid; + struct qb_ipc_one_way setup; + struct qb_ipc_one_way request; + struct qb_ipc_one_way response; Added: head/devel/libqb/files/patch-lib-ipc_setup.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/libqb/files/patch-lib-ipc_setup.c Wed Mar 23 10:49:17 2016 (r411695) @@ -0,0 +1,341 @@ +--- lib/ipc_setup.c.orig 2015-08-18 19:55:43 UTC ++++ lib/ipc_setup.c +@@ -51,7 +51,10 @@ struct ipc_auth_ugp { + struct ipc_auth_data { + int32_t sock; + struct qb_ipcs_service *s; +- struct qb_ipc_connection_request msg; ++ union { ++ struct qb_ipc_connection_request req; ++ struct qb_ipc_connection_response res; ++ } msg; + struct msghdr msg_recv; + struct iovec iov_recv; + struct ipc_auth_ugp ugp; +@@ -311,12 +314,138 @@ qb_ipcc_us_sock_close(int32_t sock) + close(sock); + } + ++static int32_t ++qb_ipc_auth_creds(struct ipc_auth_data *data) ++{ ++ int32_t res = 0; ++ ++ /* ++ * currently support getpeerucred, getpeereid, and SO_PASSCRED credential ++ * retrieval mechanisms for various Platforms ++ */ ++#ifdef HAVE_GETPEERUCRED ++ /* ++ * Solaris and some BSD systems ++ */ ++ { ++ ucred_t *uc = NULL; ++ ++ if (getpeerucred(data->sock, &uc) == 0) { ++ res = 0; ++ data->ugp.uid = ucred_geteuid(uc); ++ data->ugp.gid = ucred_getegid(uc); ++ data->ugp.pid = ucred_getpid(uc); ++ ucred_free(uc); ++ } else { ++ res = -errno; ++ } ++ } ++#elif defined(HAVE_GETPEEREID) ++ /* ++ * Usually MacOSX systems ++ */ ++ { ++ /* ++ * TODO get the peer's pid. ++ * c->pid = ?; ++ */ ++ if (getpeereid(data->sock, &data->ugp.uid, &data->ugp.gid) == 0) { ++ res = 0; ++ } else { ++ res = -errno; ++ } ++ } ++ ++#elif defined(SO_PASSCRED) ++ /* ++ * Usually Linux systems ++ */ ++ { ++ struct ucred cred; ++ struct cmsghdr *cmsg; ++ ++ res = -EINVAL; ++ for (cmsg = CMSG_FIRSTHDR(&data->msg_recv); cmsg != NULL; ++ cmsg = CMSG_NXTHDR(&data->msg_recv, cmsg)) { ++ if (cmsg->cmsg_type != SCM_CREDENTIALS) ++ continue; ++ ++ memcpy(&cred, CMSG_DATA(cmsg), sizeof(struct ucred)); ++ res = 0; ++ data->ugp.pid = cred.pid; ++ data->ugp.uid = cred.uid; ++ data->ugp.gid = cred.gid; ++ break; ++ } ++ } ++#else /* no credentials */ ++ data->ugp.pid = 0; ++ data->ugp.uid = 0; ++ data->ugp.gid = 0; ++ res = -ENOTSUP; ++#endif /* no credentials */ ++ ++ return res; ++} ++ ++static void ++destroy_ipc_auth_data(struct ipc_auth_data *data) ++{ ++ if (data->s) { ++ qb_ipcs_unref(data->s); ++ } ++ ++#ifdef SO_PASSCRED ++ free(data->cmsg_cred); ++#endif ++ free(data); ++} ++ ++static struct ipc_auth_data * ++init_ipc_auth_data(int sock, size_t len) ++{ ++ struct ipc_auth_data *data = calloc(1, sizeof(struct ipc_auth_data)); ++ ++ if (data == NULL) { ++ return NULL; ++ } ++ ++ data->msg_recv.msg_iov = &data->iov_recv; ++ data->msg_recv.msg_iovlen = 1; ++ data->msg_recv.msg_name = 0; ++ data->msg_recv.msg_namelen = 0; ++ ++#ifdef SO_PASSCRED ++ data->cmsg_cred = calloc(1, CMSG_SPACE(sizeof(struct ucred))); ++ if (data->cmsg_cred == NULL) { ++ destroy_ipc_auth_data(data); ++ return NULL; ++ } ++ data->msg_recv.msg_control = (void *)data->cmsg_cred; ++ data->msg_recv.msg_controllen = CMSG_SPACE(sizeof(struct ucred)); ++#endif ++#ifdef QB_SOLARIS ++ data->msg_recv.msg_accrights = 0; ++ data->msg_recv.msg_accrightslen = 0; ++#else ++ data->msg_recv.msg_flags = 0; ++#endif /* QB_SOLARIS */ ++ ++ data->len = len; ++ data->iov_recv.iov_base = &data->msg; ++ data->iov_recv.iov_len = data->len; ++ data->sock = sock; ++ ++ return data; ++} ++ + int32_t + qb_ipcc_us_setup_connect(struct qb_ipcc_connection *c, + struct qb_ipc_connection_response *r) + { + int32_t res; + struct qb_ipc_connection_request request; ++ struct ipc_auth_data *data; + #ifdef QB_LINUX + int off = 0; + int on = 1; +@@ -340,22 +469,33 @@ qb_ipcc_us_setup_connect(struct qb_ipcc_ + qb_ipcc_us_sock_close(c->setup.u.us.sock); + return res; + } ++ ++ data = init_ipc_auth_data(c->setup.u.us.sock, sizeof(struct qb_ipc_connection_response)); ++ if (data == NULL) { ++ qb_ipcc_us_sock_close(c->setup.u.us.sock); ++ return -ENOMEM; ++ } ++ ++ qb_ipc_us_ready(&c->setup, NULL, -1, POLLIN); ++ res = qb_ipc_us_recv_msghdr(data); ++ + #ifdef QB_LINUX + setsockopt(c->setup.u.us.sock, SOL_SOCKET, SO_PASSCRED, &off, + sizeof(off)); + #endif + +- res = +- qb_ipc_us_recv(&c->setup, r, +- sizeof(struct qb_ipc_connection_response), -1); +- if (res < 0) { ++ if (res != data->len) { ++ destroy_ipc_auth_data(data); + return res; + } + +- if (r->hdr.error != 0) { +- return r->hdr.error; +- } +- return 0; ++ memcpy(r, &data->msg.res, sizeof(struct qb_ipc_connection_response)); ++ ++ qb_ipc_auth_creds(data); ++ c->egid = data->ugp.gid; ++ ++ destroy_ipc_auth_data(data); ++ return r->hdr.error; + } + + /* +@@ -561,19 +701,6 @@ send_response: + return res; + } + +-static void +-destroy_ipc_auth_data(struct ipc_auth_data *data) +-{ +- if (data->s) { +- qb_ipcs_unref(data->s); +- } +- +-#ifdef SO_PASSCRED +- free(data->cmsg_cred); +-#endif +- free(data); +-} +- + static int32_t + process_auth(int32_t fd, int32_t revents, void *d) + { +@@ -615,71 +742,7 @@ process_auth(int32_t fd, int32_t revents + goto cleanup_and_return; + } + +- /* +- * currently support getpeerucred, getpeereid, and SO_PASSCRED credential +- * retrieval mechanisms for various Platforms +- */ +-#ifdef HAVE_GETPEERUCRED +- /* +- * Solaris and some BSD systems +- */ +- { +- ucred_t *uc = NULL; +- +- if (getpeerucred(data->sock, &uc) == 0) { +- res = 0; +- data->ugp.uid = ucred_geteuid(uc); +- data->ugp.gid = ucred_getegid(uc); +- data->ugp.pid = ucred_getpid(uc); +- ucred_free(uc); +- } else { +- res = -errno; +- } +- } +-#elif HAVE_GETPEEREID +- /* +- * Usually MacOSX systems +- */ +- { +- /* +- * TODO get the peer's pid. +- * c->pid = ?; +- */ +- if (getpeereid(data->sock, &data->ugp.uid, &data->ugp.gid) == 0) { +- res = 0; +- } else { +- res = -errno; +- } +- } +- +-#elif SO_PASSCRED +- /* +- * Usually Linux systems +- */ +- { +- struct ucred cred; +- struct cmsghdr *cmsg; +- +- res = -EINVAL; +- for (cmsg = CMSG_FIRSTHDR(&data->msg_recv); cmsg != NULL; +- cmsg = CMSG_NXTHDR(&data->msg_recv, cmsg)) { +- if (cmsg->cmsg_type != SCM_CREDENTIALS) +- continue; +- +- memcpy(&cred, CMSG_DATA(cmsg), sizeof(struct ucred)); +- res = 0; +- data->ugp.pid = cred.pid; +- data->ugp.uid = cred.uid; +- data->ugp.gid = cred.gid; +- break; +- } +- } +-#else /* no credentials */ +- data->ugp.pid = 0; +- data->ugp.uid = 0; +- data->ugp.gid = 0; +- res = -ENOTSUP; +-#endif /* no credentials */ ++ res = qb_ipc_auth_creds(data); + + cleanup_and_return: + #ifdef SO_PASSCRED +@@ -690,7 +753,7 @@ cleanup_and_return: + + if (res < 0) { + close(data->sock); +- } else if (data->msg.hdr.id == QB_IPC_MSG_AUTHENTICATE) { ++ } else if (data->msg.req.hdr.id == QB_IPC_MSG_AUTHENTICATE) { + (void)handle_new_connection(data->s, res, data->sock, &data->msg, data->len, &data->ugp); + } else { + close(data->sock); +@@ -709,7 +772,7 @@ qb_ipcs_uc_recv_and_auth(int32_t sock, s + int on = 1; + #endif + +- data = calloc(1, sizeof(struct ipc_auth_data)); ++ data = init_ipc_auth_data(sock, sizeof(struct qb_ipc_connection_request)); + if (data == NULL) { + close(sock); + /* -ENOMEM */ +@@ -719,34 +782,6 @@ qb_ipcs_uc_recv_and_auth(int32_t sock, s + data->s = s; + qb_ipcs_ref(data->s); + +- data->msg_recv.msg_iov = &data->iov_recv; +- data->msg_recv.msg_iovlen = 1; +- data->msg_recv.msg_name = 0; +- data->msg_recv.msg_namelen = 0; +- +-#ifdef SO_PASSCRED +- data->cmsg_cred = calloc(1,CMSG_SPACE(sizeof(struct ucred))); +- if (data->cmsg_cred == NULL) { +- close(sock); +- destroy_ipc_auth_data(data); +- /* -ENOMEM */ +- return; +- } +- data->msg_recv.msg_control = (void *)data->cmsg_cred; +- data->msg_recv.msg_controllen = CMSG_SPACE(sizeof(struct ucred)); +-#endif +-#ifdef QB_SOLARIS +- data->msg_recv.msg_accrights = 0; +- data->msg_recv.msg_accrightslen = 0; +-#else +- data->msg_recv.msg_flags = 0; +-#endif /* QB_SOLARIS */ +- +- data->len = sizeof(struct qb_ipc_connection_request); +- data->iov_recv.iov_base = &data->msg; +- data->iov_recv.iov_len = data->len; +- data->sock = sock; +- + #ifdef SO_PASSCRED + setsockopt(sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); + #endif Added: head/devel/libqb/files/patch-lib-ipc_socket.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/libqb/files/patch-lib-ipc_socket.c Wed Mar 23 10:49:17 2016 (r411695) @@ -0,0 +1,130 @@ +--- lib/ipc_socket.c.orig 2015-08-18 19:55:43 UTC ++++ lib/ipc_socket.c +@@ -60,7 +60,8 @@ set_sock_addr(struct sockaddr_un *addres + + static int32_t + qb_ipc_dgram_sock_setup(const char *base_name, +- const char *service_name, int32_t * sock_pt) ++ const char *service_name, int32_t * sock_pt, ++ gid_t gid) + { + int32_t request_fd; + struct sockaddr_un local_address; +@@ -84,6 +85,10 @@ qb_ipc_dgram_sock_setup(const char *base + #endif + res = bind(request_fd, (struct sockaddr *)&local_address, + sizeof(local_address)); ++#if !(defined(QB_LINUX) || defined(QB_CYGWIN)) ++ chmod(local_address.sun_path, 0660); ++ chown(local_address.sun_path, -1, gid); ++#endif + if (res < 0) { + goto error_connect; + } +@@ -107,7 +112,7 @@ set_sock_size(int sockfd, size_t max_msg + + rc = getsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, &optval, &optlen); + +- qb_util_log(LOG_TRACE, "%d: getsockopt(%d, needed:%d) actual:%d", ++ qb_util_log(LOG_TRACE, "%d: getsockopt(%d, SO_SNDBUF, needed:%d) actual:%d", + rc, sockfd, max_msg_size, optval); + + /* The optvat <= max_msg_size check is weird... +@@ -121,6 +126,29 @@ set_sock_size(int sockfd, size_t max_msg + optlen = sizeof(optval); + rc = setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, &optval, optlen); + } ++ ++ if (rc != 0) { ++ return -errno; ++ } ++ ++ rc = getsockopt(sockfd, SOL_SOCKET, SO_RCVBUF, &optval, &optlen); ++ ++ qb_util_log(LOG_TRACE, "%d: getsockopt(%d, SO_RCVBUF, needed:%d) actual:%d", ++ rc, sockfd, max_msg_size, optval); ++ ++ /* Set the sockets receive buffer size to match the send buffer. Without ++ * this calls to sendto() will result in an ENOBUFS error if the message ++ * is larger than net.local.dgram.recvspace sysctl. */ ++ if (rc == 0 && optval <= max_msg_size) { ++ optval = max_msg_size; ++ optlen = sizeof(optval); ++ rc = setsockopt(sockfd, SOL_SOCKET, SO_RCVBUF, &optval, optlen); ++ } ++ ++ if (rc != 0) { ++ return -errno; ++ } ++ + return rc; + } + +@@ -218,12 +246,12 @@ static int32_t + qb_ipc_dgram_sock_connect(const char *base_name, + const char *local_name, + const char *remote_name, +- int32_t max_msg_size, int32_t * sock_pt) ++ int32_t max_msg_size, int32_t * sock_pt, gid_t gid) + { + char sock_path[PATH_MAX]; + struct sockaddr_un remote_address; + int32_t res = qb_ipc_dgram_sock_setup(base_name, local_name, +- sock_pt); ++ sock_pt, gid); + if (res < 0) { + return res; + } +@@ -544,14 +572,14 @@ qb_ipcc_us_connect(struct qb_ipcc_connec + fd_hdr = -1; + + res = qb_ipc_dgram_sock_connect(r->response, "response", "request", +- r->max_msg_size, &c->request.u.us.sock); ++ r->max_msg_size, &c->request.u.us.sock, c->egid); + if (res != 0) { + goto cleanup_hdr; + } + c->response.u.us.sock = c->request.u.us.sock; + + res = qb_ipc_dgram_sock_connect(r->response, "event", "event-tx", +- r->max_msg_size, &c->event.u.us.sock); ++ r->max_msg_size, &c->event.u.us.sock, c->egid); + if (res != 0) { + goto cleanup_hdr; + } +@@ -773,10 +801,16 @@ qb_ipcs_us_connect(struct qb_ipcs_servic + + /* request channel */ + res = qb_ipc_dgram_sock_setup(r->response, "request", +- &c->request.u.us.sock); ++ &c->request.u.us.sock, c->egid); + if (res < 0) { + goto cleanup_hdr; + } ++ ++ res = set_sock_size(c->request.u.us.sock, c->request.max_msg_size); ++ if (res != 0) { ++ goto cleanup_hdr; ++ } ++ + c->setup.u.us.sock_name = NULL; + c->request.u.us.sock_name = NULL; + +@@ -787,10 +821,16 @@ qb_ipcs_us_connect(struct qb_ipcs_servic + + /* event channel */ + res = qb_ipc_dgram_sock_setup(r->response, "event-tx", +- &c->event.u.us.sock); ++ &c->event.u.us.sock, c->egid); + if (res < 0) { + goto cleanup_hdr; + } ++ ++ res = set_sock_size(c->event.u.us.sock, c->event.max_msg_size); ++ if (res != 0) { ++ goto cleanup_hdr; ++ } ++ + snprintf(path, PATH_MAX, "%s-%s", r->response, "event"); + c->event.u.us.sock_name = strdup(path); + Added: head/devel/libqb/files/patch-lib-log.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/libqb/files/patch-lib-log.c Wed Mar 23 10:49:17 2016 (r411695) @@ -0,0 +1,97 @@ +--- lib/log.c.orig 2015-08-18 19:55:43 UTC ++++ lib/log.c +@@ -47,9 +47,15 @@ static int32_t logger_inited = QB_FALSE; + static pthread_rwlock_t _listlock; + static qb_log_filter_fn _custom_filter_fn = NULL; + ++static QB_LIST_DECLARE(dlnames); + static QB_LIST_DECLARE(tags_head); + static QB_LIST_DECLARE(callsite_sections); + ++struct dlname { ++ char *dln_name; ++ struct qb_list_head list; ++}; ++ + struct callsite_section { + struct qb_log_callsite *start; + struct qb_log_callsite *stop; +@@ -739,23 +745,45 @@ qb_log_filter_ctl(int32_t t, enum qb_log + } + + #ifdef QB_HAVE_ATTRIBUTE_SECTION ++/* Some platforms (eg. FreeBSD 10+) don't support calling dlopen() from ++ * within a dl_iterate_phdr() callback; so save all of the dlpi_names to ++ * a list and iterate over them afterwards. */ + static int32_t + _log_so_walk_callback(struct dl_phdr_info *info, size_t size, void *data) + { ++ struct dlname *dlname; ++ + if (strlen(info->dlpi_name) > 0) { +- void *handle; +- void *start; +- void *stop; +- const char *error; ++ dlname = calloc(1, sizeof(struct dlname)); ++ if (!dlname) ++ return 0; ++ dlname->dln_name = strdup(info->dlpi_name); ++ qb_list_add_tail(&dlname->list, &dlnames); ++ } + +- handle = dlopen(info->dlpi_name, RTLD_LAZY); ++ return 0; ++} ++ ++static void ++_log_so_walk_dlnames(void) ++{ ++ struct dlname *dlname; ++ struct qb_list_head *iter; ++ struct qb_list_head *next; ++ ++ void *handle; ++ void *start; ++ void *stop; ++ const char *error; ++ ++ qb_list_for_each_safe(iter, next, &dlnames) { ++ dlname = qb_list_entry(iter, struct dlname, list); ++ ++ handle = dlopen(dlname->dln_name, RTLD_LAZY); + error = dlerror(); + if (!handle || error) { + qb_log(LOG_ERR, "%s", error); +- if (handle) { +- dlclose(handle); +- } +- return 0; ++ goto done; + } + + start = dlsym(handle, "__start___verbose"); +@@ -773,9 +801,13 @@ _log_so_walk_callback(struct dl_phdr_inf + qb_log_callsites_register(start, stop); + } + done: +- dlclose(handle); ++ if (handle) ++ dlclose(handle); ++ qb_list_del(iter); ++ if (dlname->dln_name) ++ free(dlname->dln_name); ++ free(dlname); + } +- return 0; + } + #endif /* QB_HAVE_ATTRIBUTE_SECTION */ + +@@ -823,6 +855,7 @@ qb_log_init(const char *name, int32_t fa + #ifdef QB_HAVE_ATTRIBUTE_SECTION + qb_log_callsites_register(__start___verbose, __stop___verbose); + dl_iterate_phdr(_log_so_walk_callback, NULL); ++ _log_so_walk_dlnames(); + #endif /* QB_HAVE_ATTRIBUTE_SECTION */ + + conf[QB_LOG_STDERR].state = QB_LOG_STATE_DISABLED; Added: head/devel/libqb/files/patch-lib-unix.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/libqb/files/patch-lib-unix.c Wed Mar 23 10:49:17 2016 (r411695) @@ -0,0 +1,20 @@ +--- lib/unix.c.orig 2015-08-18 19:55:43 UTC ++++ lib/unix.c +@@ -83,7 +83,7 @@ qb_sys_mmap_file_open(char *path, const + #if defined(QB_LINUX) || defined(QB_CYGWIN) + snprintf(path, PATH_MAX, "/dev/shm/%s", file); + #else +- snprintf(path, PATH_MAX, LOCALSTATEDIR "/run/%s", file); ++ snprintf(path, PATH_MAX, "%s/%s", SOCKETDIR, file); + is_absolute = path; + #endif + } +@@ -91,7 +91,7 @@ qb_sys_mmap_file_open(char *path, const + if (fd < 0 && !is_absolute) { + qb_util_perror(LOG_ERR, "couldn't open file %s", path); + +- snprintf(path, PATH_MAX, LOCALSTATEDIR "/run/%s", file); ++ snprintf(path, PATH_MAX, "%s/%s", SOCKETDIR, file); + fd = open_mmap_file(path, file_flags); + if (fd < 0) { + res = -errno; Added: head/devel/libqb/pkg-descr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/libqb/pkg-descr Wed Mar 23 10:49:17 2016 (r411695) @@ -0,0 +1,5 @@ +libqb is a library with the primary purpose of providing high performance +client server reusable features. It provides high performance logging, tracing, +ipc, and poll. + +WWW: https://github.com/ClusterLabs/libqb/wiki Added: head/devel/libqb/pkg-plist ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/libqb/pkg-plist Wed Mar 23 10:49:17 2016 (r411695) @@ -0,0 +1,36 @@ +include/qb/qbarray.h +include/qb/qbatomic.h +include/qb/qbconfig.h +include/qb/qbdefs.h +include/qb/qbhdb.h +include/qb/qbipc_common.h +include/qb/qbipcc.h +include/qb/qbipcs.h +include/qb/qblist.h +include/qb/qblog.h +include/qb/qbloop.h +include/qb/qbmap.h +include/qb/qbrb.h +include/qb/qbutil.h +lib/libqb.a +lib/libqb.so +lib/libqb.so.0 +lib/libqb.so.0.17.2 +libdata/pkgconfig/libqb.pc +%%DOXYGEN%%man/man3/qbarray.h.3.gz +%%DOXYGEN%%man/man3/qbatomic.h.3.gz +%%DOXYGEN%%man/man3/qbhdb.h.3.gz +%%DOXYGEN%%man/man3/qbipc_common.h.3.gz +%%DOXYGEN%%man/man3/qbipcc.h.3.gz +%%DOXYGEN%%man/man3/qbipcs.h.3.gz +%%DOXYGEN%%man/man3/qblist.h.3.gz +%%DOXYGEN%%man/man3/qblog.h.3.gz +%%DOXYGEN%%man/man3/qbloop.h.3.gz +%%DOXYGEN%%man/man3/qbmap.h.3.gz +%%DOXYGEN%%man/man3/qbutil.h.3.gz +%%DOXYGEN%%man/man8/qb-blackbox.8.gz +sbin/qb-blackbox +@comment %%PORTDOCS%%%%DOCSDIR%%/COPYING +%%PORTDOCS%%%%DOCSDIR%%/INSTALL +%%PORTDOCS%%%%DOCSDIR%%/README.markdown +@dir(,,1770) %%QB_SOCKET_DIR%%