...
 
Commits (1)
......@@ -88,7 +88,7 @@ static JSBool js_server_get(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
break;
case SERVER_PROP_CLIENTS:
if(p->clients!=NULL)
*vp=UINT_TO_JSVAL(*p->clients);
*vp=UINT_TO_JSVAL(protected_uint32_val(*p->clients));
break;
}
......
......@@ -6021,7 +6021,7 @@ void DLLCALL mail_server(void* arg)
ZERO_VAR(js_server_props);
SAFEPRINTF3(js_server_props.version,"%s %s%c",server_name, VERSION, REVISION);
js_server_props.version_detail=mail_ver();
js_server_props.clients=&active_clients.value;
js_server_props.clients=&active_clients;
js_server_props.options=&startup->options;
js_server_props.interfaces=&startup->interfaces;
......
......@@ -5059,7 +5059,7 @@ void DLLCALL bbs_thread(void* arg)
ZERO_VAR(js_server_props);
SAFEPRINTF3(js_server_props.version,"%s %s%c",TELNET_SERVER,VERSION,REVISION);
js_server_props.version_detail=bbs_ver();
js_server_props.clients=&node_threads_running.value;
js_server_props.clients=&node_threads_running;
js_server_props.options=&startup->options;
js_server_props.interfaces=&startup->telnet_interfaces;
......
......@@ -1227,7 +1227,7 @@ extern "C" {
const char* version_detail;
str_list_t* interfaces;
uint32_t* options;
uint32_t* clients;
protected_uint32_t* clients;
} js_server_props_t;
enum {
......
......@@ -6932,7 +6932,7 @@ void DLLCALL web_server(void* arg)
ZERO_VAR(js_server_props);
SAFEPRINTF3(js_server_props.version,"%s %s%c",server_name, VERSION, REVISION);
js_server_props.version_detail=web_ver();
js_server_props.clients=&active_clients.value;
js_server_props.clients=&active_clients;
js_server_props.options=&startup->options;
js_server_props.interfaces=&startup->interfaces;
......
......@@ -41,8 +41,13 @@
#include "wrapdll.h" /* DLLEXPORT and DLLCALL */
#ifdef __FreeBSD__
#include <stdbool.h>
#ifdef __cplusplus
#include <atomic>
#else
#include <stdatomic.h>
#endif
#endif
#if defined(__cplusplus)
extern "C" {
......@@ -153,10 +158,17 @@ DLLEXPORT int DLLCALL pthread_once(pthread_once_t *oc, void (*init)(void));
/* mutexes. */
/************************************************************************/
#ifdef __FreeBSD__
#ifdef __cplusplus
typedef std::atomic<int32_t> protected_int32_t;
typedef std::atomic<uint32_t> protected_uint32_t;
typedef std::atomic<int64_t> protected_int64_t;
typedef std::atomic<uint64_t> protected_uint64_t;
#else
typedef _Atomic(int32_t) protected_int32_t;
typedef _Atomic(uint32_t) protected_uint32_t;
typedef _Atomic(int64_t) protected_int64_t;
typedef _Atomic(uint64_t) protected_uint64_t;
#endif
DLLEXPORT int DLLCALL protected_uint32_init(protected_uint32_t*, uint32_t value);
DLLEXPORT int DLLCALL protected_uint64_init(protected_uint64_t*, uint64_t value);
......