Skip to content

Commit

Permalink
Merge pull request #228 from jnpkrn/maint
Browse files Browse the repository at this point in the history
Various cleanups (symbol imports, typos, doc)
  • Loading branch information
chrissie-c committed Oct 21, 2016
2 parents e13d15e + 0d90bcb commit 7e5212b
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 21 deletions.
15 changes: 12 additions & 3 deletions docs/mainpage.h
Expand Up @@ -3,9 +3,11 @@
*
* @section overview Overview
*
* libqb is a thread-safe library with the primary purpose of providing
* high-performance, reusable features for client-server architecture,
* such as logging, tracing, inter-process communication (IPC), and polling.
* libqb is a library with the primary purpose of providing high-performance,
* reusable features for client-server architecture, such as logging, tracing,
* inter-process communication (IPC), and polling. Except for some documented
* anti-pattern use cases regarding IPC communication and logging, it is deemed
* thread-safe.
*
* We don't intend this to be an all-encompassing library, but instead
* provide very specially focused APIs that are highly tuned for maximum
Expand Down Expand Up @@ -92,6 +94,13 @@
* For performance, QB_IPC_SHM (shared memory) is recommended. It is tuned for
* very high performance.
*
* @par Multithreading
* As of current implementation, there are not many guarantees about ipc system
* being thread-safe. What remains there is mostly owing to the encapsulation
* of independent IPC connections. Therefore it is highly recommended to have
* a single one pushed throughout its lifecycle just with a single thread;
* anything else would likely warrant external synchronization enforcement.
*
* @par Client API
* @copydoc qbipcc.h
* @see qbipcc.h
Expand Down
1 change: 1 addition & 0 deletions examples/ipcserver.c
Expand Up @@ -21,6 +21,7 @@
#include "os_base.h"
#include <signal.h>

#include <qb/qbarray.h>
#include <qb/qbdefs.h>
#include <qb/qbutil.h>
#include <qb/qblog.h>
Expand Down
7 changes: 2 additions & 5 deletions include/qb/qbipcc.h
Expand Up @@ -27,12 +27,9 @@ extern "C" {
#endif
/* *INDENT-ON* */

#include <qb/qbconfig.h>
#include <sys/types.h> /* size_t, ssize_t */
#include <sys/uio.h> /* iovec */

#include <pthread.h>
#include <sys/poll.h>
#include <sys/socket.h>
#include <qb/qbhdb.h>
#include <qb/qbipc_common.h>

/**
Expand Down
12 changes: 6 additions & 6 deletions include/qb/qbipcs.h
Expand Up @@ -29,11 +29,11 @@ extern "C" {
#endif
/* *INDENT-ON* */

#include <stdlib.h>
#include <sys/uio.h>
#include <qb/qbipc_common.h>
#include <qb/qbhdb.h>
#include <qb/qbloop.h>
#include <sys/types.h> /* size_t, ssize_t */
#include <sys/uio.h> /* iovec */

#include <qb/qbipc_common.h> /* qb_ipc_type */
#include <qb/qbloop.h> /* qb_loop_priority */

/**
* @file qbipcs.h
Expand Down Expand Up @@ -114,7 +114,7 @@ struct qb_ipcs_poll_handlers {
/**
* This callback is to check whether you want to accept a new connection.
*
* The type of checks you should do are authentication, service availabilty
* The type of checks you should do are authentication, service availability
* or process resource constraints.
* @return 0 to accept or -errno to indicate a failure (sent back to the client)
*
Expand Down
1 change: 1 addition & 0 deletions include/qb/qbloop.h
Expand Up @@ -29,6 +29,7 @@ extern "C" {

#include <signal.h>
#include <stdint.h>
#include <poll.h> /* make POLLIN etc. readily available */

/**
* @file qbloop.h
Expand Down
1 change: 1 addition & 0 deletions lib/ipc_setup.c
Expand Up @@ -19,6 +19,7 @@
* along with libqb. If not, see <http://www.gnu.org/licenses/>.
*/
#include "os_base.h"
#include <poll.h>

#if defined(HAVE_GETPEERUCRED)
#include <ucred.h>
Expand Down
5 changes: 2 additions & 3 deletions lib/ipc_shm.c
Expand Up @@ -19,6 +19,7 @@
* along with libqb. If not, see <http://www.gnu.org/licenses/>.
*/
#include "os_base.h"
#include <poll.h>

#include "ipc_int.h"
#include "util_int.h"
Expand Down Expand Up @@ -121,9 +122,7 @@ qb_ipc_shm_peek(struct qb_ipc_one_way *one_way, void **data_out,
static void
qb_ipc_shm_reclaim(struct qb_ipc_one_way *one_way)
{
if (one_way->u.shm.rb != NULL) {
qb_rb_chunk_reclaim(one_way->u.shm.rb);
}
qb_rb_chunk_reclaim(one_way->u.shm.rb);
}

static void
Expand Down
3 changes: 2 additions & 1 deletion lib/ipc_socket.c
Expand Up @@ -19,6 +19,7 @@
* along with libqb. If not, see <http://www.gnu.org/licenses/>.
*/
#include "os_base.h"
#include <poll.h>

#ifdef HAVE_SYS_UN_H
#include <sys/un.h>
Expand Down Expand Up @@ -118,7 +119,7 @@ set_sock_size(int sockfd, size_t max_msg_size)
/* The optvat <= max_msg_size check is weird...
* during testing it was discovered in some instances if the
* default optval is exactly equal to our max_msg_size, we couldn't
* actually send a message that large unless we explicilty set
* actually send a message that large unless we explicitly set
* it using setsockopt... there is no good explaination for this. Most
* likely this is hitting some sort of "off by one" error in the kernel. */
if (rc == 0 && optval <= max_msg_size) {
Expand Down
1 change: 1 addition & 0 deletions lib/ipcc.c
Expand Up @@ -19,6 +19,7 @@
* along with libqb. If not, see <http://www.gnu.org/licenses/>.
*/
#include "os_base.h"
#include <poll.h>

#include "ipc_int.h"
#include "util_int.h"
Expand Down
1 change: 1 addition & 0 deletions lib/ipcs.c
Expand Up @@ -19,6 +19,7 @@
* along with libqb. If not, see <http://www.gnu.org/licenses/>.
*/
#include "os_base.h"
#include <poll.h>

#include "util_int.h"
#include "ipc_int.h"
Expand Down
1 change: 1 addition & 0 deletions tests/bmcpt.c
Expand Up @@ -25,6 +25,7 @@
#include <assert.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <time.h>
Expand Down
1 change: 1 addition & 0 deletions tests/bms.c
Expand Up @@ -21,6 +21,7 @@
#include "os_base.h"
#include <signal.h>

#include <qb/qbarray.h>
#include <qb/qbdefs.h>
#include <qb/qblog.h>
#include <qb/qbutil.h>
Expand Down
4 changes: 1 addition & 3 deletions tests/check_ipc.c
Expand Up @@ -91,7 +91,7 @@ enum my_msg_ids {
*
* 6) cleanup
*
* 7) service availabilty
* 7) service availability
*
* 8) multiple services
*/
Expand Down Expand Up @@ -400,8 +400,6 @@ run_ipc_server(void)
};
uint32_t max_size = MAX_MSG_SIZE;

qb_loop_signal_add(my_loop, QB_LOOP_HIGH, SIGSTOP,
NULL, exit_handler, &handle);
qb_loop_signal_add(my_loop, QB_LOOP_HIGH, SIGTERM,
NULL, exit_handler, &handle);

Expand Down

0 comments on commit 7e5212b

Please sign in to comment.