diff options
3 files changed, 125 insertions, 0 deletions
diff --git a/meta-networking/recipes-support/pgpool2/pgpool2/0001-fix-compiling-on-32-bit-systems.patch b/meta-networking/recipes-support/pgpool2/pgpool2/0001-fix-compiling-on-32-bit-systems.patch new file mode 100644 index 0000000000..cb6da7b08e --- /dev/null +++ b/meta-networking/recipes-support/pgpool2/pgpool2/0001-fix-compiling-on-32-bit-systems.patch | |||
| @@ -0,0 +1,83 @@ | |||
| 1 | From 523ca5546b0178be693943f2a3a880c0bd6ea239 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Gyorgy Sarvari <skandigraun@gmail.com> | ||
| 3 | Date: Thu, 11 Sep 2025 12:36:29 +0200 | ||
| 4 | Subject: [PATCH] fix compiling on 32-bit systems | ||
| 5 | |||
| 6 | The timespec struct's tv_sec size can change between architectures. | ||
| 7 | Usually on 64 bit systems it's long, but on 32 bit systems it is frequently long long. | ||
| 8 | |||
| 9 | When the watchdog is trying to get the uptime, it is trying to get the value | ||
| 10 | as long - however on 32 bit systems this fails due to different time_t size: | ||
| 11 | |||
| 12 | | wd_json_data.c:540:66: error: passing argument 3 of 'json_get_long_value_for_key' from incompatible pointer type [-Wincompatible-pointer-types] | ||
| 13 | | 540 | if (json_get_long_value_for_key(root, "StartupTimeSecs", &wdNode->startup_time.tv_sec)) | ||
| 14 | | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 15 | |||
| 16 | To account for this, introduce a new helper function to get a json value as | ||
| 17 | a time_t type. | ||
| 18 | |||
| 19 | Upstream-Status: Pending [project ML registration is down] | ||
| 20 | |||
| 21 | Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> | ||
| 22 | --- | ||
| 23 | src/include/utils/json.h | 5 +++-- | ||
| 24 | src/utils/json.c | 14 ++++++++++++++ | ||
| 25 | src/watchdog/wd_json_data.c | 2 +- | ||
| 26 | 3 files changed, 18 insertions(+), 3 deletions(-) | ||
| 27 | |||
| 28 | diff --git a/src/include/utils/json.h b/src/include/utils/json.h | ||
| 29 | index 67cc0255a..93be83c3a 100644 | ||
| 30 | --- a/src/include/utils/json.h | ||
| 31 | +++ b/src/include/utils/json.h | ||
| 32 | @@ -311,10 +311,11 @@ extern "C" | ||
| 33 | #endif | ||
| 34 | |||
| 35 | /* pgpool-II extensions */ | ||
| 36 | -json_value *json_get_value_for_key(json_value * source, const char *key); | ||
| 37 | +json_value *json_get_value_for_key(json_value * source, const char *key); | ||
| 38 | int json_get_int_value_for_key(json_value * source, const char *key, int *value); | ||
| 39 | int json_get_long_value_for_key(json_value * source, const char *key, long *value); | ||
| 40 | -char *json_get_string_value_for_key(json_value * source, const char *key); | ||
| 41 | +char *json_get_string_value_for_key(json_value * source, const char *key); | ||
| 42 | int json_get_bool_value_for_key(json_value * source, const char *key, bool *value); | ||
| 43 | +int json_get_time_value_for_key(json_value * source, const char *key, time_t *value); | ||
| 44 | |||
| 45 | #endif | ||
| 46 | diff --git a/src/utils/json.c b/src/utils/json.c | ||
| 47 | index 319c8fdbf..bce99466c 100644 | ||
| 48 | --- a/src/utils/json.c | ||
| 49 | +++ b/src/utils/json.c | ||
| 50 | @@ -1204,6 +1204,20 @@ json_get_long_value_for_key(json_value * source, const char *key, long *value) | ||
| 51 | return 0; | ||
| 52 | } | ||
| 53 | |||
| 54 | +int | ||
| 55 | +json_get_time_value_for_key(json_value * source, const char *key, time_t *value) | ||
| 56 | +{ | ||
| 57 | + json_value *jNode; | ||
| 58 | + | ||
| 59 | + jNode = json_get_value_for_key(source, key); | ||
| 60 | + if (jNode == NULL) | ||
| 61 | + return -1; | ||
| 62 | + if (jNode->type != json_integer) | ||
| 63 | + return -1; | ||
| 64 | + *value = jNode->u.integer; | ||
| 65 | + return 0; | ||
| 66 | +} | ||
| 67 | + | ||
| 68 | /* | ||
| 69 | * pgpool extension: | ||
| 70 | * returns string value if found for the key. | ||
| 71 | diff --git a/src/watchdog/wd_json_data.c b/src/watchdog/wd_json_data.c | ||
| 72 | index 474fc37a4..53053cd4b 100644 | ||
| 73 | --- a/src/watchdog/wd_json_data.c | ||
| 74 | +++ b/src/watchdog/wd_json_data.c | ||
| 75 | @@ -537,7 +537,7 @@ get_watchdog_node_from_json(char *json_data, int data_len, char **authkey) | ||
| 76 | if (root == NULL || root->type != json_object) | ||
| 77 | goto ERROR_EXIT; | ||
| 78 | |||
| 79 | - if (json_get_long_value_for_key(root, "StartupTimeSecs", &wdNode->startup_time.tv_sec)) | ||
| 80 | + if (json_get_time_value_for_key(root, "StartupTimeSecs", &wdNode->startup_time.tv_sec)) | ||
| 81 | { | ||
| 82 | bool escalated; | ||
| 83 | long seconds_since_node_startup; | ||
diff --git a/meta-networking/recipes-support/pgpool2/pgpool2/0001-snprintf-Add-math.h-to-ensure-isnan-and-isinf-are-de.patch b/meta-networking/recipes-support/pgpool2/pgpool2/0001-snprintf-Add-math.h-to-ensure-isnan-and-isinf-are-de.patch new file mode 100644 index 0000000000..335761c9bf --- /dev/null +++ b/meta-networking/recipes-support/pgpool2/pgpool2/0001-snprintf-Add-math.h-to-ensure-isnan-and-isinf-are-de.patch | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | From c0b6ae020ad87040b5bc6fbae94fb815f10884d2 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Gyorgy Sarvari <skandigraun@gmail.com> | ||
| 3 | Date: Thu, 11 Sep 2025 11:58:02 +0200 | ||
| 4 | Subject: [PATCH] snprintf: Add math.h to ensure isnan and isinf are defined | ||
| 5 | |||
| 6 | When building for 32-bit arm arch, compilation fails with the following error: | ||
| 7 | | snprintf.c: In function 'fmtfloat': | ||
| 8 | | snprintf.c:1232:13: error: implicit declaration of function 'isnan' [-Wimplicit-function-declaration] | ||
| 9 | | 1232 | if (isnan(value)) | ||
| 10 | | | ^~~~~ | ||
| 11 | | snprintf.c:50:1: note: include '<math.h>' or provide a declaration of 'isnan' | ||
| 12 | | 49 | #include "postgresql/server/port.h" | ||
| 13 | | +++ |+#include <math.h> | ||
| 14 | | 50 | | ||
| 15 | | snprintf.c:1254:21: error: implicit declaration of function 'isinf' [-Wimplicit-function-declaration] | ||
| 16 | | 1254 | if (isinf(value)) | ||
| 17 | | | ^~~~~ | ||
| 18 | | snprintf.c:1254:21: note: include '<math.h>' or provide a declaration of 'isinf' | ||
| 19 | |||
| 20 | To avoid the error, add math.h to snprintf.c. | ||
| 21 | |||
| 22 | Upstream-Status: Pending [project ML registration is down] | ||
| 23 | |||
| 24 | Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> | ||
| 25 | --- | ||
| 26 | src/parser/snprintf.c | 1 + | ||
| 27 | 1 file changed, 1 insertion(+) | ||
| 28 | |||
| 29 | diff --git a/src/parser/snprintf.c b/src/parser/snprintf.c | ||
| 30 | index 6dd4a50..cce7951 100644 | ||
| 31 | --- a/src/parser/snprintf.c | ||
| 32 | +++ b/src/parser/snprintf.c | ||
| 33 | @@ -36,6 +36,7 @@ | ||
| 34 | #include "c.h" | ||
| 35 | #endif | ||
| 36 | |||
| 37 | +#include <math.h> | ||
| 38 | #include <stdarg.h> | ||
| 39 | #include <stdio.h> | ||
| 40 | #include <stdint.h> | ||
diff --git a/meta-networking/recipes-support/pgpool2/pgpool2_4.5.4.bb b/meta-networking/recipes-support/pgpool2/pgpool2_4.5.4.bb index 706e7360a2..5eb06e0298 100644 --- a/meta-networking/recipes-support/pgpool2/pgpool2_4.5.4.bb +++ b/meta-networking/recipes-support/pgpool2/pgpool2_4.5.4.bb | |||
| @@ -12,6 +12,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=e4b38de086d73e0521de0bbdbaa4a1a9" | |||
| 12 | 12 | ||
| 13 | SRC_URI = "https://www.pgpool.net/mediawiki/images/pgpool-II-${PV}.tar.gz \ | 13 | SRC_URI = "https://www.pgpool.net/mediawiki/images/pgpool-II-${PV}.tar.gz \ |
| 14 | file://0001-Fix-build-error-when-build-this-file.patch \ | 14 | file://0001-Fix-build-error-when-build-this-file.patch \ |
| 15 | file://0001-snprintf-Add-math.h-to-ensure-isnan-and-isinf-are-de.patch \ | ||
| 16 | file://0001-fix-compiling-on-32-bit-systems.patch \ | ||
| 15 | file://define_SIGNAL_ARGS.patch \ | 17 | file://define_SIGNAL_ARGS.patch \ |
| 16 | file://pgpool.sysconfig \ | 18 | file://pgpool.sysconfig \ |
| 17 | file://pgpool.service \ | 19 | file://pgpool.service \ |
