uint64 definition was not uniform across the code.
#ifndef LIBPCP_EXT_H
#define LIBPCP_EXT_H
+
+#include "pool_type.h"
#include <signal.h>
#include <stdio.h>
+
/*
* startup packet definitions (v2) stolen from PostgreSQL
*/
#define BACKEND_STATUS_CON_UP "up"
#define BACKEND_STATUS_CON_DOWN "down"
+/*
+ * Backend status record file
+ */
+typedef struct {
+ BACKEND_STATUS status[MAX_NUM_BACKENDS];
+} BackendStatusRecord;
+
/*
* PostgreSQL backend descriptor. Placed on shared memory area.
*/
double unnormalized_weight; /* descripted parameter */
char backend_data_directory[MAX_PATH_LENGTH];
unsigned short flag; /* various flags */
- unsigned long long int standby_delay; /* The replication delay against the primary */
+ uint64 standby_delay; /* The replication delay against the primary */
} BackendInfo;
typedef struct {
#include "config.h"
#include "pool_type.h"
+#include "pcp/libpcp_ext.h"
#include "utils/pool_signal.h"
#include "parser/nodes.h"
#ifndef POOL_CONFIG_H
#define POOL_CONFIG_H
+#include "pcp/libpcp_ext.h"
+
/*
* watchdog
*/
#include "config.h"
#include <sys/types.h>
#include <sys/socket.h>
-#include "pcp/libpcp_ext.h"
#include "libpq-fe.h"
/* Define common boolean type. C++ and BEOS already has it so exclude them. */
#ifdef c_plusplus
#ifdef HAVE_LONG_INT_64
/* Plain "long int" fits, use it */
typedef long int int64;
+typedef unsigned long int uint64;
+
#define pool_atoi64 atol
#elif defined(HAVE_LONG_LONG_INT_64)
/* We have working support for "long long int", use that */
typedef long long int int64;
+typedef unsigned long long int uint64;
#define pool_atoi64 atoll
#else
/* neither HAVE_LONG_INT_64 nor HAVE_LONG_LONG_INT_64 */
LOAD_SELECTED
} LOAD_BALANCE_STATUS;
-/*
- * Backend status record file
- */
-typedef struct {
- BACKEND_STATUS status[MAX_NUM_BACKENDS];
-} BackendStatusRecord;
-
extern int assert_enabled;
extern void ExceptionalCondition(const char *conditionName,
const char *errorType,
typedef uint8 bits8; /* >= 8 bits */
typedef uint16 bits16; /* >= 16 bits */
typedef uint32 bits32; /* >= 32 bits */
-typedef unsigned long long int uint64;
/*
* stdint.h limits aren't guaranteed to be present and aren't guaranteed to
i++;
snprintf(status[i].name, POOLCONFIG_MAXNAMELEN, "standby_delay%d", j);
- snprintf(status[i].value, POOLCONFIG_MAXVALLEN, "%lld", BACKEND_INFO(j).standby_delay);
+ snprintf(status[i].value, POOLCONFIG_MAXVALLEN, UINT64_FORMAT, BACKEND_INFO(j).standby_delay);
snprintf(status[i].desc, POOLCONFIG_MAXDESCLEN, "standby delay of backend #%d", j);
i++;
snprintf(nodes[i].port, POOLCONFIG_MAXPORTLEN, "%d", bi->backend_port);
snprintf(nodes[i].status, POOLCONFIG_MAXSTATLEN, "%s", backend_status_to_str(bi->backend_status));
snprintf(nodes[i].lb_weight, POOLCONFIG_MAXWEIGHTLEN, "%f", bi->backend_weight/RAND_MAX);
- snprintf(nodes[i].select, POOLCONFIG_MAXWEIGHTLEN, "%lld", stat_get_select_count(i));
+ snprintf(nodes[i].select, POOLCONFIG_MAXWEIGHTLEN, UINT64_FORMAT, stat_get_select_count(i));
snprintf(nodes[i].load_balance_node, POOLCONFIG_MAXWEIGHTLEN, "%s",
(session_context->load_balance_node_id == i)? "true":"false");