diff options
author | Costa Tsaousis <costa@netdata.cloud> | 2023-01-11 00:33:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-11 00:33:28 +0200 |
commit | 5a815ea424715fea934e7e2f37c98ecf3fb8f4ef (patch) | |
tree | f16ed63712840c2eadf0459f17ff42f46eedcd3c /libnetdata | |
parent | 368a26cfee6887ca0cb2301d93138f63b75e353a (diff) |
pre gcc v5 support and allow building without dbengine (#14239)
* allow spinlock to be compiled with gcc 4.9
* allow compiling without dbengine
Diffstat (limited to 'libnetdata')
-rw-r--r-- | libnetdata/locks/locks.c | 2 | ||||
-rw-r--r-- | libnetdata/locks/locks.h | 4 | ||||
-rw-r--r-- | libnetdata/worker_utilization/worker_utilization.c | 2 |
3 files changed, 5 insertions, 3 deletions
diff --git a/libnetdata/locks/locks.c b/libnetdata/locks/locks.c index 0a9198119b..e73456d706 100644 --- a/libnetdata/locks/locks.c +++ b/libnetdata/locks/locks.c @@ -279,7 +279,7 @@ int __netdata_rwlock_trywrlock(netdata_rwlock_t *rwlock) { // https://www.youtube.com/watch?v=rmGJc9PXpuE&t=41s void netdata_spinlock_init(SPINLOCK *spinlock) { - *spinlock = NETDATA_SPINLOCK_INITIALIZER; + memset(spinlock, 0, sizeof(SPINLOCK)); } void netdata_spinlock_lock(SPINLOCK *spinlock) { diff --git a/libnetdata/locks/locks.h b/libnetdata/locks/locks.h index a04cfdc0f9..34cdb13e7e 100644 --- a/libnetdata/locks/locks.h +++ b/libnetdata/locks/locks.h @@ -16,7 +16,9 @@ typedef struct netdata_spinlock { pid_t locker_pid; #endif } SPINLOCK; -#define NETDATA_SPINLOCK_INITIALIZER (SPINLOCK) { .locked = false } + +#define NETDATA_SPINLOCK_INITIALIZER \ + { .locked = false } void netdata_spinlock_init(SPINLOCK *spinlock); void netdata_spinlock_lock(SPINLOCK *spinlock); diff --git a/libnetdata/worker_utilization/worker_utilization.c b/libnetdata/worker_utilization/worker_utilization.c index afaff209b5..b0dcf034dd 100644 --- a/libnetdata/worker_utilization/worker_utilization.c +++ b/libnetdata/worker_utilization/worker_utilization.c @@ -83,7 +83,7 @@ void worker_register(const char *name) { struct workers_workname *workname = *PValue; if(!workname) { workname = mallocz(sizeof(struct workers_workname)); - workname->spinlock = NETDATA_SPINLOCK_INITIALIZER; + netdata_spinlock_init(&workname->spinlock); workname->base = NULL; *PValue = workname; } |