Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commits (1)
......@@ -225,7 +225,7 @@ static void thread_up(BOOL setuid)
static int32_t thread_down(void)
{
int32_t count = protected_uint32_adjust(&thread_count,-1);
int32_t count = protected_uint32_adjust_fetch(&thread_count,-1);
if(startup!=NULL && startup->thread_up!=NULL)
startup->thread_up(startup->cbdata,FALSE, FALSE);
return count;
......@@ -5002,7 +5002,7 @@ static void ctrl_thread(void* arg)
ftp_close_socket(&tmp_sock,&sess,__LINE__);
{
int32_t clients = protected_uint32_adjust(&active_clients, -1);
int32_t clients = protected_uint32_adjust_fetch(&active_clients, -1);
int32_t threads = thread_down();
update_clients();
......
......@@ -267,7 +267,7 @@ static void thread_up(BOOL setuid)
static int32_t thread_down(void)
{
int32_t count = protected_uint32_adjust(&thread_count,-1);
int32_t count = protected_uint32_adjust_fetch(&thread_count,-1);
if(startup!=NULL && startup->thread_up!=NULL)
startup->thread_up(startup->cbdata,FALSE,FALSE);
return count;
......
......@@ -57,7 +57,7 @@
lprintf(LOG_ERR, "%04d SSH Error %d destroying Cryptlib Session %d from line %d"
, sock, result, session, line);
else {
uint32_t remain = protected_uint32_adjust(&ssh_sessions, -1);
uint32_t remain = protected_uint32_adjust_fetch(&ssh_sessions, -1);
lprintf(LOG_DEBUG, "%04d SSH Cryptlib Session: %d destroyed from line %d (%u remain)"
, sock, session, line, remain);
}
......@@ -4687,7 +4687,7 @@ void node_thread(void* arg)
/* crash here on Aug-4-2015:
node_thread_running already destroyed
bbs_thread() timed out waiting for 1 node thread(s) to terminate */
int32_t remain = protected_uint32_adjust(&node_threads_running, -1);
uint32_t remain = protected_uint32_adjust_fetch(&node_threads_running, -1);
lprintf(LOG_INFO,"Node %d thread terminated (%u node threads remain, %lu clients served)"
,sbbs->cfg.node_num, remain, served);
}
......
......@@ -6687,7 +6687,7 @@ void http_session_thread(void* arg)
RingBufDispose(&session.outbuf);
FREE_AND_NULL(session.subscan);
clients_remain=protected_uint32_adjust(&active_clients, -1);
clients_remain=protected_uint32_adjust_fetch(&active_clients, -1);
update_clients();
client_off(socket);
......
......@@ -168,10 +168,15 @@ typedef std::atomic<uint64_t> protected_uint64_t;
#define protected_int64_init(pval, val) (std::atomic_store<int64_t>(pval, val), 0)
#define protected_uint64_init(pval, val) (std::atomic_store<uint64_t>(pval, val), 0)
#define protected_int32_adjust(pval, adj) (std::atomic_fetch_add<int32_t>(pval, adj) + adj)
#define protected_uint32_adjust(pval, adj) (std::atomic_fetch_add<uint32_t>(pval, adj) + adj)
#define protected_int64_adjust(pval, adj) (std::atomic_fetch_add<int64_t>(pval, adj) + adj)
#define protected_uint64_adjust(pval, adj) (std::atomic_fetch_add<uint64_t>(pval, adj) + adj)
#define protected_int32_adjust(pval, adj) std::atomic_fetch_add<int32_t>(pval, adj)
#define protected_uint32_adjust(pval, adj) std::atomic_fetch_add<uint32_t>(pval, adj)
#define protected_int64_adjust(pval, adj) std::atomic_fetch_add<int64_t>(pval, adj)
#define protected_uint64_adjust(pval, adj) std::atomic_fetch_add<uint64_t>(pval, adj)
#define protected_int32_adjust_fetch(pval, adj) (std::atomic_fetch_add<int32_t>(pval, adj) + adj)
#define protected_uint32_adjust_fetch(pval, adj) (std::atomic_fetch_add<uint32_t>(pval, adj) + adj)
#define protected_int64_adjust_fetch(pval, adj) (std::atomic_fetch_add<int64_t>(pval, adj) + adj)
#define protected_uint64_adjust_fetch(pval, adj) (std::atomic_fetch_add<uint64_t>(pval, adj) + adj)
#define protected_int32_value(val) std::atomic_load<int32_t>(&val)
#define protected_uint32_value(val) std::atomic_load<uint32_t>(&val)
......@@ -188,10 +193,15 @@ typedef _Atomic(uint64_t) protected_uint64_t;
#define protected_int64_init(pval, val) (atomic_init(pval, val), 0)
#define protected_uint64_init(pval, val) (atomic_init(pval, val), 0)
#define protected_int32_adjust(pval, adj) (atomic_fetch_add(pval, adj) + adj)
#define protected_uint32_adjust(pval, adj) (atomic_fetch_add(pval, adj) + adj)
#define protected_int64_adjust(pval, adj) (atomic_fetch_add(pval, adj) + adj)
#define protected_uint64_adjust(pval, adj) (atomic_fetch_add(pval, adj) + adj)
#define protected_int32_adjust(pval, adj) atomic_fetch_add(pval, adj)
#define protected_uint32_adjust(pval, adj) atomic_fetch_add(pval, adj)
#define protected_int64_adjust(pval, adj) atomic_fetch_add(pval, adj)
#define protected_uint64_adjust(pval, adj) atomic_fetch_add(pval, adj)
#define protected_int32_adjust_fetch(pval, adj) (atomic_fetch_add(pval, adj) + adj)
#define protected_uint32_adjust_fetch(pval, adj) (atomic_fetch_add(pval, adj) + adj)
#define protected_int64_adjust_fetch(pval, adj) (atomic_fetch_add(pval, adj) + adj)
#define protected_uint64_adjust_fetch(pval, adj) (atomic_fetch_add(pval, adj) + adj)
#define protected_int32_value(val) atomic_load(&val)
#define protected_uint32_value(val) atomic_load(&val)
......@@ -236,6 +246,11 @@ typedef struct {
#define protected_int64_value(i) protected_int64_adjust(&i,0)
#define protected_uint64_value(i) protected_uint64_adjust(&i,0)
#define protected_int32_adjust_fetch(a, b) protected_int32_adjust(a, b)
#define protected_uint32_adjust_fetch(a, b) protected_uint32_adjust(a, b)
#define protected_int64_adjust_fetch(a, b) protected_int64_adjust(a, b)
#define protected_uint64_adjust_fetch(a, b) protected_uint64_adjust(a, b)
/* Return 0 on success, non-zero on failure (see pthread_mutex_init): */
DLLEXPORT int DLLCALL protected_int32_init(protected_int32_t*, int32_t value);
DLLEXPORT int DLLCALL protected_int64_init(protected_int64_t*, int64_t value);
......