diff --git a/src/app-layer-ftp.c b/src/app-layer-ftp.c index 69ec7fb76ecf..9f7c396fe5ea 100644 --- a/src/app-layer-ftp.c +++ b/src/app-layer-ftp.c @@ -1,4 +1,4 @@ -/* 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 @@ -228,7 +228,7 @@ static int FTPParseResponse(Flow *f, void *ftp_state, AppLayerParserState *pstat } #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 diff --git a/src/app-layer-htp.c b/src/app-layer-htp.c index 4d8462b6db3b..fac1ffae3a96 100644 --- a/src/app-layer-htp.c +++ b/src/app-layer-htp.c @@ -1,4 +1,4 @@ -/* 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 @@ -85,7 +85,7 @@ static SCRadixTree *cfgtree; 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 diff --git a/src/app-layer-parser.c b/src/app-layer-parser.c index 0f1135d6943e..ea5ab61b2291 100644 --- a/src/app-layer-parser.c +++ b/src/app-layer-parser.c @@ -1,4 +1,4 @@ -/* 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 @@ -72,7 +72,7 @@ static AppLayerParserTableElement al_parser_table[MAX_PARSERS]; 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 */ diff --git a/src/detect-luajit.c b/src/detect-luajit.c index 7d7b92bb2d6a..61faf377e30e 100644 --- a/src/detect-luajit.c +++ b/src/detect-luajit.c @@ -119,7 +119,7 @@ void DetectLuajitRegister(void) { * 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) diff --git a/src/source-af-packet.c b/src/source-af-packet.c index 23a8adc91e26..2aefcf6cda98 100644 --- a/src/source-af-packet.c +++ b/src/source-af-packet.c @@ -157,7 +157,7 @@ TmEcode NoAFPSupportExit(ThreadVars *tv, void *initdata, void **data) #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, diff --git a/src/source-pcap.c b/src/source-pcap.c index 041370921681..d3aa1acdad42 100644 --- a/src/source-pcap.c +++ b/src/source-pcap.c @@ -1,4 +1,4 @@ -/* 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 @@ -115,7 +115,7 @@ TmEcode DecodePcap(ThreadVars *, Packet *, void *, PacketQueue *, PacketQueue *) /** 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. diff --git a/src/source-pfring.c b/src/source-pfring.c index d26b0a4714aa..5c7c663b376b 100644 --- a/src/source-pfring.c +++ b/src/source-pfring.c @@ -1,4 +1,4 @@ -/* 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 @@ -115,7 +115,7 @@ TmEcode NoPfringSupportExit(ThreadVars *tv, void *initdata, void **data) #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 diff --git a/src/stream-tcp.c b/src/stream-tcp.c index a30fc1c6d4ab..3c4aeedb56cd 100644 --- a/src/stream-tcp.c +++ b/src/stream-tcp.c @@ -1,4 +1,4 @@ -/* 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 @@ -105,7 +105,7 @@ static int StreamTcpValidateRst(TcpSession * , Packet *); 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 diff --git a/src/stream.c b/src/stream.c index aec247e76056..4c9354ae1ce8 100644 --- a/src/stream.c +++ b/src/stream.c @@ -1,4 +1,4 @@ -/* 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 @@ -43,7 +43,7 @@ static uint16_t toserver_min_chunk_len = 2560; 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) { diff --git a/src/threads.h b/src/threads.h index ad48687c40f3..b07457dd8715 100644 --- a/src/threads.h +++ b/src/threads.h @@ -1,4 +1,4 @@ -/* 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 @@ -104,6 +104,7 @@ enum { #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 diff --git a/src/tm-threads.c b/src/tm-threads.c index 254d4f9eaad2..79efa6d39838 100644 --- a/src/tm-threads.c +++ b/src/tm-threads.c @@ -77,7 +77,7 @@ static int SetCPUAffinity(uint16_t cpu); 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 */ diff --git a/src/util-cuda-handlers.c b/src/util-cuda-handlers.c index 2206e1be0411..79532e5f1e2c 100644 --- a/src/util-cuda-handlers.c +++ b/src/util-cuda-handlers.c @@ -1,4 +1,4 @@ -/* 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 @@ -48,7 +48,7 @@ typedef struct CudaHandlerConfProfile_ { 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), diff --git a/src/util-debug-filters.c b/src/util-debug-filters.c index 6a8b9233dedb..6c06b0af2de3 100644 --- a/src/util-debug-filters.c +++ b/src/util-debug-filters.c @@ -1,4 +1,4 @@ -/* 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 @@ -43,8 +43,8 @@ SCLogFGFilterFile *sc_log_fg_filters[SC_LOG_FILTER_MAX] = { NULL, NULL }; /** * \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 @@ -54,7 +54,7 @@ static SCLogFDFilter *sc_log_fd_filters = NULL; /** * \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 @@ -64,7 +64,7 @@ static SCLogFDFilterThreadList *sc_log_fd_filters_tl = NULL; /** * \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 diff --git a/src/util-time.c b/src/util-time.c index a7a3b4c178a3..a744607d78cf 100644 --- a/src/util-time.c +++ b/src/util-time.c @@ -1,4 +1,4 @@ -/* 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 @@ -29,7 +29,7 @@ #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;