Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AIX 7.x build #80

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions autolib/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ autolib_build() {
pushd ${lib}/build > /dev/null || return $?
autolib_output_banner "${lib}: CMake Build Stage"
# YOU MUST set TEST to 1 in order to build the tests
TEST=$build_test cmake -v .. || {
TEST=$build_test cmake --log-level=VERBOSE .. || {
autolib_output_error "${lib}: CMake Failure"
return 1
}
Expand All @@ -29,4 +29,4 @@ autolib_build() {
return 1
}
popd > /dev/null || return $?
}
}
6 changes: 5 additions & 1 deletion prom/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,11 @@ target_sources(
PRIVATE ${private_files}
)

target_link_libraries(prom PUBLIC Threads::Threads)
if(UNIX AND NOT APPLE)
target_link_libraries(prom PUBLIC Threads::Threads -latomic)
else()
target_link_libraries(prom PUBLIC Threads::Threads )
endif()

if ($ENV{TEST})
include(test/CMakeLists.txt)
Expand Down
4 changes: 2 additions & 2 deletions prom/src/prom_metric_sample.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ int prom_metric_sample_add(prom_metric_sample_t *self, double r_value) {
if (r_value < 0) {
return 1;
}
_Atomic double old = atomic_load(&self->r_value);
double old = atomic_load(&self->r_value);
for (;;) {
_Atomic double new = ATOMIC_VAR_INIT(old + r_value);
if (atomic_compare_exchange_weak(&self->r_value, &old, new)) {
Expand All @@ -78,7 +78,7 @@ int prom_metric_sample_sub(prom_metric_sample_t *self, double r_value) {
PROM_LOG(PROM_METRIC_INCORRECT_TYPE);
return 1;
}
_Atomic double old = atomic_load(&self->r_value);
double old = atomic_load(&self->r_value);
for (;;) {
_Atomic double new = ATOMIC_VAR_INIT(old - r_value);
if (atomic_compare_exchange_weak(&self->r_value, &old, new)) {
Expand Down
10 changes: 10 additions & 0 deletions promhttp/include/promhttp.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@
*/
void promhttp_set_active_collector_registry(prom_collector_registry_t *active_registry);

#if MHD_VERSION >= 0x00097002
#define PROM_MHD_RESULT enum MHD_Result
#else
#define PROM_MHD_RESULT int
#endif

PROM_MHD_RESULT promhttp_handler(void *cls, struct MHD_Connection *connection, const char *url, const char *method,
const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls);


/**
* @brief Starts a daemon in the background and returns a pointer to an HMD_Daemon.
*
Expand Down
3 changes: 2 additions & 1 deletion promhttp/src/promhttp.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include "microhttpd.h"
#include "prom.h"
#include "promhttp.h"

prom_collector_registry_t *PROM_ACTIVE_REGISTRY;

Expand All @@ -29,7 +30,7 @@ void promhttp_set_active_collector_registry(prom_collector_registry_t *active_re
}
}

int promhttp_handler(void *cls, struct MHD_Connection *connection, const char *url, const char *method,
PROM_MHD_RESULT promhttp_handler(void *cls, struct MHD_Connection *connection, const char *url, const char *method,
const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls) {
if (strcmp(method, "GET") != 0) {
char *buf = "Invalid HTTP Method\n";
Expand Down