Browse files

Fixed a bug in the static build option in CMakeLists.txt

Made some symbols unique w.r.t. libpthread_workqueue to prevent duplicate symbols when linking as static libs

git-svn-id: svn://mark.heily.com/libkqueue/trunk@502 34a59efb-09c4-4dcf-b95f-994a32aba0d8
  • Loading branch information...
1 parent a94d614 commit ce214a8fc5435100256b84c20ce0d2e632879954 marius committed May 9, 2011
Showing with 20 additions and 19 deletions.
  1. +2 −1 CMakeLists.txt
  2. +12 −12 src/common/debug.h
  3. +2 −2 src/common/kevent.c
  4. +4 −4 src/common/kqueue.c
View
3 CMakeLists.txt
@@ -84,7 +84,8 @@ include_directories(
#library (static or shared)
option(STATIC_KQUEUE "Enable to build libkqueue as static lib" OFF)
-if(STATIC_WORKQUEUE)
+if(STATIC_KQUEUE)
+ message("-- building libkqueue as static lib")
add_definitions(-DMAKE_STATIC)
add_library(kqueue STATIC ${SRC} ${INCL})
else()
View
24 src/common/debug.h
@@ -23,8 +23,8 @@
# include <unistd.h>
#endif
-extern int DEBUG_ACTIVE;
-extern char *DEBUG_IDENT;
+extern int DEBUG_KQUEUE;
+extern char *KQUEUE_DEBUG_IDENT;
#if defined(__linux__)
# include <sys/syscall.h>
@@ -39,37 +39,37 @@ extern char *DEBUG_IDENT;
#ifndef NDEBUG
#define dbg_puts(str) do { \
- if (DEBUG_ACTIVE) \
+ if (DEBUG_KQUEUE) \
fprintf(stderr, "%s [%d]: %s(): %s\n", \
- DEBUG_IDENT, THREAD_ID, __func__, str); \
+ KQUEUE_DEBUG_IDENT, THREAD_ID, __func__, str); \
} while (0)
#define dbg_printf(fmt,...) do { \
- if (DEBUG_ACTIVE) \
+ if (DEBUG_KQUEUE) \
fprintf(stderr, "%s [%d]: %s(): "fmt"\n", \
- DEBUG_IDENT, THREAD_ID, __func__, __VA_ARGS__); \
+ KQUEUE_DEBUG_IDENT, THREAD_ID, __func__, __VA_ARGS__); \
} while (0)
#define dbg_perror(str) do { \
- if (DEBUG_ACTIVE) \
+ if (DEBUG_KQUEUE) \
fprintf(stderr, "%s [%d]: %s(): %s: %s (errno=%d)\n", \
- DEBUG_IDENT, THREAD_ID, __func__, str, \
+ KQUEUE_DEBUG_IDENT, THREAD_ID, __func__, str, \
strerror(errno), errno); \
} while (0)
# define reset_errno() do { errno = 0; } while (0)
# if defined(_WIN32)
# define dbg_lasterror(str) do { \
- if (DEBUG_ACTIVE) \
+ if (DEBUG_KQUEUE) \
fprintf(stderr, "%s: [%d] %s(): %s: (LastError=%d)\n", \
- DEBUG_IDENT, THREAD_ID, __func__, str, (int)GetLastError()); \
+ KQUEUE_DEBUG_IDENT, THREAD_ID, __func__, str, (int)GetLastError()); \
} while (0)
# define dbg_wsalasterror(str) do { \
- if (DEBUG_ACTIVE) \
+ if (DEBUG_KQUEUE) \
fprintf(stderr, "%s: [%d] %s(): %s: (WSALastError=%d)\n", \
- DEBUG_IDENT, THREAD_ID, __func__, str, (int)WSAGetLastError()); \
+ KQUEUE_DEBUG_IDENT, THREAD_ID, __func__, str, (int)WSAGetLastError()); \
} while (0)
# else
View
4 src/common/kevent.c
@@ -250,7 +250,7 @@ kevent(int kqfd, const struct kevent *changelist, int nchanges,
return (-1);
}
- if (DEBUG_ACTIVE) {
+ if (DEBUG_KQUEUE) {
myid = atomic_inc(&_kevent_counter);
dbg_printf("--- kevent %u --- (nchanges = %d, nevents = %d)", myid, nchanges, nevents);
} else {
@@ -303,7 +303,7 @@ kevent(int kqfd, const struct kevent *changelist, int nchanges,
}
}
- if (DEBUG_ACTIVE) {
+ if (DEBUG_KQUEUE) {
int n;
dbg_printf("(%u) returning %d events", myid, rv);
View
8 src/common/kqueue.c
@@ -24,8 +24,8 @@
#include "private.h"
-int DEBUG_ACTIVE = 0;
-char *DEBUG_IDENT = "KQ";
+int DEBUG_KQUEUE = 0;
+char *KQUEUE_DEBUG_IDENT = "KQ";
static unsigned int
get_fd_limit(void)
@@ -58,11 +58,11 @@ int CONSTRUCTOR
libkqueue_init(void)
{
#ifdef NDEBUG
- DEBUG_ACTIVE = 0;
+ DEBUG_KQUEUE = 0;
#else
char *s = getenv("KQUEUE_DEBUG");
if (s != NULL && strlen(s) > 0) {
- DEBUG_ACTIVE = 1;
+ DEBUG_KQUEUE = 1;
# if defined(_WIN32) && !defined(__GNUC__)
/* Enable heap surveillance */
{

0 comments on commit ce214a8

Please sign in to comment.