This allows replacing pthread mutexes with other types of mutex.
-/* Copyright (C) 2007-2010 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
}
#ifdef DEBUG
-static SCMutex ftp_state_mem_lock = PTHREAD_MUTEX_INITIALIZER;
+static SCMutex ftp_state_mem_lock = SCMUTEX_INITIALIZER;
static uint64_t ftp_state_memuse = 0;
static uint64_t ftp_state_memcnt = 0;
#endif
-/* Copyright (C) 2007-2011 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
static HTPCfgRec cfglist;
#ifdef DEBUG
-static SCMutex htp_state_mem_lock = PTHREAD_MUTEX_INITIALIZER;
+static SCMutex htp_state_mem_lock = SCMUTEX_INITIALIZER;
static uint64_t htp_state_memuse = 0;
static uint64_t htp_state_memcnt = 0;
#endif
-/* Copyright (C) 2007-2010 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
static uint16_t al_max_parsers = 0; /* incremented for every registered parser */
static Pool *al_result_pool = NULL;
-static SCMutex al_result_pool_mutex = PTHREAD_MUTEX_INITIALIZER;
+static SCMutex al_result_pool_mutex = SCMUTEX_INITIALIZER;
#ifdef DEBUG
static uint32_t al_result_pool_elmts = 0;
#endif /* DEBUG */
* Alternatively, the "detect-engine.luajit-states" var can be set.
*/
static Pool *luajit_states = NULL;
-static pthread_mutex_t luajit_states_lock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t luajit_states_lock = SCMUTEX_INITIALIZER;
#define DATATYPE_PACKET (1<<0)
#define DATATYPE_PAYLOAD (1<<1)
#endif
/** protect pfring_set_bpf_filter, as it is not thread safe */
-static SCMutex afpacket_bpf_set_filter_lock = PTHREAD_MUTEX_INITIALIZER;
+static SCMutex afpacket_bpf_set_filter_lock = SCMUTEX_INITIALIZER;
enum {
AFP_READ_OK,
-/* Copyright (C) 2007-2012 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
/** protect pcap_compile and pcap_setfilter, as they are not thread safe:
* http://seclists.org/tcpdump/2009/q1/62 */
-static SCMutex pcap_bpf_compile_lock = PTHREAD_MUTEX_INITIALIZER;
+static SCMutex pcap_bpf_compile_lock = SCMUTEX_INITIALIZER;
/**
* \brief Registration Function for RecievePcap.
-/* Copyright (C) 2007-2012 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
#else /* implied we do have PF_RING support */
/** protect pfring_set_bpf_filter, as it is not thread safe */
-static SCMutex pfring_bpf_set_filter_lock = PTHREAD_MUTEX_INITIALIZER;
+static SCMutex pfring_bpf_set_filter_lock = SCMUTEX_INITIALIZER;
/* XXX replace with user configurable options */
#define LIBPFRING_PROMISC 1
-/* Copyright (C) 2007-2011 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
static inline int StreamTcpValidateAck(TcpSession *ssn, TcpStream *, Packet *);
static PoolThread *ssn_pool = NULL;
-static SCMutex ssn_pool_mutex = PTHREAD_MUTEX_INITIALIZER; /**< init only, protect initializing and growing pool */
+static SCMutex ssn_pool_mutex = SCMUTEX_INITIALIZER; /**< init only, protect initializing and growing pool */
#ifdef DEBUG
static uint64_t ssn_pool_cnt = 0; /** counts ssns, protected by ssn_pool_mutex */
#endif
-/* Copyright (C) 2007-2010 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
static uint16_t toclient_min_chunk_len = 2560;
static Pool *stream_msg_pool = NULL;
-static SCMutex stream_msg_pool_mutex = PTHREAD_MUTEX_INITIALIZER;
+static SCMutex stream_msg_pool_mutex = SCMUTEX_INITIALIZER;
int StreamMsgInit(void *data, void *initdata)
{
-/* Copyright (C) 2007-2010 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
#define SCMutex pthread_mutex_t
#define SCMutexAttr pthread_mutexattr_t
#define SCMutexDestroy pthread_mutex_destroy
+#define SCMUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
/** Suricata RWLocks */
#define SCRWLock pthread_rwlock_t
ThreadVars *tv_root[TVT_MAX] = { NULL };
/* lock to protect tv_root */
-SCMutex tv_root_lock = PTHREAD_MUTEX_INITIALIZER;
+SCMutex tv_root_lock = SCMUTEX_INITIALIZER;
/* Action On Failure(AOF). Determines how the engine should behave when a
* thread encounters a failure. Defaults to restart the failed thread */
-/* Copyright (C) 2007-2012 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
static CudaHandlerConfProfile *conf_profiles = NULL;
/* protects above var */
-static SCMutex mutex = PTHREAD_MUTEX_INITIALIZER;
+static SCMutex mutex = SCMUTEX_INITIALIZER;
void CudaHandlerAddCudaProfileFromConf(const char *name,
void *(*Callback)(ConfNode *node),
-/* Copyright (C) 2007-2010 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
/**
* \brief Mutex for accessing the fine-grained fiters sc_log_fg_filters
*/
-static SCMutex sc_log_fg_filters_m[SC_LOG_FILTER_MAX] = { PTHREAD_MUTEX_INITIALIZER,
- PTHREAD_MUTEX_INITIALIZER };
+static SCMutex sc_log_fg_filters_m[SC_LOG_FILTER_MAX] = { SCMUTEX_INITIALIZER,
+ SCMUTEX_INITIALIZER };
/**
* \brief Holds the function-dependent filters
/**
* \brief Mutex for accessing the function-dependent filters sc_log_fd_filters
*/
-static SCMutex sc_log_fd_filters_m = PTHREAD_MUTEX_INITIALIZER;
+static SCMutex sc_log_fd_filters_m = SCMUTEX_INITIALIZER;
/**
* \brief Holds the thread_list required by function-dependent filters
/**
* \brief Mutex for accessing the FD thread_list sc_log_fd_filters_tl
*/
-static SCMutex sc_log_fd_filters_tl_m = PTHREAD_MUTEX_INITIALIZER;
+static SCMutex sc_log_fd_filters_tl_m = SCMUTEX_INITIALIZER;
/**
* \brief Helper function used internally to add a FG filter
-/* Copyright (C) 2007-2010 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
#include "util-debug.h"
static struct timeval current_time = { 0, 0 };
-//static SCMutex current_time_mutex = PTHREAD_MUTEX_INITIALIZER;
+//static SCMutex current_time_mutex = SCMUTEX_INITIALIZER;
static SCSpinlock current_time_spinlock;
static char live = TRUE;