Merge branch 'develop' into binlog_server_mariadb_master_encryption
This commit is contained in:
@ -11,10 +11,10 @@
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include "maxavro.h"
|
||||
#include <maxscale/skygw_utils.h>
|
||||
#include <string.h>
|
||||
#include <maxscale/skygw_debug.h>
|
||||
#include <maxscale/debug.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
#include <errno.h>
|
||||
|
||||
@ -324,7 +324,7 @@ GWBUF* maxavro_record_read_binary(MAXAVRO_FILE *file)
|
||||
{
|
||||
if (ferror(file->file))
|
||||
{
|
||||
char err[STRERROR_BUFLEN];
|
||||
char err[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Failed to read %ld bytes: %d, %s", data_size, errno,
|
||||
strerror_r(errno, err, sizeof(err)));
|
||||
file->last_error = MAXAVRO_ERR_IO;
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "maxavro.h"
|
||||
#include <jansson.h>
|
||||
#include <string.h>
|
||||
#include <maxscale/skygw_debug.h>
|
||||
#include <maxscale/debug.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
|
||||
static const MAXAVRO_SCHEMA_FIELD types[MAXAVRO_TYPE_MAX] =
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <getopt.h>
|
||||
#include <maxscale/skygw_debug.h>
|
||||
#include <maxscale/debug.h>
|
||||
|
||||
static int verbose = 0;
|
||||
static uint64_t seekto = 0;
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _ADMINUSERS_H
|
||||
#define _ADMINUSERS_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_ADMINUSERS_H
|
||||
#define _MAXSCALE_ADMINUSERS_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -24,8 +25,12 @@
|
||||
*
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/dcb.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
#define ADMIN_SALT "$1$MXS"
|
||||
|
||||
/* Max length of fields in for admin users */
|
||||
@ -63,4 +68,6 @@ extern bool admin_verify_inet_user(const char *uname, const char *passwor
|
||||
|
||||
extern void dcb_PrintAdminUsers(DCB *dcb);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,3 +1,4 @@
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_ALLOC_H
|
||||
#define _MAXSCALE_ALLOC_H
|
||||
/*
|
||||
@ -13,11 +14,11 @@
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <maxscale/skygw_debug.h>
|
||||
|
||||
EXTERN_C_BLOCK_BEGIN
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
/*
|
||||
* NOTE: Do not use these functions directly, use the macros below.
|
||||
@ -77,6 +78,6 @@ char *mxs_strndup_a(const char *s, size_t n/*, const char *caller*/);
|
||||
*/
|
||||
#define MXS_ABORT_IF_FALSE(b) do { if (!b) { abort(); } } while (false)
|
||||
|
||||
EXTERN_C_BLOCK_END
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _ATOMIC_H
|
||||
#define _ATOMIC_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_ATOMIC_H
|
||||
#define _MAXSCALE_ATOMIC_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -26,9 +27,13 @@
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" int atomic_add(int *variable, int value);
|
||||
#else
|
||||
extern int atomic_add(int *variable, int value);
|
||||
#endif
|
||||
#include <maxscale/cdefs.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
int atomic_add(int *variable, int value);
|
||||
int atomic_add(int *variable, int value);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _BUFFER_H
|
||||
#define _BUFFER_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_BUFFER_H
|
||||
#define _MAXSCALE_BUFFER_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -42,13 +43,15 @@
|
||||
*
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <string.h>
|
||||
#include <maxscale/skygw_debug.h>
|
||||
#include <maxscale/debug.h>
|
||||
#include <maxscale/hint.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <stdint.h>
|
||||
|
||||
EXTERN_C_BLOCK_BEGIN
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* Buffer properties - used to store properties related to the buffer
|
||||
@ -214,7 +217,7 @@ void* gwbuf_get_buffer_object_data(GWBUF* buf, bufobj_id_t id)
|
||||
#if defined(BUFFER_TRACE)
|
||||
extern void dprintAllBuffers(void *pdcb);
|
||||
#endif
|
||||
EXTERN_C_BLOCK_END
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
76
include/maxscale/cdefs.h
Normal file
76
include/maxscale/cdefs.h
Normal file
@ -0,0 +1,76 @@
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_CDEFS_H
|
||||
#define _MAXSCALE_CDEFS_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file cdefs.h
|
||||
*
|
||||
* This file has several purposes.
|
||||
*
|
||||
* - Its purpose is the same as that of x86_64-linux-gnu/sys/cdefs.h, that is,
|
||||
* it defines things that are dependent upon the compilation environment.
|
||||
* - Since this *must* be included as the very first header by all other MaxScale
|
||||
* headers, it allows you to redfine things globally, should that be necessary,
|
||||
* for instance, when debugging something.
|
||||
* - Global constants applicable across the line can be defined here.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
# define MXS_BEGIN_DECLS extern "C" {
|
||||
# define MXS_END_DECLS }
|
||||
#else
|
||||
# define MXS_BEGIN_DECLS
|
||||
# define MXS_END_DECLS
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Define intended for use with strerror.
|
||||
*
|
||||
* char errbuf[MXS_STRERROR_BUFLEN];
|
||||
* strerror_r(errno, errbuf, sizeof(errbuf))
|
||||
*/
|
||||
#define MXS_STRERROR_BUFLEN 512
|
||||
|
||||
/**
|
||||
* Returns the smaller of two items.
|
||||
*
|
||||
* @param a A value.
|
||||
* @param b Another value.
|
||||
*
|
||||
* @return a if a is smaller than b, b otherwise.
|
||||
*
|
||||
* @note This a macro, so the arguments will be evaluated more than once.
|
||||
*/
|
||||
#define MXS_MIN(a,b) ((a)<(b) ? (a) : (b))
|
||||
|
||||
/**
|
||||
* Returns the larger of two items.
|
||||
*
|
||||
* @param a A value.
|
||||
* @param b Another value.
|
||||
*
|
||||
* @return a if a is larger than b, b otherwise.
|
||||
*
|
||||
* @note This a macro, so the arguments will be evaluated more than once.
|
||||
*/
|
||||
#define MXS_MAX(a,b) ((a)>(b) ? (a) : (b))
|
||||
|
||||
/**
|
||||
* COMMON INCLUDE FILES
|
||||
*/
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#endif
|
@ -1,3 +1,4 @@
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_CONFIG_H
|
||||
#define _MAXSCALE_CONFIG_H
|
||||
/*
|
||||
@ -12,11 +13,7 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#include <maxscale/skygw_utils.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <stdint.h>
|
||||
#include <openssl/sha.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
|
||||
/**
|
||||
* @file config.h The configuration handling elements
|
||||
*
|
||||
@ -33,6 +30,14 @@
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <stdint.h>
|
||||
#include <openssl/sha.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
#define DEFAULT_NBPOLLS 3 /**< Default number of non block polls before we block */
|
||||
#define DEFAULT_POLLSLEEP 1000 /**< Default poll wait time (milliseconds) */
|
||||
#define _RELEASE_STR_LENGTH 256 /**< release len */
|
||||
@ -160,4 +165,6 @@ int config_truth_value(char *);
|
||||
void free_config_parameter(CONFIG_PARAMETER* p1);
|
||||
bool is_internal_service(const char *router);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _DBUSERS_H
|
||||
#define _DBUSERS_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_DBUSERS_H
|
||||
#define _MAXSCALE_DBUSERS_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -13,10 +14,6 @@
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#include <maxscale/service.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
|
||||
/**
|
||||
* @file dbusers.h Extarct user information form the backend database
|
||||
*
|
||||
@ -33,6 +30,12 @@
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/service.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
/* Refresh rate limits for load users from database */
|
||||
#define USERS_REFRESH_TIME 30 /* Allowed time interval (in seconds) after last update*/
|
||||
#define USERS_REFRESH_MAX_PER_TIME 4 /* Max number of load calls within the time interval */
|
||||
@ -77,4 +80,6 @@ extern char *mysql_users_fetch(USERS *users, MYSQL_USER_HOST *key);
|
||||
extern int reload_mysql_users(SERV_LISTENER *listener);
|
||||
extern int replace_mysql_users(SERV_LISTENER *listener);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _DCB_H
|
||||
#define _DCB_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_DCB_H
|
||||
#define _MAXSCALE_DCB_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -12,23 +13,6 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <maxscale/buffer.h>
|
||||
#include <maxscale/listmanager.h>
|
||||
#include <maxscale/gw_protocol.h>
|
||||
#include <maxscale/gw_authenticator.h>
|
||||
#include <maxscale/gw_ssl.h>
|
||||
#include <maxscale/modinfo.h>
|
||||
#include <maxscale/gwbitmask.h>
|
||||
#include <maxscale/skygw_utils.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#define ERRHANDLE
|
||||
|
||||
struct session;
|
||||
struct server;
|
||||
struct service;
|
||||
struct servlistener;
|
||||
|
||||
/**
|
||||
* @file dcb.h The Descriptor Control Block
|
||||
@ -63,6 +47,26 @@ struct servlistener;
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <maxscale/buffer.h>
|
||||
#include <maxscale/listmanager.h>
|
||||
#include <maxscale/gw_protocol.h>
|
||||
#include <maxscale/gw_authenticator.h>
|
||||
#include <maxscale/gw_ssl.h>
|
||||
#include <maxscale/modinfo.h>
|
||||
#include <maxscale/gwbitmask.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
#define ERRHANDLE
|
||||
|
||||
struct session;
|
||||
struct server;
|
||||
struct service;
|
||||
struct servlistener;
|
||||
|
||||
struct dcb;
|
||||
|
||||
/**
|
||||
@ -369,4 +373,7 @@ void dcb_append_readqueue(DCB *dcb, GWBUF *buffer);
|
||||
|
||||
#define DCB_IS_CLONE(d) ((d)->flags & DCBF_CLONE)
|
||||
#define DCB_REPLIED(d) ((d)->flags & DCBF_REPLIED)
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif /* _DCB_H */
|
||||
|
@ -1,3 +1,6 @@
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_DEBUG_H
|
||||
#define _MAXSCALE_DEBUG_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -11,29 +14,15 @@
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
|
||||
#define __USE_UNIX98 1
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
#include <stdbool.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
|
||||
#if !defined(SKYGW_DEBUG_H)
|
||||
#define SKYGW_DEBUG_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN_C_BLOCK_BEGIN extern "C" {
|
||||
#define EXTERN_C_BLOCK_END }
|
||||
#define EXTERN_C_FUNC extern "C"
|
||||
#else
|
||||
#define EXTERN_C_BLOCK_BEGIN
|
||||
#define EXTERN_C_BLOCK_END
|
||||
#define EXTERN_C_FUNC
|
||||
#endif
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
#if defined(SS_DEBUG)
|
||||
# define SS_PROF
|
||||
@ -578,4 +567,6 @@ typedef enum skygw_chk_t
|
||||
static bool conn_open[10240];
|
||||
#endif /* FAKE_CODE */
|
||||
|
||||
#endif /* SKYGW_DEBUG_H */
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
@ -1,5 +1,6 @@
|
||||
#ifndef _EXTERN_CMD_HG
|
||||
#define _EXTERN_CMD_HG
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_EXTERN_CMD_HG
|
||||
#define _MAXSCALE_EXTERN_CMD_HG
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -13,13 +14,15 @@
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <maxscale/skygw_utils.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
#include <maxscale/pcre2.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
#define MAXSCALE_EXTCMD_ARG_MAX 256
|
||||
|
||||
typedef struct extern_cmd_t
|
||||
@ -38,4 +41,6 @@ bool externcmd_substitute_arg(EXTERNCMD* cmd, const char* re, const char* replac
|
||||
bool externcmd_can_execute(const char* argstr);
|
||||
bool externcmd_matches(const EXTERNCMD* cmd, const char* match);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _FILTER_H
|
||||
#define _FILTER_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_FILTER_H
|
||||
#define _MAXSCALE_FILTER_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -22,11 +23,15 @@
|
||||
* 27/05/2014 Mark Riddoch Initial implementation
|
||||
*
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/session.h>
|
||||
#include <maxscale/buffer.h>
|
||||
#include <stdint.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* The FILTER handle points to module specific data, so the best we can do
|
||||
* is to make it a void * externally.
|
||||
@ -116,4 +121,6 @@ void dprintAllFilters(DCB *);
|
||||
void dprintFilter(DCB *, FILTER_DEF *);
|
||||
void dListFilters(DCB *);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _GW_HG
|
||||
#define _GW_HG
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_GW_HG
|
||||
#define _MAXSCALE_GW_HG
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -13,7 +14,7 @@
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
@ -35,6 +36,8 @@
|
||||
#include <stdbool.h>
|
||||
#include <maxscale/gwdirs.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
#define EXIT_FAILURE 1
|
||||
|
||||
// network buffer is 32K
|
||||
@ -83,4 +86,7 @@ char* get_libdir();
|
||||
long get_processor_count();
|
||||
void clean_up_pathname(char *path);
|
||||
bool mxs_mkdir_all(const char *path, int mask);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef GW_AUTHENTICATOR_H
|
||||
#define GW_AUTHENTICATOR_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_GW_AUTHENTICATOR_H
|
||||
#define _MAXSCALE_GW_AUTHENTICATOR_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -14,7 +15,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file protocol.h
|
||||
* @file gw_authenticator.h
|
||||
*
|
||||
* The authenticator module interface definitions for MaxScale
|
||||
*
|
||||
@ -27,12 +28,15 @@
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/buffer.h>
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/dh.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
/** Maximum number of authenticator options */
|
||||
#define AUTHENTICATOR_MAX_OPTIONS 256
|
||||
|
||||
@ -134,5 +138,7 @@ typedef enum
|
||||
bool authenticator_init(void **instance, const char *authenticator, const char *options);
|
||||
char* get_default_authenticator(const char *protocol);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif /* GW_AUTHENTICATOR_H */
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef GW_PROTOCOL_H
|
||||
#define GW_PROTOCOL_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_GW_PROTOCOL_H
|
||||
#define _MAXSCALE_GW_PROTOCOL_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -28,8 +29,11 @@
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/buffer.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
struct dcb;
|
||||
struct server;
|
||||
struct session;
|
||||
@ -81,6 +85,7 @@ typedef struct gw_protocol
|
||||
*/
|
||||
#define GWPROTOCOL_VERSION {1, 1, 0}
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif /* GW_PROTOCOL_H */
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _GW_SSL_H
|
||||
#define _GW_SSL_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_GW_SSL_H
|
||||
#define _MAXSCALE_GW_SSL_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -27,12 +28,15 @@
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/gw_protocol.h>
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/dh.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
struct dcb;
|
||||
|
||||
typedef enum ssl_method_type
|
||||
@ -78,4 +82,6 @@ bool ssl_required_by_dcb(struct dcb *dcb);
|
||||
bool ssl_required_but_not_negotiated(struct dcb *dcb);
|
||||
const char* ssl_method_type_to_string(ssl_method_type_t method_type);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif /* _GW_SSL_H */
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _GWBITMASK_H
|
||||
#define _GWBITMASK_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_GWBITMASK_H
|
||||
#define _MAXSCALE_GWBITMASK_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -13,9 +14,6 @@
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <maxscale/limits.h>
|
||||
|
||||
/**
|
||||
* @file gwbitmask.h An implementation of an arbitrarily long bitmask
|
||||
*
|
||||
@ -29,6 +27,12 @@
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <maxscale/limits.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
/* This number MUST an be exact multiple of 8 */
|
||||
#define MXS_BITMASK_LENGTH (MXS_MAX_THREADS + 1) /**< Number of bits in the bitmask */
|
||||
|
||||
@ -55,4 +59,6 @@ extern int bitmask_isallclear(GWBITMASK *);
|
||||
extern void bitmask_copy(GWBITMASK *, GWBITMASK *);
|
||||
extern char *bitmask_render_readable(GWBITMASK *);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _GW_DIRS_HG
|
||||
#define _GW_DIRS_HG
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_GW_DIRS_HG
|
||||
#define _MAXSCALE_GW_DIRS_HG
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -15,11 +16,12 @@
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE 1
|
||||
#endif
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <maxscale/skygw_utils.h>
|
||||
|
||||
EXTERN_C_BLOCK_BEGIN
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* All of the following DEFAULT_* variables are defined in cmake/install_layout.cmake
|
||||
@ -76,6 +78,6 @@ char* get_logdir();
|
||||
char* get_langdir();
|
||||
char* get_execdir();
|
||||
|
||||
EXTERN_C_BLOCK_END
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _HASTABLE_H
|
||||
#define _HASTABLE_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_HASTABLE_H
|
||||
#define _MAXSCALE_HASTABLE_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -28,10 +29,11 @@
|
||||
*
|
||||
* @endverbatim
|
||||
*/
|
||||
#include <maxscale/skygw_debug.h>
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/debug.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
|
||||
EXTERN_C_BLOCK_BEGIN
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* The entries within a hashtable.
|
||||
@ -150,6 +152,6 @@ extern int hashtable_item_strcmp(const void* str1, const void* str2);
|
||||
extern void* hashtable_item_strdup(const void *str);
|
||||
extern int hashtable_item_strhash(const void *str);
|
||||
|
||||
EXTERN_C_BLOCK_END
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _HINT_H
|
||||
#define _HINT_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_HINT_H
|
||||
#define _MAXSCALE_HINT_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -25,8 +26,10 @@
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/skygw_debug.h>
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/debug.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* The types of hint that are supported by the generic hinting mechanism.
|
||||
@ -63,4 +66,7 @@ extern HINT *hint_create_route(HINT *, HINT_TYPE, char *);
|
||||
extern void hint_free(HINT *);
|
||||
extern HINT *hint_dup(HINT *);
|
||||
bool hint_exists(HINT **, HINT_TYPE);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _HK_HEARTBEAT_H
|
||||
#define _HK_HEARTBEAT_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_HK_HEARTBEAT_H
|
||||
#define _MAXSCALE_HK_HEARTBEAT_H
|
||||
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
@ -14,6 +15,10 @@
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* The global housekeeper heartbeat value. This value is incremented
|
||||
* every 100 milliseconds and may be used for crude timing etc.
|
||||
@ -21,4 +26,6 @@
|
||||
|
||||
extern long hkheartbeat;
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _HOUSEKEEPER_H
|
||||
#define _HOUSEKEEPER_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_HOUSEKEEPER_H
|
||||
#define _MAXSCALE_HOUSEKEEPER_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -12,9 +13,14 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <time.h>
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/hk_heartbeat.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* @file housekeeper.h A mechanism to have task run periodically
|
||||
*
|
||||
@ -54,4 +60,6 @@ extern int hktask_remove(const char *name);
|
||||
extern void hkshutdown();
|
||||
extern void hkshow_tasks(DCB *pdcb);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,3 +1,4 @@
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_LIMITS_H
|
||||
#define _MAXSCALE_LIMITS_H
|
||||
/*
|
||||
@ -13,6 +14,10 @@
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
// This file defines hard limits of MaxScale.
|
||||
|
||||
// Thread information is stored in a bitmask whose size must be a
|
||||
@ -21,4 +26,6 @@
|
||||
// multiple of 8 minus 1.
|
||||
#define MXS_MAX_THREADS 255
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _LISTENER_H
|
||||
#define _LISTENER_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_LISTENER_H
|
||||
#define _MAXSCALE_LISTENER_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -27,10 +28,13 @@
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/gw_protocol.h>
|
||||
#include <maxscale/gw_ssl.h>
|
||||
#include <maxscale/hashtable.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
struct dcb;
|
||||
struct service;
|
||||
|
||||
@ -65,4 +69,6 @@ int listener_set_ssl_version(SSL_LISTENER *ssl_listener, char* version);
|
||||
void listener_set_certificates(SSL_LISTENER *ssl_listener, char* cert, char* key, char* ca_cert);
|
||||
int listener_init_SSL(SSL_LISTENER *ssl_listener);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _LISTMANAGER_H
|
||||
#define _LISTMANAGER_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_LISTMANAGER_H
|
||||
#define _MAXSCALE_LISTMANAGER_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -26,8 +27,11 @@
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <maxscale/skygw_debug.h>
|
||||
#include <maxscale/debug.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
struct dcb;
|
||||
|
||||
@ -115,5 +119,6 @@ void list_map(LIST_CONFIG *list_config, bool (*callback)(void *, ...));
|
||||
list_entry_t *list_remove_first(LIST_CONFIG *list_config);
|
||||
list_entry_t *list_remove_last(LIST_CONFIG *list_config);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif /* LISTMANAGER_H */
|
||||
|
@ -1,3 +1,6 @@
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_LOG_MANAGER_H
|
||||
#define _MAXSCALE_LOG_MANAGER_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -10,23 +13,13 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#if !defined(LOG_MANAGER_H)
|
||||
#define LOG_MANAGER_H
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <stdbool.h>
|
||||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* We need a common.h file that is included by every component.
|
||||
*/
|
||||
#if !defined(STRERROR_BUFLEN)
|
||||
#define STRERROR_BUFLEN 512
|
||||
#endif
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* If MXS_MODULE_NAME is defined before log_manager.h is included, then all
|
||||
@ -195,8 +188,6 @@ enum
|
||||
trailing NULL. If longer, it will be cut. */
|
||||
};
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif /** LOG_MANAGER_H */
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _MAXADMIN_H
|
||||
#define _MAXADMIN_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_MAXADMIN_H
|
||||
#define _MAXSCALE_MAXADMIN_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -13,6 +14,10 @@
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
#define MAXADMIN_DEFAULT_SOCKET "/tmp/maxadmin.sock"
|
||||
|
||||
#define MAXADMIN_CONFIG_DEFAULT_SOCKET_TAG_LEN 7
|
||||
@ -28,4 +33,6 @@
|
||||
#define MAXADMIN_AUTH_PASSWORD_PROMPT "PASSWORD"
|
||||
#define MAXADMIN_AUTH_PASSWORD_PROMPT_LEN 8
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _MAXSCALE_H
|
||||
#define _MAXSCALE_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_MAXSCALE_H
|
||||
#define _MAXSCALE_MAXSCALE_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -27,8 +28,10 @@
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <time.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
/* Exit status for MaxScale */
|
||||
#define MAXSCALE_SHUTDOWN 0 /* Good shutdown */
|
||||
@ -43,4 +46,6 @@ void maxscale_reset_starttime(void);
|
||||
time_t maxscale_started(void);
|
||||
int maxscale_uptime(void);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _MEMLOG_H
|
||||
#define _MEMLOG_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_MEMLOG_H
|
||||
#define _MAXSCALE_MEMLOG_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -24,8 +25,12 @@
|
||||
*
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
typedef enum { ML_INT, ML_LONG, ML_LONGLONG, ML_STRING } MEMLOGTYPE;
|
||||
|
||||
typedef struct memlog
|
||||
@ -59,4 +64,6 @@ extern void memlog_log(MEMLOG *, void *);
|
||||
extern void memlog_flush_all();
|
||||
extern void memlog_flush(MEMLOG *);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _MODINFO_H
|
||||
#define _MODINFO_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_MODINFO_H
|
||||
#define _MAXSCALE_MODINFO_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -25,6 +26,10 @@
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* The status of the module. This gives some idea of the module
|
||||
* maturity.
|
||||
@ -83,4 +88,7 @@ typedef struct
|
||||
MODULE_VERSION api_version;
|
||||
char *description;
|
||||
} MODULE_INFO;
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _MODULES_H
|
||||
#define _MODULES_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_MODULES_H
|
||||
#define _MAXSCALE_MODULES_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -12,12 +13,6 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/modinfo.h>
|
||||
#include <maxscale/resultset.h>
|
||||
#include <maxscale/skygw_debug.h>
|
||||
|
||||
EXTERN_C_BLOCK_BEGIN
|
||||
|
||||
/**
|
||||
* @file modules.h Utilities for loading modules
|
||||
@ -38,6 +33,14 @@ EXTERN_C_BLOCK_BEGIN
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/modinfo.h>
|
||||
#include <maxscale/resultset.h>
|
||||
#include <maxscale/debug.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
typedef struct modules
|
||||
{
|
||||
char *module; /**< The name of the module */
|
||||
@ -71,6 +74,6 @@ extern RESULTSET *moduleGetList();
|
||||
extern void module_feedback_send(void*);
|
||||
extern void moduleShowFeedbackReport(DCB *dcb);
|
||||
|
||||
EXTERN_C_BLOCK_END
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _MODUTIL_H
|
||||
#define _MODUTIL_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_MODUTIL_H
|
||||
#define _MAXSCALE_MODUTIL_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -26,11 +27,15 @@
|
||||
*
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/buffer.h>
|
||||
#include <maxscale/dcb.h>
|
||||
#include <string.h>
|
||||
#include <maxscale/pcre2.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
#define PTR_IS_RESULTSET(b) (b[0] == 0x01 && b[1] == 0x0 && b[2] == 0x0 && b[3] == 0x01)
|
||||
#define PTR_IS_EOF(b) (b[0] == 0x05 && b[1] == 0x0 && b[2] == 0x0 && b[4] == 0xfe)
|
||||
#define PTR_IS_OK(b) (b[4] == 0x00)
|
||||
@ -70,4 +75,6 @@ bool is_mysql_statement_end(const char* start, int len);
|
||||
bool is_mysql_sp_end(const char* start, int len);
|
||||
char* modutil_get_canonical(GWBUF* querybuf);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _MONITOR_H
|
||||
#define _MONITOR_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_MONITOR_H
|
||||
#define _MAXSCALE_MONITOR_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -12,14 +13,6 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#include <mysql.h>
|
||||
#include <maxscale/server.h>
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
#include <maxscale/resultset.h>
|
||||
#include <maxscale/config.h>
|
||||
#include <maxscale/externcmd.h>
|
||||
#include <maxscale/secrets.h>
|
||||
|
||||
/**
|
||||
* @file monitor.h The interface to the monitor module
|
||||
@ -43,6 +36,18 @@
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <mysql.h>
|
||||
#include <maxscale/server.h>
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
#include <maxscale/resultset.h>
|
||||
#include <maxscale/config.h>
|
||||
#include <maxscale/externcmd.h>
|
||||
#include <maxscale/secrets.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* The "Module Object" for a monitor module.
|
||||
*
|
||||
@ -226,4 +231,6 @@ connect_result_t mon_connect_to_db(MONITOR* mon, MONITOR_SERVERS *database);
|
||||
void mon_log_connect_error(MONITOR_SERVERS* database, connect_result_t rval);
|
||||
void mon_log_state_change(MONITOR_SERVERS *ptr);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef MYSQL_BINLOG_H
|
||||
#define MYSQL_BINLOG_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_MYSQL_BINLOG_H
|
||||
#define _MAXSCALE_MYSQL_BINLOG_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -17,10 +18,13 @@
|
||||
* @file mysql_binlog.h - Extracting information from binary logs
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <time.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
/** Maximum GTID string length */
|
||||
#define GTID_MAX_LEN 64
|
||||
|
||||
@ -91,4 +95,6 @@ uint64_t unpack_bit(uint8_t *ptr, uint8_t *null_mask, uint32_t col_count,
|
||||
|
||||
void format_temporal_value(char *str, size_t size, uint8_t type, struct tm *tm);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif /* MYSQL_BINLOG_H */
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _MYSQL_UTILS_H
|
||||
#define _MYSQL_UTILS_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_MYSQL_UTILS_H
|
||||
#define _MAXSCALE_MYSQL_UTILS_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -13,11 +14,14 @@
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <mysql.h>
|
||||
#include <maxscale/server.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
/** Length-encoded integers */
|
||||
size_t leint_bytes(uint8_t* ptr);
|
||||
uint64_t leint_value(uint8_t* c);
|
||||
@ -27,7 +31,8 @@ uint64_t leint_consume(uint8_t ** c);
|
||||
char* lestr_consume_dup(uint8_t** c);
|
||||
char* lestr_consume(uint8_t** c, size_t *size);
|
||||
|
||||
|
||||
MYSQL *mxs_mysql_real_connect(MYSQL *mysql, SERVER *server, const char *user, const char *passwd);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _NOTIFICATION_SERVICE_H
|
||||
#define _NOTIFICATION_SERVICE_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_NOTIFICATION_H
|
||||
#define _MAXSCALE_NOTIFICATION_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -27,6 +28,10 @@
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
#define _NOTIFICATION_CONNECT_TIMEOUT 30
|
||||
#define _NOTIFICATION_OPERATION_TIMEOUT 30
|
||||
#define _NOTIFICATION_SEND_PENDING 0
|
||||
@ -57,4 +62,7 @@ typedef struct
|
||||
extern char *gw_bin2hex(char *out, const uint8_t *in, unsigned int len);
|
||||
extern void gw_sha1_str(const uint8_t *in, int in_len, uint8_t *out);
|
||||
extern FEEDBACK_CONF * config_get_feedback_data();
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,3 +1,4 @@
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_PCRE2_H
|
||||
#define _MAXSCALE_PCRE2_H
|
||||
/*
|
||||
@ -14,12 +15,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PCRE2_CODE_UNIT_WIDTH
|
||||
#define PCRE2_CODE_UNIT_WIDTH 8
|
||||
#endif
|
||||
|
||||
#include <pcre2.h>
|
||||
|
||||
/**
|
||||
* @file pcre2.h - Utility functions for regular expression matching
|
||||
* with the bundled PCRE2 library.
|
||||
@ -32,6 +27,16 @@
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
|
||||
#ifndef PCRE2_CODE_UNIT_WIDTH
|
||||
#define PCRE2_CODE_UNIT_WIDTH 8
|
||||
#endif
|
||||
|
||||
#include <pcre2.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MXS_PCRE2_MATCH,
|
||||
@ -44,4 +49,6 @@ mxs_pcre2_result_t mxs_pcre2_substitute(pcre2_code *re, const char *subject,
|
||||
mxs_pcre2_result_t mxs_pcre2_simple_match(const char* pattern, const char* subject,
|
||||
int options, int* error);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _PLATFORM_H
|
||||
#define _PLATFORM_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_PLATFORM_H
|
||||
#define _MAXSCALE_PLATFORM_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -13,6 +14,10 @@
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
#if !defined(__cplusplus)
|
||||
|
||||
#if __STDC_VERSION__ >= 201112
|
||||
@ -48,4 +53,6 @@
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif // _PLATFORM_H
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _POLL_H
|
||||
#define _POLL_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_POLL_H
|
||||
#define _MAXSCALE_POLL_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -12,10 +13,6 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/gwbitmask.h>
|
||||
#include <maxscale/resultset.h>
|
||||
#include <sys/epoll.h>
|
||||
|
||||
/**
|
||||
* @file poll.h The poll related functionality
|
||||
@ -29,6 +26,15 @@
|
||||
*
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/gwbitmask.h>
|
||||
#include <maxscale/resultset.h>
|
||||
#include <sys/epoll.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
#define MAX_EVENTS 1000
|
||||
|
||||
/**
|
||||
@ -67,4 +73,7 @@ extern void poll_fake_event(DCB *dcb, enum EPOLL_EVENTS ev);
|
||||
extern void poll_fake_hangup_event(DCB *dcb);
|
||||
extern void poll_fake_write_event(DCB *dcb);
|
||||
extern void poll_fake_read_event(DCB *dcb);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -36,6 +36,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
@ -65,6 +66,8 @@
|
||||
#include <maxscale/gw.h>
|
||||
#include <mysql.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
#define GW_MYSQL_VERSION "5.5.5-10.0.0 " MAXSCALE_VERSION "-maxscale"
|
||||
#define GW_MYSQL_LOOP_TIMEOUT 300000000
|
||||
#define GW_MYSQL_READ 0
|
||||
@ -373,4 +376,6 @@ int mxs_mysql_send_ok(DCB *dcb, int sequence, int affected_rows, const char* mes
|
||||
/** Check for OK packet */
|
||||
bool mxs_mysql_is_ok_packet(GWBUF *buffer);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif /** _MYSQL_PROTOCOL_H */
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef QUERY_CLASSIFIER_HG
|
||||
#define QUERY_CLASSIFIER_HG
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_QUERY_CLASSIFIER_HG
|
||||
#define _MAXSCALE_QUERY_CLASSIFIER_HG
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -13,10 +14,10 @@
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#include <maxscale/skygw_utils.h>
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/buffer.h>
|
||||
|
||||
EXTERN_C_BLOCK_BEGIN
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
typedef enum
|
||||
{
|
||||
@ -130,6 +131,6 @@ struct query_classifier
|
||||
|
||||
#define QUERY_CLASSIFIER_VERSION {1, 0, 0}
|
||||
|
||||
EXTERN_C_BLOCK_END
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _QUEUEMANAGER_H
|
||||
#define _QUEUEMANAGER_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_QUEUEMANAGER_H
|
||||
#define _MAXSCALE_QUEUEMANAGER_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -26,9 +27,12 @@
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <stdbool.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
#define CONNECTION_QUEUE_LIMIT 1000
|
||||
|
||||
typedef struct queue_entry
|
||||
@ -67,4 +71,6 @@ mxs_queue_count(QUEUE_CONFIG *queue_config)
|
||||
return count < 0 ? (count + queue_config->queue_limit + 1): count;
|
||||
}
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif /* QUEUEMANAGER_H */
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef RANDOM_JKISS_H
|
||||
#define RANDOM_JKISS_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_RANDOM_JKISS_H
|
||||
#define _MAXSCALE_RANDOM_JKISS_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -20,14 +21,12 @@
|
||||
* Created on 26 August 2015, 15:34
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include <maxscale/cdefs.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
extern unsigned int random_jkiss(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif /* RANDOM_H */
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _RDTSC_H
|
||||
#define _RDTSC_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_RDTSC_H
|
||||
#define _MAXSCALE_RDTSC_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -31,6 +32,10 @@
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
typedef unsigned long long CYCLES;
|
||||
|
||||
/**
|
||||
@ -53,4 +58,7 @@ static __inline__ CYCLES rdtsc(void)
|
||||
__asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
|
||||
return x;
|
||||
}
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _RESULTSET_H
|
||||
#define _RESULTSET_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_RESULTSET_H
|
||||
#define _MAXSCALE_RESULTSET_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -24,8 +25,11 @@
|
||||
*
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/dcb.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* Column types
|
||||
@ -85,4 +89,6 @@ extern int resultset_row_set(RESULT_ROW *, int, const char *);
|
||||
extern void resultset_stream_mysql(RESULTSET *, DCB *);
|
||||
extern void resultset_stream_json(RESULTSET *, DCB *);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _ROUTER_H
|
||||
#define _ROUTER_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_ROUTER_H
|
||||
#define _MAXSCALE_ROUTER_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -27,11 +28,15 @@
|
||||
* 27/10/2015 Martin Brampton Add RCAP_TYPE_NO_RSESSION
|
||||
*
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/service.h>
|
||||
#include <maxscale/session.h>
|
||||
#include <maxscale/buffer.h>
|
||||
#include <stdint.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* The ROUTER handle points to module specific data, so the best we can do
|
||||
* is to make it a void * externally.
|
||||
@ -100,6 +105,6 @@ typedef enum router_capability_t
|
||||
users when the service is started */
|
||||
} router_capability_t;
|
||||
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _SECRETS_H
|
||||
#define _SECRETS_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_SECRETS_H
|
||||
#define _MAXSCALE_SECRETS_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -25,6 +26,7 @@
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@ -32,9 +34,10 @@
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <openssl/aes.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
#define MAXSCALE_KEYLEN 32
|
||||
#define MAXSCALE_IV_LEN 16
|
||||
|
||||
@ -56,4 +59,6 @@ extern int secrets_writeKeys(const char *directory);
|
||||
extern char *decryptPassword(const char *);
|
||||
extern char *encryptPassword(const char*, const char *);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _SERVER_H
|
||||
#define _SERVER_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_SERVER_H
|
||||
#define _MAXSCALE_SERVER_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -12,8 +13,6 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/resultset.h>
|
||||
|
||||
/**
|
||||
* @file service.h
|
||||
@ -44,6 +43,12 @@
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/resultset.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
#define MAX_SERVER_NAME_LEN 1024
|
||||
#define MAX_NUM_SLAVES 128 /**< Maximum number of slaves under a single server*/
|
||||
|
||||
@ -222,4 +227,6 @@ extern RESULTSET *serverGetList();
|
||||
extern unsigned int server_map_status(char *str);
|
||||
extern bool server_set_version_string(SERVER* server, const char* string);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _SERVICE_H
|
||||
#define _SERVICE_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_SERVICE_H
|
||||
#define _MAXSCALE_SERVICE_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -13,21 +14,6 @@
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
#include <maxscale/gw_protocol.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/server.h>
|
||||
#include <maxscale/listener.h>
|
||||
#include <maxscale/filter.h>
|
||||
#include <maxscale/hashtable.h>
|
||||
#include <maxscale/resultset.h>
|
||||
#include <maxscale/config.h>
|
||||
#include <maxscale/queuemanager.h>
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/dh.h>
|
||||
/**
|
||||
* @file service.h
|
||||
*
|
||||
@ -53,6 +39,26 @@
|
||||
*
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <time.h>
|
||||
#include <maxscale/gw_protocol.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/server.h>
|
||||
#include <maxscale/listener.h>
|
||||
#include <maxscale/filter.h>
|
||||
#include <maxscale/hashtable.h>
|
||||
#include <maxscale/resultset.h>
|
||||
#include <maxscale/config.h>
|
||||
#include <maxscale/queuemanager.h>
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/dh.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
struct server;
|
||||
struct router;
|
||||
struct router_object;
|
||||
@ -222,4 +228,6 @@ extern RESULTSET *serviceGetList();
|
||||
extern RESULTSET *serviceGetListenerList();
|
||||
extern bool service_all_services_have_listeners();
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _SESSION_H
|
||||
#define _SESSION_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_SESSION_H
|
||||
#define _MAXSCALE_SESSION_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -33,15 +34,18 @@
|
||||
*
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <time.h>
|
||||
#include <maxscale/atomic.h>
|
||||
#include <maxscale/buffer.h>
|
||||
#include <maxscale/listmanager.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <maxscale/resultset.h>
|
||||
#include <maxscale/skygw_utils.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
struct dcb;
|
||||
struct service;
|
||||
struct filter_def;
|
||||
@ -201,4 +205,7 @@ void session_disable_log_priority(SESSION* ses, int priority);
|
||||
RESULTSET *sessionGetList(SESSIONLISTFILTER);
|
||||
void process_idle_sessions();
|
||||
void enable_session_timeouts();
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#if !defined(SKYGW_TYPES_H)
|
||||
#define SKYGW_TYPES_H
|
||||
|
||||
#include <math.h>
|
||||
#include <stdbool.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#define SECOND_USEC (1024*1024L)
|
||||
#define MSEC_USEC (1024L)
|
||||
|
||||
#define KILOBYTE_BYTE (1024L)
|
||||
#define MEGABYTE_BYTE (1024*1024L)
|
||||
#define GIGABYTE_BYTE (1024*1024*1024L)
|
||||
|
||||
#define KB KILOBYTE_BYTE
|
||||
#define MB MEGABYTE_BYTE
|
||||
#define GB GIGABYTE_BYTE
|
||||
|
||||
#define CALCLEN(i) ((size_t)(floor(log10(abs(i))) + 1))
|
||||
|
||||
#define UINTLEN(i) (i<10 ? 1 : (i<100 ? 2 : (i<1000 ? 3 : CALCLEN(i))))
|
||||
|
||||
#if !defined(PATH_MAX)
|
||||
# if defined(__USE_POSIX)
|
||||
# define PATH_MAX _POSIX_PATH_MAX
|
||||
# else
|
||||
# define PATH_MAX 256
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define MAX_ERROR_MSG PATH_MAX
|
||||
#define array_nelems(a) ((uint)(sizeof(a)/sizeof(a[0])))
|
||||
|
||||
#endif /* SKYGW_TYPES_H */
|
@ -1,5 +1,6 @@
|
||||
#ifndef _SKYGW_UTILS_H
|
||||
#define _SKYGW_UTILS_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_SKYGW_UTILS_H
|
||||
#define _MAXSCALE_SKYGW_UTILS_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -13,23 +14,13 @@
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* We need a common.h file that is included by every component.
|
||||
*/
|
||||
#if !defined(STRERROR_BUFLEN)
|
||||
#define STRERROR_BUFLEN 512
|
||||
#endif
|
||||
#include <maxscale/cdefs.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) (a<b ? a : b)
|
||||
#endif
|
||||
#ifndef MAX
|
||||
#define MAX(a,b) (a>b ? a : b)
|
||||
#endif
|
||||
#define FSYNCLIMIT 10
|
||||
|
||||
#include <maxscale/skygw_types.h>
|
||||
#include <maxscale/skygw_debug.h>
|
||||
#include <maxscale/debug.h>
|
||||
|
||||
#define DISKWRITE_LATENCY (5*MSEC_USEC)
|
||||
|
||||
@ -105,13 +96,9 @@ struct skygw_file_st
|
||||
skygw_chk_t sf_chk_tail;
|
||||
};
|
||||
|
||||
EXTERN_C_BLOCK_BEGIN
|
||||
|
||||
bool utils_init(); /*< Call this first before using any other function */
|
||||
void utils_end();
|
||||
|
||||
EXTERN_C_BLOCK_END
|
||||
|
||||
/** Skygw thread routines */
|
||||
skygw_thread_t* skygw_thread_init(const char* name,
|
||||
void* (*sth_thrfun)(void* data),
|
||||
@ -126,8 +113,6 @@ size_t get_timestamp_len_hp(void);
|
||||
size_t snprint_timestamp(char* p_ts, size_t tslen);
|
||||
size_t snprint_timestamp_hp(char* p_ts, size_t tslen);
|
||||
|
||||
EXTERN_C_BLOCK_BEGIN
|
||||
|
||||
void skygw_thread_set_state(skygw_thread_t* thr,
|
||||
skygw_thr_state_t state);
|
||||
void* skygw_thread_get_data(skygw_thread_t* thr);
|
||||
@ -136,8 +121,6 @@ bool skygw_thread_set_exitflag(skygw_thread_t* thr,
|
||||
skygw_message_t* sendmes,
|
||||
skygw_message_t* recmes);
|
||||
|
||||
EXTERN_C_BLOCK_END
|
||||
|
||||
/** Skygw thread routines */
|
||||
|
||||
/** Skygw file routines */
|
||||
@ -159,8 +142,6 @@ int skygw_file_write(skygw_file_t* file,
|
||||
bool flush);
|
||||
/** Skygw file routines */
|
||||
|
||||
EXTERN_C_BLOCK_BEGIN
|
||||
|
||||
void acquire_lock(int* l);
|
||||
void release_lock(int* l);
|
||||
|
||||
@ -179,15 +160,11 @@ void skygw_message_reset(skygw_message_t* mes);
|
||||
|
||||
/** Skygw message routines */
|
||||
|
||||
EXTERN_C_BLOCK_END
|
||||
|
||||
int skygw_rwlock_wrlock(skygw_rwlock_t* rwlock);
|
||||
int skygw_rwlock_rdlock(skygw_rwlock_t* rwlock);
|
||||
int skygw_rwlock_unlock(skygw_rwlock_t* rwlock);
|
||||
int skygw_rwlock_init(skygw_rwlock_t** rwlock);
|
||||
|
||||
EXTERN_C_BLOCK_BEGIN
|
||||
|
||||
size_t get_decimal_len(size_t s);
|
||||
|
||||
char* remove_mysql_comments(const char** src, const size_t* srcsize, char** dest,
|
||||
@ -203,6 +180,6 @@ bool strip_escape_chars(char*);
|
||||
char* trim(char *str);
|
||||
char* squeeze_whitespace(char* str);
|
||||
|
||||
EXTERN_C_BLOCK_END
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif /* SKYGW_UTILS_H */
|
||||
|
@ -1,66 +0,0 @@
|
||||
#ifndef _SLIST_H
|
||||
#define _SLIST_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#include <maxscale/skygw_utils.h>
|
||||
|
||||
EXTERN_C_BLOCK_BEGIN
|
||||
|
||||
typedef struct slist_node_st slist_node_t;
|
||||
typedef struct slist_st slist_t;
|
||||
typedef struct slist_cursor_st slist_cursor_t;
|
||||
|
||||
/** Single-linked list */
|
||||
|
||||
struct slist_node_st
|
||||
{
|
||||
skygw_chk_t slnode_chk_top;
|
||||
slist_t* slnode_list;
|
||||
slist_node_t* slnode_next;
|
||||
void* slnode_data;
|
||||
size_t slnode_cursor_refcount;
|
||||
skygw_chk_t slnode_chk_tail;
|
||||
};
|
||||
|
||||
struct slist_st
|
||||
{
|
||||
skygw_chk_t slist_chk_top;
|
||||
slist_node_t* slist_head;
|
||||
slist_node_t* slist_tail;
|
||||
int slist_nelems;
|
||||
slist_t* slist_cursors_list;
|
||||
skygw_chk_t slist_chk_tail;
|
||||
};
|
||||
|
||||
struct slist_cursor_st
|
||||
{
|
||||
skygw_chk_t slcursor_chk_top;
|
||||
slist_t* slcursor_list;
|
||||
slist_node_t* slcursor_pos;
|
||||
skygw_chk_t slcursor_chk_tail;
|
||||
};
|
||||
|
||||
slist_cursor_t* slist_init(void);
|
||||
void slist_done(slist_cursor_t* c);
|
||||
size_t slist_size(slist_cursor_t* c);
|
||||
|
||||
void slcursor_add_data(slist_cursor_t* c, void* data);
|
||||
void* slcursor_get_data(slist_cursor_t* c);
|
||||
void slcursor_remove_data(slist_cursor_t* c);
|
||||
bool slcursor_move_to_begin(slist_cursor_t* c);
|
||||
bool slcursor_step_ahead(slist_cursor_t* c);
|
||||
|
||||
EXTERN_C_BLOCK_END
|
||||
|
||||
#endif
|
@ -1,5 +1,6 @@
|
||||
#ifndef _SPINLOCK_H
|
||||
#define _SPINLOCK_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_SPINLOCK_H
|
||||
#define _MAXSCALE_SPINLOCK_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -23,9 +24,11 @@
|
||||
* for the lock to be released. However they are useful in that they do not involve
|
||||
* system calls and are light weight when the expected wait time for a lock is low.
|
||||
*/
|
||||
#include <maxscale/skygw_debug.h>
|
||||
|
||||
EXTERN_C_BLOCK_BEGIN
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/debug.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
#define SPINLOCK_PROFILE 0
|
||||
|
||||
@ -74,6 +77,6 @@ extern int spinlock_acquire_nowait(const SPINLOCK *lock);
|
||||
extern void spinlock_release(const SPINLOCK *lock);
|
||||
extern void spinlock_stats(const SPINLOCK *lock, void (*reporter)(void *, char *, int), void *hdl);
|
||||
|
||||
EXTERN_C_BLOCK_END
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _STATISTICS_HG
|
||||
#define _STATISTICS_HG
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_STATISTICS_HG
|
||||
#define _MAXSCALE_STATISTICS_HG
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -25,8 +26,11 @@
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <stdint.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
typedef void* ts_stats_t;
|
||||
|
||||
/** stats_init should be called only once */
|
||||
@ -68,4 +72,6 @@ ts_stats_set(ts_stats_t stats, int value, int thread_id)
|
||||
((int64_t*)stats)[thread_id] = value;
|
||||
}
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _THREAD_H
|
||||
#define _THREAD_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_THREAD_H
|
||||
#define _MAXSCALE_THREAD_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -22,6 +23,10 @@
|
||||
* of changes.
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* Thread type and thread identifier function macros
|
||||
*/
|
||||
@ -33,4 +38,6 @@ extern THREAD *thread_start(THREAD *thd, void (*entry)(void *), void *arg);
|
||||
extern void thread_wait(THREAD thd);
|
||||
extern void thread_millisleep(int ms);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _USERS_H
|
||||
#define _USERS_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_USERS_H
|
||||
#define _MAXSCALE_USERS_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -12,10 +13,6 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#include <maxscale/hashtable.h>
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/listener.h>
|
||||
#include <openssl/sha.h>
|
||||
|
||||
/**
|
||||
* @file users.h The functions to manipulate the table of users maintained
|
||||
@ -33,6 +30,14 @@
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/hashtable.h>
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/listener.h>
|
||||
#include <openssl/sha.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
#define USERS_HASHTABLE_DEFAULT_SIZE 52
|
||||
|
||||
/**
|
||||
@ -70,4 +75,6 @@ extern int users_default_loadusers(SERV_LISTENER *port); /**< A generic implemen
|
||||
extern void usersPrint(USERS *); /**< Print data about the users loaded */
|
||||
extern void dcb_usersPrint(DCB *, USERS *); /**< Print data about the users loaded */
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _UTILS_H
|
||||
#define _UTILS_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_UTILS_H
|
||||
#define _MAXSCALE_UTILS_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -25,6 +26,17 @@
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
#define CALCLEN(i) ((size_t)(floor(log10(abs(i))) + 1))
|
||||
#define UINTLEN(i) (i<10 ? 1 : (i<100 ? 2 : (i<1000 ? 3 : CALCLEN(i))))
|
||||
|
||||
#define MXS_ARRAY_NELEMS(array) ((size_t)(sizeof(array)/sizeof(array[0])))
|
||||
|
||||
int setnonblocking(int fd);
|
||||
char *gw_strend(register const char *s);
|
||||
static char gw_randomchar();
|
||||
@ -37,4 +49,6 @@ void gw_sha1_2_str(const uint8_t *in, int in_len, const uint8_t *in2, int in2_le
|
||||
int gw_getsockerrno(int fd);
|
||||
char *create_hex_sha1_sha1_passwd(char *passwd);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -55,8 +55,7 @@
|
||||
#include <strfunc.h>
|
||||
#include <item_func.h>
|
||||
|
||||
#include <maxscale/skygw_types.h>
|
||||
#include <maxscale/skygw_debug.h>
|
||||
#include <maxscale/debug.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
#include <maxscale/query_classifier.h>
|
||||
#include <maxscale/protocol/mysql.h>
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "builtin_functions.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <maxscale/skygw_debug.h>
|
||||
#include <maxscale/debug.h>
|
||||
|
||||
static struct
|
||||
{
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <maxscale/query_classifier.h>
|
||||
#include <maxscale/buffer.h>
|
||||
#include <maxscale/gwdirs.h>
|
||||
#include <maxscale/skygw_utils.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
add_library(maxscale-common SHARED adminusers.c alloc.c authenticator.c atomic.c buffer.c config.c dbusers.c dcb.c filter.c externcmd.c gwbitmask.c gwdirs.c gw_utils.c hashtable.c hint.c housekeeper.c listmanager.c load_utils.c log_manager.cc maxscale_pcre2.c memlog.c misc.c mlist.c modutil.c monitor.c queuemanager.c query_classifier.c poll.c random_jkiss.c resultset.c secrets.c server.c service.c session.c slist.c spinlock.c thread.c users.c utils.c skygw_utils.cc statistics.c listener.c gw_ssl.c mysql_utils.c mysql_binlog.c)
|
||||
add_library(maxscale-common SHARED adminusers.c alloc.c authenticator.c atomic.c buffer.c config.c dbusers.c dcb.c filter.c externcmd.c gwbitmask.c gwdirs.c gw_utils.c hashtable.c hint.c housekeeper.c listmanager.c load_utils.c log_manager.cc maxscale_pcre2.c memlog.c misc.c mlist.c modutil.c monitor.c queuemanager.c query_classifier.c poll.c random_jkiss.c resultset.c secrets.c server.c service.c session.c spinlock.c thread.c users.c utils.c skygw_utils.cc statistics.c listener.c gw_ssl.c mysql_utils.c mysql_binlog.c)
|
||||
|
||||
target_link_libraries(maxscale-common ${MARIADB_CONNECTOR_LIBRARIES} ${LZMA_LINK_FLAGS} ${PCRE2_LIBRARIES} ${CURL_LIBRARIES} ssl pthread crypt dl crypto inih z rt m stdc++)
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <maxscale/alloc.h>
|
||||
#include <maxscale/atomic.h>
|
||||
#include <maxscale/skygw_debug.h>
|
||||
#include <maxscale/debug.h>
|
||||
#include <maxscale/skygw_utils.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <maxscale/hint.h>
|
||||
@ -121,7 +121,7 @@ gwbuf_alloc(unsigned int size)
|
||||
retblock:
|
||||
if (rval == NULL)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Memory allocation failed due to %s.",
|
||||
strerror_r(errno, errbuf, sizeof(errbuf)));
|
||||
}
|
||||
@ -964,7 +964,7 @@ size_t gwbuf_copy_data(GWBUF *buffer, size_t offset, size_t bytes, uint8_t* dest
|
||||
|
||||
if (buffer)
|
||||
{
|
||||
bytes_left = MIN(GWBUF_LENGTH(buffer), bytes);
|
||||
bytes_left = MXS_MIN(GWBUF_LENGTH(buffer), bytes);
|
||||
ptr = (uint8_t*) GWBUF_DATA(buffer);
|
||||
}
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ char* config_clean_string_list(char* str)
|
||||
PCRE2_ZERO_TERMINATED, 0, &re_err, &err_offset, NULL)) == NULL ||
|
||||
(data = pcre2_match_data_create_from_pattern(re, NULL)) == NULL)
|
||||
{
|
||||
PCRE2_UCHAR errbuf[STRERROR_BUFLEN];
|
||||
PCRE2_UCHAR errbuf[MXS_STRERROR_BUFLEN];
|
||||
pcre2_get_error_message(re_err, errbuf, sizeof(errbuf));
|
||||
MXS_ERROR("[%s] Regular expression compilation failed at %d: %s",
|
||||
__FUNCTION__, (int)err_offset, errbuf);
|
||||
@ -2145,7 +2145,7 @@ bool config_has_duplicate_sections(const char* config)
|
||||
}
|
||||
else
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Failed to open file '%s': %s", config,
|
||||
strerror_r(errno, errbuf, sizeof(errbuf)));
|
||||
rval = true;
|
||||
|
@ -672,7 +672,7 @@ dcb_process_victim_queue(DCB *listofdcb)
|
||||
{
|
||||
int eno = errno;
|
||||
errno = 0;
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("%lu [dcb_process_victim_queue] Error : Failed to close "
|
||||
"socket %d on dcb %p due error %d, %s.",
|
||||
pthread_self(),
|
||||
@ -1003,7 +1003,7 @@ dcb_bytes_readable(DCB *dcb)
|
||||
|
||||
if (-1 == ioctl(dcb->fd, FIONREAD, &bytesavailable))
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
/* <editor-fold defaultstate="collapsed" desc=" Error Logging "> */
|
||||
MXS_ERROR("%lu [dcb_read] Error : ioctl FIONREAD for dcb %p in "
|
||||
"state %s fd %d failed due error %d, %s.",
|
||||
@ -1069,10 +1069,10 @@ dcb_basic_read(DCB *dcb, int bytesavailable, int maxbytes, int nreadtotal, int *
|
||||
{
|
||||
GWBUF *buffer;
|
||||
|
||||
int bufsize = MIN(bytesavailable, MAX_BUFFER_SIZE);
|
||||
int bufsize = MXS_MIN(bytesavailable, MAX_BUFFER_SIZE);
|
||||
if (maxbytes)
|
||||
{
|
||||
bufsize = MIN(bufsize, maxbytes - nreadtotal);
|
||||
bufsize = MXS_MIN(bufsize, maxbytes - nreadtotal);
|
||||
}
|
||||
|
||||
if ((buffer = gwbuf_alloc(bufsize)) == NULL)
|
||||
@ -1081,7 +1081,7 @@ dcb_basic_read(DCB *dcb, int bytesavailable, int maxbytes, int nreadtotal, int *
|
||||
* This is a fatal error which should cause shutdown.
|
||||
* Todo shutdown if memory allocation fails.
|
||||
*/
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
/* <editor-fold defaultstate="collapsed" desc=" Error Logging "> */
|
||||
MXS_ERROR("%lu [dcb_read] Error : Failed to allocate read buffer "
|
||||
"for dcb %p fd %d, due %d, %s.",
|
||||
@ -1102,7 +1102,7 @@ dcb_basic_read(DCB *dcb, int bytesavailable, int maxbytes, int nreadtotal, int *
|
||||
{
|
||||
if (errno != 0 && errno != EAGAIN && errno != EWOULDBLOCK)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
/* <editor-fold defaultstate="collapsed" desc=" Error Logging "> */
|
||||
MXS_ERROR("%lu [dcb_read] Error : Read failed, dcb %p in state "
|
||||
"%s fd %d, due %d, %s.",
|
||||
@ -1211,7 +1211,7 @@ dcb_basic_read_SSL(DCB *dcb, int *nsingleread)
|
||||
* This is a fatal error which should cause shutdown.
|
||||
* Todo shutdown if memory allocation fails.
|
||||
*/
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
/* <editor-fold defaultstate="collapsed" desc=" Error Logging "> */
|
||||
MXS_ERROR("%lu [dcb_read] Error : Failed to allocate read buffer "
|
||||
"for dcb %p fd %d, due %d, %s.",
|
||||
@ -1297,7 +1297,7 @@ dcb_basic_read_SSL(DCB *dcb, int *nsingleread)
|
||||
static int
|
||||
dcb_log_errors_SSL (DCB *dcb, const char *called_by, int ret)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
unsigned long ssl_errno;
|
||||
|
||||
ssl_errno = ERR_get_error();
|
||||
@ -1327,7 +1327,7 @@ dcb_log_errors_SSL (DCB *dcb, const char *called_by, int ret)
|
||||
{
|
||||
while (ssl_errno != 0)
|
||||
{
|
||||
ERR_error_string_n(ssl_errno, errbuf, STRERROR_BUFLEN);
|
||||
ERR_error_string_n(ssl_errno, errbuf, MXS_STRERROR_BUFLEN);
|
||||
MXS_ERROR("%s", errbuf);
|
||||
ssl_errno = ERR_get_error();
|
||||
}
|
||||
@ -1475,7 +1475,7 @@ dcb_log_write_failure(DCB *dcb, GWBUF *queue, int eno)
|
||||
{
|
||||
if (eno == EPIPE)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_DEBUG("%lu [dcb_write] Write to dcb "
|
||||
"%p in state %s fd %d failed "
|
||||
"due errno %d, %s",
|
||||
@ -1494,7 +1494,7 @@ dcb_log_write_failure(DCB *dcb, GWBUF *queue, int eno)
|
||||
eno != EAGAIN &&
|
||||
eno != EWOULDBLOCK)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Write to dcb %p in "
|
||||
"state %s fd %d failed due "
|
||||
"errno %d, %s",
|
||||
@ -1528,7 +1528,7 @@ dcb_log_write_failure(DCB *dcb, GWBUF *queue, int eno)
|
||||
}
|
||||
if (dolog)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_DEBUG("%lu [dcb_write] Writing to %s socket failed due %d, %s.",
|
||||
pthread_self(),
|
||||
DCB_ROLE_CLIENT_HANDLER == dcb->dcb_role ? "client" : "backend server",
|
||||
@ -2458,7 +2458,7 @@ gw_write(DCB *dcb, GWBUF *writeq, bool *stop_writing)
|
||||
saved_errno != EPIPE)
|
||||
#endif
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Write to %s %s in state %s failed due errno %d, %s",
|
||||
DCB_STRTYPE(dcb), dcb->remote, STRDCBSTATE(dcb->state),
|
||||
saved_errno, strerror_r(saved_errno, errbuf, sizeof(errbuf)));
|
||||
@ -2802,7 +2802,7 @@ dcb_persistent_clean_count(DCB *dcb, bool cleanall)
|
||||
}
|
||||
persistentdcb = nextdcb;
|
||||
}
|
||||
server->persistmax = MAX(server->persistmax, count);
|
||||
server->persistmax = MXS_MAX(server->persistmax, count);
|
||||
spinlock_release(&server->persistlock);
|
||||
/** Call possible callback for this DCB in case of close */
|
||||
while (disposals)
|
||||
@ -3087,7 +3087,7 @@ dcb_accept(DCB *listener, GWPROTOCOL *protocol_funcs)
|
||||
int sendbuf;
|
||||
struct sockaddr_storage client_conn;
|
||||
socklen_t optlen = sizeof(sendbuf);
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
|
||||
if ((c_sock = dcb_accept_one_connection(listener, (struct sockaddr *)&client_conn)) >= 0)
|
||||
{
|
||||
@ -3256,7 +3256,7 @@ dcb_accept_one_connection(DCB *listener, struct sockaddr *client_conn)
|
||||
|
||||
if (c_sock == -1)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
/* Did not get a file descriptor */
|
||||
if (eno == EAGAIN || eno == EWOULDBLOCK)
|
||||
{
|
||||
@ -3348,7 +3348,7 @@ dcb_listen(DCB *listener, const char *config, const char *protocol_name)
|
||||
|
||||
if (listen(listener_socket, 10 * SOMAXCONN) != 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Failed to start listening on '%s' with protocol '%s': %d, %s",
|
||||
config,
|
||||
protocol_name,
|
||||
@ -3402,7 +3402,7 @@ dcb_listen_create_socket_inet(const char *config_bind)
|
||||
/** Create the TCP socket */
|
||||
if ((listener_socket = socket(AF_INET, SOCK_STREAM, 0)) < 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Can't create socket: %i, %s",
|
||||
errno,
|
||||
strerror_r(errno, errbuf, sizeof(errbuf)));
|
||||
@ -3426,7 +3426,7 @@ dcb_listen_create_socket_inet(const char *config_bind)
|
||||
|
||||
if (bind(listener_socket, (struct sockaddr *) &server_address, sizeof(server_address)) < 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Failed to bind on '%s': %i, %s",
|
||||
config_bind,
|
||||
errno,
|
||||
@ -3469,7 +3469,7 @@ dcb_listen_create_socket_unix(const char *config_bind)
|
||||
// UNIX socket create
|
||||
if ((listener_socket = socket(AF_UNIX, SOCK_STREAM, 0)) < 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Can't create UNIX socket: %i, %s",
|
||||
errno,
|
||||
strerror_r(errno, errbuf, sizeof(errbuf)));
|
||||
@ -3496,7 +3496,7 @@ dcb_listen_create_socket_unix(const char *config_bind)
|
||||
|
||||
if ((-1 == unlink(config_bind)) && (errno != ENOENT))
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Failed to unlink Unix Socket %s: %d %s",
|
||||
config_bind, errno, strerror_r(errno, errbuf, sizeof(errbuf)));
|
||||
}
|
||||
@ -3504,7 +3504,7 @@ dcb_listen_create_socket_unix(const char *config_bind)
|
||||
/* Bind the socket to the Unix domain socket */
|
||||
if (bind(listener_socket, (struct sockaddr *) &local_addr, sizeof(local_addr)) < 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Failed to bind to UNIX Domain socket '%s': %i, %s",
|
||||
config_bind,
|
||||
errno,
|
||||
@ -3516,7 +3516,7 @@ dcb_listen_create_socket_unix(const char *config_bind)
|
||||
/* set permission for all users */
|
||||
if (chmod(config_bind, 0777) < 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Failed to change permissions on UNIX Domain socket '%s': %i, %s",
|
||||
config_bind,
|
||||
errno,
|
||||
@ -3543,7 +3543,7 @@ dcb_set_socket_option(int sockfd, int level, int optname, void *optval, socklen_
|
||||
{
|
||||
if (setsockopt(sockfd, level, optname, optval, optlen) != 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Failed to set socket options. Error %d: %s",
|
||||
errno,
|
||||
strerror_r(errno, errbuf, sizeof(errbuf)));
|
||||
|
@ -12,6 +12,7 @@
|
||||
*/
|
||||
|
||||
#include <maxscale/externcmd.h>
|
||||
#include <ctype.h>
|
||||
#include <maxscale/alloc.h>
|
||||
|
||||
/**
|
||||
@ -170,7 +171,7 @@ int externcmd_execute(EXTERNCMD* cmd)
|
||||
|
||||
if (pid < 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Failed to execute command '%s', fork failed: [%d] %s",
|
||||
cmd->argv[0], errno, strerror_r(errno, errbuf, sizeof(errbuf)));
|
||||
rval = -1;
|
||||
|
@ -317,7 +317,7 @@ sigchld_handler (int i)
|
||||
|
||||
if ((child = wait(&exit_status)) == -1)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Failed to wait child process: %d %s",
|
||||
errno, strerror_r(errno, errbuf, sizeof(errbuf)));
|
||||
}
|
||||
@ -428,7 +428,7 @@ static int signal_set(int sig, void (*handler)(int))
|
||||
{
|
||||
int eno = errno;
|
||||
errno = 0;
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Failed call sigaction() in %s due to %d, %s.",
|
||||
program_invocation_short_name,
|
||||
eno,
|
||||
@ -463,7 +463,7 @@ static bool create_datadir(const char* base, char* datadir)
|
||||
}
|
||||
else
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Cannot create data directory '%s': %d %s\n",
|
||||
datadir, errno, strerror_r(errno, errbuf, sizeof(errbuf)));
|
||||
}
|
||||
@ -473,7 +473,7 @@ static bool create_datadir(const char* base, char* datadir)
|
||||
{
|
||||
if (len < PATH_MAX)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
fprintf(stderr, "Error: Cannot create data directory '%s': %d %s\n",
|
||||
datadir, errno, strerror_r(errno, errbuf, sizeof(errbuf)));
|
||||
}
|
||||
@ -501,7 +501,7 @@ int ntfw_cb(const char* filename,
|
||||
{
|
||||
int eno = errno;
|
||||
errno = 0;
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Failed to remove the data directory %s of MaxScale due to %d, %s.",
|
||||
datadir, eno, strerror_r(eno, errbuf, sizeof(errbuf)));
|
||||
}
|
||||
@ -702,7 +702,7 @@ static void print_log_n_stderr(
|
||||
{
|
||||
if (mxs_log_init(NULL, get_logdir(), MXS_LOG_TARGET_FS))
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("%s%s%s%s",
|
||||
logstr,
|
||||
eno == 0 ? "" : " (",
|
||||
@ -712,7 +712,7 @@ static void print_log_n_stderr(
|
||||
}
|
||||
if (do_stderr)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
fprintf(stderr,
|
||||
"* Error: %s%s%s%s\n",
|
||||
fprstr,
|
||||
@ -1798,7 +1798,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
else
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Cannot create data directory '%s': %d %s\n",
|
||||
datadir, errno, strerror_r(errno, errbuf, sizeof(errbuf)));
|
||||
goto return_main;
|
||||
@ -2121,7 +2121,7 @@ static void unlink_pidfile(void)
|
||||
{
|
||||
if (unlink(pidfile))
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
fprintf(stderr,
|
||||
"MaxScale failed to remove pidfile %s: error %d, %s\n",
|
||||
pidfile,
|
||||
@ -2545,7 +2545,7 @@ static int set_user(const char* user)
|
||||
pwname = getpwnam(user);
|
||||
if (pwname == NULL)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
printf("Error: Failed to retrieve user information for '%s': %d %s\n",
|
||||
user, errno, errno == 0 ? "User not found" : strerror_r(errno, errbuf, sizeof(errbuf)));
|
||||
return -1;
|
||||
@ -2554,7 +2554,7 @@ static int set_user(const char* user)
|
||||
rval = setgid(pwname->pw_gid);
|
||||
if (rval != 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
printf("Error: Failed to change group to '%d': %d %s\n",
|
||||
pwname->pw_gid, errno, strerror_r(errno, errbuf, sizeof(errbuf)));
|
||||
return rval;
|
||||
@ -2563,7 +2563,7 @@ static int set_user(const char* user)
|
||||
rval = setuid(pwname->pw_uid);
|
||||
if (rval != 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
printf("Error: Failed to change user to '%s': %d %s\n",
|
||||
pwname->pw_name, errno, strerror_r(errno, errbuf, sizeof(errbuf)));
|
||||
return rval;
|
||||
@ -2572,7 +2572,7 @@ static int set_user(const char* user)
|
||||
{
|
||||
if (prctl(PR_SET_DUMPABLE , 1) == -1)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
printf("Error: Failed to set dumpable flag on for the process '%s': %d %s\n",
|
||||
pwname->pw_name, errno, strerror_r(errno, errbuf, sizeof(errbuf)));
|
||||
return -1;
|
||||
@ -2615,7 +2615,7 @@ static bool change_cwd()
|
||||
|
||||
if (chdir(get_logdir()) != 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Failed to change working directory to '%s': %d, %s. "
|
||||
"Trying to change working directory to '/'.",
|
||||
get_logdir(), errno, strerror_r(errno, errbuf, sizeof (errbuf)));
|
||||
|
@ -143,7 +143,7 @@ bool gw_daemonize(void)
|
||||
|
||||
if (pid < 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
fprintf(stderr, "fork() error %s\n", strerror_r(errno, errbuf, sizeof(errbuf)));
|
||||
exit(1);
|
||||
}
|
||||
@ -156,7 +156,7 @@ bool gw_daemonize(void)
|
||||
|
||||
if (setsid() < 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
fprintf(stderr, "setsid() error %s\n", strerror_r(errno, errbuf, sizeof(errbuf)));
|
||||
exit(1);
|
||||
}
|
||||
|
@ -26,12 +26,12 @@
|
||||
#include <maxscale/atomic.h>
|
||||
|
||||
#include <maxscale/hashtable.h>
|
||||
#include <maxscale/mlist.h>
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <maxscale/skygw_debug.h>
|
||||
#include <maxscale/skygw_types.h>
|
||||
#include <maxscale/debug.h>
|
||||
#include <maxscale/skygw_utils.h>
|
||||
#include <maxscale/alloc.h>
|
||||
#include <maxscale/utils.h>
|
||||
#include "maxscale/mlist.h"
|
||||
|
||||
#define MAX_PREFIXLEN 250
|
||||
#define MAX_SUFFIXLEN 250
|
||||
@ -1643,7 +1643,7 @@ static bool logfile_write_header(skygw_file_t* file)
|
||||
|
||||
if ((header_items != 1) || (line_items != 1))
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
LOG_ERROR("MaxScale Log: Writing header failed due to %d, %s\n",
|
||||
errno, strerror_r(errno, errbuf, sizeof(errbuf)));
|
||||
written = false;
|
||||
@ -1820,13 +1820,13 @@ static bool check_file_and_path(const char* filename, bool* writable)
|
||||
{
|
||||
if (file_is_symlink(filename))
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
LOG_ERROR("MaxScale Log: Error, Can't access file pointed to by %s due to %d, %s.\n",
|
||||
filename, errno, strerror_r(errno, errbuf, sizeof(errbuf)));
|
||||
}
|
||||
else
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
LOG_ERROR("MaxScale Log: Error, Can't access %s due to %d, %s.\n",
|
||||
filename, errno, strerror_r(errno, errbuf, sizeof(errbuf)));
|
||||
}
|
||||
@ -1925,7 +1925,7 @@ static bool logfile_init(logfile_t* logfile,
|
||||
|
||||
if (mkdir(dir, S_IRWXU | S_IRWXG) != 0 && (errno != EEXIST))
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
LOG_ERROR("MaxScale Log: Error, creating directory %s failed due to %d, %s.\n",
|
||||
dir, errno, strerror_r(errno, errbuf, sizeof(errbuf)));
|
||||
|
||||
@ -2110,7 +2110,7 @@ static bool logfile_write_footer(skygw_file_t* file, const char* suffix)
|
||||
|
||||
if ((header_items != 1) || (line_items != 1))
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
LOG_ERROR("MaxScale Log: Writing footer failed due to %d, %s\n",
|
||||
errno, strerror_r(errno, errbuf, sizeof(errbuf)));
|
||||
written = false;
|
||||
@ -2238,7 +2238,7 @@ static bool thr_flush_file(logmanager_t *lm, filewriter_t *fwr)
|
||||
if (err)
|
||||
{
|
||||
// TODO: Log this to syslog.
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
LOG_ERROR("MaxScale Log: Error, writing to the log-file %s failed due to %d, %s. "
|
||||
"Disabling writing to the log.\n",
|
||||
lf->lf_full_file_name, err, strerror_r(err, errbuf, sizeof(errbuf)));
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef _MLIST_H
|
||||
#define _MLIST_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_MLIST_H
|
||||
#define _MAXSCALE_MLIST_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -13,9 +14,10 @@
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/skygw_utils.h>
|
||||
|
||||
EXTERN_C_BLOCK_BEGIN
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
typedef struct mlist_node_st mlist_node_t;
|
||||
|
||||
@ -74,6 +76,6 @@ mlist_cursor_t* mlist_cursor_init(mlist_t* ml);
|
||||
void* mlist_cursor_get_data_nomutex(mlist_cursor_t* c);
|
||||
bool mlist_cursor_move_to_first(mlist_cursor_t* c);
|
||||
|
||||
EXTERN_C_BLOCK_END
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
@ -11,7 +11,7 @@
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#include <maxscale/mlist.h>
|
||||
#include "maxscale/mlist.h"
|
||||
#include <maxscale/alloc.h>
|
||||
|
||||
static void mlist_free_memory(mlist_t* ml, char* name);
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <maxscale/alloc.h>
|
||||
#include <maxscale/poll.h>
|
||||
#include <maxscale/modutil.h>
|
||||
#include <maxscale/skygw_utils.h>
|
||||
#include <strings.h>
|
||||
|
||||
/** These are used when converting MySQL wildcards to regular expressions */
|
||||
@ -1059,7 +1060,7 @@ void prepare_pcre2_patterns()
|
||||
{
|
||||
int err;
|
||||
size_t erroff;
|
||||
PCRE2_UCHAR errbuf[STRERROR_BUFLEN];
|
||||
PCRE2_UCHAR errbuf[MXS_STRERROR_BUFLEN];
|
||||
|
||||
if ((re_percent = pcre2_compile(pattern_percent, PCRE2_ZERO_TERMINATED,
|
||||
0, &err, &erroff, NULL)) &&
|
||||
@ -1137,7 +1138,7 @@ mxs_pcre2_result_t modutil_mysql_wildcard_match(const char* pattern, const char*
|
||||
{
|
||||
if (errcode != 0)
|
||||
{
|
||||
PCRE2_UCHAR errbuf[STRERROR_BUFLEN];
|
||||
PCRE2_UCHAR errbuf[MXS_STRERROR_BUFLEN];
|
||||
pcre2_get_error_message(errcode, errbuf, sizeof(errbuf));
|
||||
MXS_ERROR("Failed to match pattern: %s", errbuf);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
#include <string.h>
|
||||
#include <maxscale/skygw_debug.h>
|
||||
#include <maxscale/debug.h>
|
||||
#include <maxscale/users.h>
|
||||
#include <maxscale/dbusers.h>
|
||||
#include <strings.h>
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <maxscale/alloc.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
#include <maxscale/skygw_debug.h>
|
||||
#include <maxscale/debug.h>
|
||||
#include <maxscale/config.h>
|
||||
|
||||
/**
|
||||
|
@ -215,7 +215,7 @@ poll_init()
|
||||
}
|
||||
if ((epoll_fd = epoll_create(MAX_EVENTS)) == -1)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("FATAL: Could not create epoll instance: %s", strerror_r(errno, errbuf, sizeof(errbuf)));
|
||||
exit(-1);
|
||||
}
|
||||
@ -945,7 +945,7 @@ process_pollq(int thread_id)
|
||||
}
|
||||
else
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_DEBUG("%lu [poll_waitevents] "
|
||||
"EPOLLOUT due %d, %s. "
|
||||
"dcb %p, fd %i",
|
||||
@ -1012,7 +1012,7 @@ process_pollq(int thread_id)
|
||||
if (eno == 0)
|
||||
{
|
||||
eno = dcb_fake_write_errno[dcb->fd];
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_DEBUG("%lu [poll_waitevents] "
|
||||
"Added fake errno %d. "
|
||||
"%s",
|
||||
@ -1024,7 +1024,7 @@ process_pollq(int thread_id)
|
||||
#endif /* FAKE_CODE */
|
||||
if (eno != 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_DEBUG("%lu [poll_waitevents] "
|
||||
"EPOLLERR due %d, %s.",
|
||||
pthread_self(),
|
||||
@ -1047,7 +1047,7 @@ process_pollq(int thread_id)
|
||||
{
|
||||
int eno = 0;
|
||||
eno = gw_getsockerrno(dcb->fd);
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_DEBUG("%lu [poll_waitevents] "
|
||||
"EPOLLHUP on dcb %p, fd %d. "
|
||||
"Errno %d, %s.",
|
||||
@ -1083,7 +1083,7 @@ process_pollq(int thread_id)
|
||||
{
|
||||
int eno = 0;
|
||||
eno = gw_getsockerrno(dcb->fd);
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_DEBUG("%lu [poll_waitevents] "
|
||||
"EPOLLRDHUP on dcb %p, fd %d. "
|
||||
"Errno %d, %s.",
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <maxscale/modules.h>
|
||||
#include <maxscale/modutil.h>
|
||||
#include <maxscale/alloc.h>
|
||||
#include <maxscale/skygw_utils.h>
|
||||
|
||||
//#define QC_TRACE_ENABLED
|
||||
#undef QC_TRACE_ENABLED
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
#include <maxscale/hk_heartbeat.h>
|
||||
#include <maxscale/skygw_debug.h>
|
||||
#include <maxscale/debug.h>
|
||||
|
||||
#if defined(SS_DEBUG)
|
||||
int debug_check_fail = 0;
|
||||
|
@ -89,7 +89,7 @@ secrets_readKeys(const char* path)
|
||||
}
|
||||
else
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("The provided path \"%s\" does not exist or cannot be accessed. "
|
||||
"Error: %d, %s.", path, errno, strerror_r(errno, errbuf, sizeof(errbuf)));
|
||||
return NULL;
|
||||
@ -111,7 +111,7 @@ secrets_readKeys(const char* path)
|
||||
{
|
||||
if (!reported)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_NOTICE("Encrypted password file %s can't be accessed "
|
||||
"(%s). Password encryption is not used.",
|
||||
secret_file,
|
||||
@ -121,7 +121,7 @@ secrets_readKeys(const char* path)
|
||||
}
|
||||
else
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Access for secrets file "
|
||||
"[%s] failed. Error %d, %s.",
|
||||
secret_file,
|
||||
@ -137,7 +137,7 @@ secrets_readKeys(const char* path)
|
||||
{
|
||||
int eno = errno;
|
||||
errno = 0;
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Failed opening secret "
|
||||
"file [%s]. Error %d, %s.",
|
||||
secret_file,
|
||||
@ -153,7 +153,7 @@ secrets_readKeys(const char* path)
|
||||
int eno = errno;
|
||||
errno = 0;
|
||||
close(fd);
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("fstat for secret file %s "
|
||||
"failed. Error %d, %s.",
|
||||
secret_file,
|
||||
@ -167,7 +167,7 @@ secrets_readKeys(const char* path)
|
||||
int eno = errno;
|
||||
errno = 0;
|
||||
close(fd);
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Secrets file %s has "
|
||||
"incorrect size. Error %d, %s.",
|
||||
secret_file,
|
||||
@ -202,7 +202,7 @@ secrets_readKeys(const char* path)
|
||||
errno = 0;
|
||||
close(fd);
|
||||
MXS_FREE(keys);
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Read from secrets file "
|
||||
"%s failed. Read %ld, expected %d bytes. Error %d, %s.",
|
||||
secret_file,
|
||||
@ -219,7 +219,7 @@ secrets_readKeys(const char* path)
|
||||
int eno = errno;
|
||||
errno = 0;
|
||||
MXS_FREE(keys);
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Failed closing the "
|
||||
"secrets file %s. Error %d, %s.",
|
||||
secret_file,
|
||||
@ -267,7 +267,7 @@ int secrets_writeKeys(const char *dir)
|
||||
/* Open for writing | Create | Truncate the file for writing */
|
||||
if ((fd = open(secret_file, O_CREAT | O_WRONLY | O_TRUNC, S_IRUSR)) < 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("failed opening secret "
|
||||
"file [%s]. Error %d, %s.",
|
||||
secret_file,
|
||||
@ -279,7 +279,7 @@ int secrets_writeKeys(const char *dir)
|
||||
/* Open for writing | Create | Truncate the file for writing */
|
||||
if ((randfd = open("/dev/random", O_RDONLY)) < 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("failed opening /dev/random. Error %d, %s.",
|
||||
errno,
|
||||
strerror_r(errno, errbuf, sizeof(errbuf)));
|
||||
@ -302,7 +302,7 @@ int secrets_writeKeys(const char *dir)
|
||||
/* Write data */
|
||||
if (write(fd, &key, sizeof(key)) < 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("failed writing into "
|
||||
"secret file [%s]. Error %d, %s.",
|
||||
secret_file,
|
||||
@ -315,7 +315,7 @@ int secrets_writeKeys(const char *dir)
|
||||
/* close file */
|
||||
if (close(fd) < 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("failed closing the "
|
||||
"secret file [%s]. Error %d, %s.",
|
||||
secret_file,
|
||||
@ -325,7 +325,7 @@ int secrets_writeKeys(const char *dir)
|
||||
|
||||
if (chmod(secret_file, S_IRUSR) < 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("failed to change the permissions of the"
|
||||
"secret file [%s]. Error %d, %s.",
|
||||
secret_file,
|
||||
|
@ -67,6 +67,7 @@
|
||||
#include <maxscale/version.h>
|
||||
#include <maxscale/queuemanager.h>
|
||||
#include <maxscale/alloc.h>
|
||||
#include <maxscale/utils.h>
|
||||
|
||||
/** To be used with configuration type checks */
|
||||
typedef struct typelib_st
|
||||
@ -78,13 +79,13 @@ typedef struct typelib_st
|
||||
|
||||
/** Set of subsequent false,true pairs */
|
||||
static const char* bool_strings[11] = {"FALSE", "TRUE", "OFF", "ON", "N", "Y", "0", "1", "NO", "YES", 0};
|
||||
typelib_t bool_type = {array_nelems(bool_strings) - 1, "bool_type", bool_strings};
|
||||
typelib_t bool_type = {MXS_ARRAY_NELEMS(bool_strings) - 1, "bool_type", bool_strings};
|
||||
|
||||
/** List of valid values */
|
||||
static const char* sqlvar_target_strings[4] = {"MASTER", "ALL", 0};
|
||||
typelib_t sqlvar_target_type =
|
||||
{
|
||||
array_nelems(sqlvar_target_strings) - 1,
|
||||
MXS_ARRAY_NELEMS(sqlvar_target_strings) - 1,
|
||||
"sqlvar_target_type",
|
||||
sqlvar_target_strings
|
||||
};
|
||||
@ -382,7 +383,7 @@ int serviceStartAllPorts(SERVICE* service)
|
||||
service->stats.n_failed_starts++;
|
||||
char taskname[strlen(service->name) + strlen("_start_retry_") +
|
||||
(int) ceil(log10(INT_MAX)) + 1];
|
||||
int retry_after = MIN(service->stats.n_failed_starts * 10, SERVICE_MAX_RETRY_INTERVAL);
|
||||
int retry_after = MXS_MIN(service->stats.n_failed_starts * 10, SERVICE_MAX_RETRY_INTERVAL);
|
||||
snprintf(taskname, sizeof(taskname), "%s_start_retry_%d",
|
||||
service->name, service->stats.n_failed_starts);
|
||||
hktask_oneshot(taskname, service_internal_restart,
|
||||
|
@ -15,6 +15,8 @@
|
||||
#define PCRE2_CODE_UNIT_WIDTH 8
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
@ -23,14 +25,23 @@
|
||||
#include <time.h>
|
||||
#include <stddef.h>
|
||||
#include <regex.h>
|
||||
#include <maxscale/skygw_debug.h>
|
||||
#include <maxscale/skygw_types.h>
|
||||
#include <maxscale/debug.h>
|
||||
#include <sys/time.h>
|
||||
#include <maxscale/skygw_utils.h>
|
||||
#include <maxscale/atomic.h>
|
||||
#include <maxscale/random_jkiss.h>
|
||||
#include <pcre2.h>
|
||||
|
||||
#if !defined(PATH_MAX)
|
||||
# if defined(__USE_POSIX)
|
||||
# define PATH_MAX _POSIX_PATH_MAX
|
||||
# else
|
||||
# define PATH_MAX 256
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define MAX_ERROR_MSG PATH_MAX
|
||||
|
||||
static void simple_mutex_free_memory(simple_mutex_t* sm);
|
||||
static void thread_free_memory(skygw_thread_t* th, char* name);
|
||||
/** End of static function declarations */
|
||||
@ -47,7 +58,7 @@ int skygw_rwlock_rdlock(skygw_rwlock_t* rwlock)
|
||||
else
|
||||
{
|
||||
rwlock->srw_rwlock_thr = 0;
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
ss_dfprintf(stderr,
|
||||
"* pthread_rwlock_rdlock : %s\n",
|
||||
strerror_r(err, errbuf, sizeof (errbuf)));
|
||||
@ -66,7 +77,7 @@ int skygw_rwlock_wrlock(skygw_rwlock_t* rwlock)
|
||||
else
|
||||
{
|
||||
rwlock->srw_rwlock_thr = 0;
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
ss_dfprintf(stderr,
|
||||
"* pthread_rwlock_wrlock : %s\n",
|
||||
strerror_r(err, errbuf, sizeof (errbuf)));
|
||||
@ -84,7 +95,7 @@ int skygw_rwlock_unlock(skygw_rwlock_t* rwlock)
|
||||
}
|
||||
else
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
ss_dfprintf(stderr, "* pthread_rwlock_unlock : %s\n",
|
||||
strerror_r(err, errbuf, sizeof (errbuf)));
|
||||
}
|
||||
@ -97,7 +108,7 @@ int skygw_rwlock_destroy(skygw_rwlock_t* rwlock)
|
||||
/** Lock */
|
||||
if ((err = pthread_rwlock_wrlock(rwlock->srw_rwlock)) != 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
fprintf(stderr, "* Error : pthread_rwlock_wrlock failed due to %d, %s.\n",
|
||||
err, strerror_r(err, errbuf, sizeof (errbuf)));
|
||||
goto retblock;
|
||||
@ -109,7 +120,7 @@ int skygw_rwlock_destroy(skygw_rwlock_t* rwlock)
|
||||
/** Destroy */
|
||||
if ((err = pthread_rwlock_destroy(rwlock->srw_rwlock)) != 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
fprintf(stderr, "* Error : pthread_rwlock_destroy failed due to %d,%s\n",
|
||||
err, strerror_r(err, errbuf, sizeof (errbuf)));
|
||||
}
|
||||
@ -141,7 +152,7 @@ int skygw_rwlock_init(skygw_rwlock_t** rwlock)
|
||||
if (err != 0)
|
||||
{
|
||||
free(rwl);
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
ss_dfprintf(stderr, "* Creating pthread_rwlock failed : %s\n",
|
||||
strerror_r(err, errbuf, sizeof (errbuf)));
|
||||
goto return_err;
|
||||
@ -193,7 +204,7 @@ size_t snprint_timestamp(char* p_ts, size_t tslen)
|
||||
|
||||
t = time(NULL);
|
||||
localtime_r(&t, &tm);
|
||||
snprintf(p_ts, MIN(tslen, timestamp_len), timestamp_formatstr,
|
||||
snprintf(p_ts, MXS_MIN(tslen, timestamp_len), timestamp_formatstr,
|
||||
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour,
|
||||
tm.tm_min, tm.tm_sec);
|
||||
rval = strlen(p_ts) * sizeof (char);
|
||||
@ -234,7 +245,7 @@ size_t snprint_timestamp_hp(char* p_ts, size_t tslen)
|
||||
gettimeofday(&tv, NULL);
|
||||
localtime_r(&tv.tv_sec, &tm);
|
||||
usec = tv.tv_usec / 1000;
|
||||
snprintf(p_ts, MIN(tslen, timestamp_len_hp), timestamp_formatstr_hp,
|
||||
snprintf(p_ts, MXS_MIN(tslen, timestamp_len_hp), timestamp_formatstr_hp,
|
||||
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
|
||||
tm.tm_hour, tm.tm_min, tm.tm_sec, usec);
|
||||
rval = strlen(p_ts) * sizeof (char);
|
||||
@ -339,7 +350,7 @@ int skygw_thread_start(skygw_thread_t* thr)
|
||||
|
||||
if (err != 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
fprintf(stderr, "* Starting file writer thread failed due error, %d, %s\n",
|
||||
err, strerror_r(errno, errbuf, sizeof (errbuf)));
|
||||
goto return_err;
|
||||
@ -515,7 +526,7 @@ simple_mutex_t* simple_mutex_init(simple_mutex_t* mutexptr, const char* name)
|
||||
|
||||
if (err != 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
fprintf(stderr, "* Initializing simple mutex %s failed due error %d, %s\n",
|
||||
name, err, strerror_r(errno, errbuf, sizeof (errbuf)));
|
||||
perror("simple_mutex : ");
|
||||
@ -555,7 +566,7 @@ int simple_mutex_done(simple_mutex_t* sm)
|
||||
if (err != 0)
|
||||
{
|
||||
perror("simple_mutex : ");
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
fprintf(stderr, "* Destroying simple mutex %s failed due %d, %s\n",
|
||||
sm->sm_name, err, strerror_r(errno, errbuf, sizeof (errbuf)));
|
||||
goto return_err;
|
||||
@ -602,7 +613,7 @@ int simple_mutex_lock(simple_mutex_t* sm, bool block)
|
||||
|
||||
if (err != 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
fprintf(stderr, "* Locking simple mutex %s failed due error, %d, %s\n",
|
||||
sm->sm_name, err, strerror_r(errno, errbuf, sizeof (errbuf)));
|
||||
perror("simple_mutex : ");
|
||||
@ -631,7 +642,7 @@ int simple_mutex_unlock(simple_mutex_t* sm)
|
||||
|
||||
if (err != 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
fprintf(stderr, "* Unlocking simple mutex %s failed due error %d, %s\n",
|
||||
sm->sm_name, err, strerror_r(errno, errbuf, sizeof (errbuf)));
|
||||
perror("simple_mutex : ");
|
||||
@ -665,7 +676,7 @@ skygw_message_t* skygw_message_init(void)
|
||||
|
||||
if (err != 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
fprintf(stderr, "* Initializing pthread mutex failed due error %d, %s\n",
|
||||
err, strerror_r(errno, errbuf, sizeof (errbuf)));
|
||||
free(mes);
|
||||
@ -676,7 +687,7 @@ skygw_message_t* skygw_message_init(void)
|
||||
|
||||
if (err != 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
fprintf(stderr, "* Initializing pthread cond var failed, due error %d, %s\n",
|
||||
err, strerror_r(errno, errbuf, sizeof (errbuf)));
|
||||
pthread_mutex_destroy(&mes->mes_mutex);
|
||||
@ -705,7 +716,7 @@ void skygw_message_done(skygw_message_t* mes)
|
||||
|
||||
if (err != 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
fprintf(stderr, "* Destroying cond var failed due error %d, %s\n",
|
||||
err, strerror_r(errno, errbuf, sizeof (errbuf)));
|
||||
}
|
||||
@ -714,7 +725,7 @@ void skygw_message_done(skygw_message_t* mes)
|
||||
|
||||
if (err != 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
fprintf(stderr, "* Destroying pthread mutex failed, due error %d, %s\n",
|
||||
err, strerror_r(errno, errbuf, sizeof (errbuf)));
|
||||
}
|
||||
@ -732,7 +743,7 @@ skygw_mes_rc_t skygw_message_send(skygw_message_t* mes)
|
||||
|
||||
if (err != 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
fprintf(stderr, "* Locking pthread mutex failed, due to error %d, %s\n",
|
||||
err, strerror_r(errno, errbuf, sizeof (errbuf)));
|
||||
goto return_mes_rc;
|
||||
@ -746,7 +757,7 @@ skygw_mes_rc_t skygw_message_send(skygw_message_t* mes)
|
||||
}
|
||||
else
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
fprintf(stderr, "* Signaling pthread cond var failed, due to error %d, %s\n",
|
||||
err, strerror_r(errno, errbuf, sizeof (errbuf)));
|
||||
}
|
||||
@ -754,7 +765,7 @@ skygw_mes_rc_t skygw_message_send(skygw_message_t* mes)
|
||||
|
||||
if (err != 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
fprintf(stderr, "* Unlocking pthread mutex failed, due to error %d, %s\n",
|
||||
err, strerror_r(errno, errbuf, sizeof (errbuf)));
|
||||
}
|
||||
@ -772,7 +783,7 @@ void skygw_message_wait(skygw_message_t* mes)
|
||||
|
||||
if (err != 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
fprintf(stderr, "* Locking pthread mutex failed, due error %d, %s\n",
|
||||
err, strerror_r(errno, errbuf, sizeof (errbuf)));
|
||||
}
|
||||
@ -784,7 +795,7 @@ void skygw_message_wait(skygw_message_t* mes)
|
||||
|
||||
if (err != 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
fprintf(stderr, "* Locking pthread cond wait failed, due error %d, %s\n",
|
||||
err, strerror_r(errno, errbuf, sizeof (errbuf)));
|
||||
}
|
||||
@ -794,7 +805,7 @@ void skygw_message_wait(skygw_message_t* mes)
|
||||
|
||||
if (err != 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
fprintf(stderr, "* Unlocking pthread mutex failed, due error %d, %s\n",
|
||||
err, strerror_r(errno, errbuf, sizeof (errbuf)));
|
||||
}
|
||||
@ -810,7 +821,7 @@ void skygw_message_reset(skygw_message_t* mes)
|
||||
|
||||
if (err != 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
fprintf(stderr, "* Locking pthread mutex failed, due error %d, %s\n",
|
||||
err, strerror_r(errno, errbuf, sizeof (errbuf)));
|
||||
goto return_mes_rc;
|
||||
@ -821,7 +832,7 @@ void skygw_message_reset(skygw_message_t* mes)
|
||||
|
||||
if (err != 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
fprintf(stderr, "* Unlocking pthread mutex failed, due error %d, %s\n",
|
||||
err, strerror_r(errno, errbuf, sizeof (errbuf)));
|
||||
goto return_mes_rc;
|
||||
@ -923,7 +934,7 @@ skygw_file_t* skygw_file_init(const char* fname,
|
||||
{
|
||||
int eno = errno;
|
||||
errno = 0;
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
fprintf(stderr, "* Opening file %s failed due %d, %s.\n",
|
||||
file->sf_fname, eno, strerror_r(eno, errbuf, sizeof (errbuf)));
|
||||
free(file);
|
||||
@ -947,7 +958,7 @@ skygw_file_t* skygw_file_init(const char* fname,
|
||||
{
|
||||
int eno = errno;
|
||||
errno = 0;
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
fprintf(stderr, "failed to create symlink %s -> %s due %d, %s. Exiting.",
|
||||
fname, symlinkname, eno, strerror_r(eno, errbuf, sizeof (errbuf)));
|
||||
free(file);
|
||||
@ -983,7 +994,7 @@ void skygw_file_close(skygw_file_t* file)
|
||||
|
||||
if ((err = fclose(file->sf_file)) != 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
fprintf(stderr, "* Closing file %s failed due to %d, %s.\n",
|
||||
file->sf_fname, errno, strerror_r(errno, errbuf, sizeof (errbuf)));
|
||||
}
|
||||
@ -1159,7 +1170,7 @@ char* replace_literal(char* haystack, const char* needle, const char* replacemen
|
||||
|
||||
if (search_re == NULL)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
fprintf(stderr, "Regex memory allocation failed : %s\n",
|
||||
strerror_r(errno, errbuf, sizeof (errbuf)));
|
||||
newstr = haystack;
|
||||
@ -1172,7 +1183,7 @@ char* replace_literal(char* haystack, const char* needle, const char* replacemen
|
||||
|
||||
if (newstr == NULL)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
fprintf(stderr, "Regex memory allocation failed : %s\n",
|
||||
strerror_r(errno, errbuf, sizeof (errbuf)));
|
||||
free(search_re);
|
||||
|
@ -1,364 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#include <maxscale/slist.h>
|
||||
#include <maxscale/alloc.h>
|
||||
#include <maxscale/atomic.h>
|
||||
|
||||
static slist_cursor_t* slist_cursor_init(slist_t* list);
|
||||
static slist_t* slist_init_ex(bool create_cursors);
|
||||
static slist_node_t* slist_node_init(void* data, slist_cursor_t* cursor);
|
||||
static void slist_add_node(slist_t* list, slist_node_t* node);
|
||||
|
||||
#if defined(NOT_USED)
|
||||
static slist_node_t* slist_node_get_next(slist_node_t* curr_node);
|
||||
static slist_node_t* slist_get_first(slist_t* list);
|
||||
static slist_cursor_t* slist_get_cursor(slist_t* list);
|
||||
#endif /*< NOT_USED */
|
||||
|
||||
/** End of static function declarations */
|
||||
|
||||
static slist_t* slist_init_ex(bool create_cursors)
|
||||
{
|
||||
slist_t* list;
|
||||
|
||||
list = (slist_t*) MXS_CALLOC(1, sizeof (slist_t));
|
||||
MXS_ABORT_IF_NULL(list);
|
||||
list->slist_chk_top = CHK_NUM_SLIST;
|
||||
list->slist_chk_tail = CHK_NUM_SLIST;
|
||||
|
||||
if (create_cursors)
|
||||
{
|
||||
list->slist_cursors_list = slist_init_ex(false);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
static slist_node_t* slist_node_init(void* data, slist_cursor_t* cursor)
|
||||
{
|
||||
slist_node_t* node;
|
||||
|
||||
node = (slist_node_t*) MXS_CALLOC(1, sizeof (slist_node_t));
|
||||
MXS_ABORT_IF_NULL(node);
|
||||
node->slnode_chk_top = CHK_NUM_SLIST_NODE;
|
||||
node->slnode_chk_tail = CHK_NUM_SLIST_NODE;
|
||||
node->slnode_data = data;
|
||||
CHK_SLIST_NODE(node);
|
||||
|
||||
if (cursor != NULL)
|
||||
{
|
||||
node->slnode_cursor_refcount += 1;
|
||||
cursor->slcursor_pos = node;
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
static void slist_add_node(slist_t* list, slist_node_t* node)
|
||||
{
|
||||
CHK_SLIST(list);
|
||||
CHK_SLIST_NODE(node);
|
||||
|
||||
if (list->slist_tail != NULL)
|
||||
{
|
||||
CHK_SLIST_NODE(list->slist_tail);
|
||||
CHK_SLIST_NODE(list->slist_head);
|
||||
ss_dassert(list->slist_tail->slnode_next == NULL);
|
||||
list->slist_tail->slnode_next = node;
|
||||
}
|
||||
else
|
||||
{
|
||||
list->slist_head = node;
|
||||
}
|
||||
list->slist_tail = node;
|
||||
node->slnode_list = list;
|
||||
list->slist_nelems += 1;
|
||||
CHK_SLIST(list);
|
||||
}
|
||||
|
||||
|
||||
#if defined(NOT_USED)
|
||||
|
||||
static slist_node_t* slist_node_get_next(slist_node_t* curr_node)
|
||||
{
|
||||
CHK_SLIST_NODE(curr_node);
|
||||
|
||||
if (curr_node->slnode_next != NULL)
|
||||
{
|
||||
CHK_SLIST_NODE(curr_node->slnode_next);
|
||||
return (curr_node->slnode_next);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static slist_node_t* slist_get_first(slist_t* list)
|
||||
{
|
||||
CHK_SLIST(list);
|
||||
|
||||
if (list->slist_head != NULL)
|
||||
{
|
||||
CHK_SLIST_NODE(list->slist_head);
|
||||
return list->slist_head;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static slist_cursor_t* slist_get_cursor(slist_t* list)
|
||||
{
|
||||
CHK_SLIST(list);
|
||||
|
||||
slist_cursor_t* c;
|
||||
|
||||
c = slist_cursor_init(list);
|
||||
return c;
|
||||
}
|
||||
#endif /*< NOT_USED */
|
||||
|
||||
static slist_cursor_t* slist_cursor_init(slist_t* list)
|
||||
{
|
||||
CHK_SLIST(list);
|
||||
slist_cursor_t* c;
|
||||
|
||||
c = (slist_cursor_t *) MXS_CALLOC(1, sizeof (slist_cursor_t));
|
||||
MXS_ABORT_IF_NULL(c);
|
||||
c->slcursor_chk_top = CHK_NUM_SLIST_CURSOR;
|
||||
c->slcursor_chk_tail = CHK_NUM_SLIST_CURSOR;
|
||||
c->slcursor_list = list;
|
||||
/** Set cursor position is list is not empty */
|
||||
if (list->slist_head != NULL)
|
||||
{
|
||||
list->slist_head->slnode_cursor_refcount += 1;
|
||||
c->slcursor_pos = list->slist_head;
|
||||
}
|
||||
/** Add cursor to cursor list */
|
||||
slist_add_node(list->slist_cursors_list, slist_node_init(c, NULL));
|
||||
|
||||
CHK_SLIST_CURSOR(c);
|
||||
return c;
|
||||
}
|
||||
|
||||
/**
|
||||
* @node Create a cursor and a list with cursors supported. 19.6.2013 :
|
||||
* supports only cursor per list.
|
||||
*
|
||||
* Parameters:
|
||||
* @param void - <usage>
|
||||
* <description>
|
||||
*
|
||||
* @return returns a pointer to cursor, which is not positioned
|
||||
* because the list is empty.
|
||||
*
|
||||
*
|
||||
* @details (write detailed description here)
|
||||
*
|
||||
*/
|
||||
slist_cursor_t* slist_init(void)
|
||||
{
|
||||
slist_t* list;
|
||||
slist_cursor_t* slc;
|
||||
|
||||
list = slist_init_ex(true);
|
||||
CHK_SLIST(list);
|
||||
slc = slist_cursor_init(list);
|
||||
CHK_SLIST_CURSOR(slc);
|
||||
|
||||
return slc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @node moves cursor to the first node of list.
|
||||
*
|
||||
* Parameters:
|
||||
* @param c - <usage>
|
||||
* <description>
|
||||
*
|
||||
* @return true if there is first node in the list
|
||||
* false is the list is empty.
|
||||
*
|
||||
*
|
||||
* @details (write detailed description here)
|
||||
*
|
||||
*/
|
||||
bool slcursor_move_to_begin(slist_cursor_t* c)
|
||||
{
|
||||
bool succp = true;
|
||||
slist_t* list;
|
||||
|
||||
CHK_SLIST_CURSOR(c);
|
||||
list = c->slcursor_list;
|
||||
CHK_SLIST(list);
|
||||
c->slcursor_pos = list->slist_head;
|
||||
if (c->slcursor_pos == NULL)
|
||||
{
|
||||
succp = false;
|
||||
}
|
||||
return succp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @node moves cursor to next node
|
||||
*
|
||||
* Parameters:
|
||||
* @param c - <usage>
|
||||
* <description>
|
||||
*
|
||||
* @return true in success, false is there is no next node on the list.
|
||||
*
|
||||
*
|
||||
* @details (write detailed description here)
|
||||
*
|
||||
*/
|
||||
bool slcursor_step_ahead(slist_cursor_t* c)
|
||||
{
|
||||
bool succp = false;
|
||||
slist_node_t* node;
|
||||
CHK_SLIST_CURSOR(c);
|
||||
CHK_SLIST_NODE(c->slcursor_pos);
|
||||
|
||||
node = c->slcursor_pos->slnode_next;
|
||||
|
||||
if (node != NULL)
|
||||
{
|
||||
CHK_SLIST_NODE(node);
|
||||
c->slcursor_pos = node;
|
||||
succp = true;
|
||||
}
|
||||
return succp;
|
||||
}
|
||||
|
||||
void* slcursor_get_data(slist_cursor_t* c)
|
||||
{
|
||||
slist_node_t* node;
|
||||
void* data = NULL;
|
||||
|
||||
CHK_SLIST_CURSOR(c);
|
||||
node = c->slcursor_pos;
|
||||
|
||||
if (node != NULL)
|
||||
{
|
||||
CHK_SLIST_NODE(node);
|
||||
data = node->slnode_data;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @node Add data to the list by using cursor.
|
||||
*
|
||||
* Parameters:
|
||||
* @param c - <usage>
|
||||
* <description>
|
||||
*
|
||||
* @param data - <usage>
|
||||
* <description>
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*
|
||||
* @details (write detailed description here)
|
||||
*
|
||||
*/
|
||||
void slcursor_add_data(slist_cursor_t* c, void* data)
|
||||
{
|
||||
slist_t* list;
|
||||
slist_node_t* pos;
|
||||
|
||||
CHK_SLIST_CURSOR(c);
|
||||
list = c->slcursor_list;
|
||||
CHK_SLIST(list);
|
||||
if (c->slcursor_pos != NULL)
|
||||
{
|
||||
CHK_SLIST_NODE(c->slcursor_pos);
|
||||
}
|
||||
ss_dassert(list->slist_tail->slnode_next == NULL);
|
||||
pos = slist_node_init(data, c);
|
||||
slist_add_node(list, pos);
|
||||
CHK_SLIST(list);
|
||||
CHK_SLIST_CURSOR(c);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the node currently pointed by the cursor from the slist. This does not delete the data in the
|
||||
* node but will delete the structure pointing to that data. This is useful when
|
||||
* the user wants to free the allocated memory. After node removal, the cursor
|
||||
* will point to the node before the removed node.
|
||||
* @param c Cursor pointing to the data node to be removed
|
||||
*/
|
||||
void slcursor_remove_data(slist_cursor_t* c)
|
||||
{
|
||||
slist_node_t* node = c->slcursor_pos;
|
||||
int havemore = slist_size(c);
|
||||
slcursor_move_to_begin(c);
|
||||
|
||||
if (node == c->slcursor_pos)
|
||||
{
|
||||
c->slcursor_list->slist_head = c->slcursor_list->slist_head->slnode_next;
|
||||
slcursor_move_to_begin(c);
|
||||
atomic_add((int*) &node->slnode_list->slist_nelems, -1);
|
||||
atomic_add((int*) &node->slnode_cursor_refcount, -1);
|
||||
if (node->slnode_cursor_refcount == 0)
|
||||
{
|
||||
MXS_FREE(node);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
while (havemore)
|
||||
{
|
||||
if (c->slcursor_pos->slnode_next == node)
|
||||
{
|
||||
c->slcursor_pos->slnode_next = node->slnode_next;
|
||||
atomic_add((int*) &node->slnode_list->slist_nelems, -1);
|
||||
atomic_add((int*) &node->slnode_cursor_refcount, -1);
|
||||
if (node->slnode_cursor_refcount == 0)
|
||||
{
|
||||
MXS_FREE(node);
|
||||
}
|
||||
return;
|
||||
}
|
||||
havemore = slcursor_step_ahead(c);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the size of the slist.
|
||||
* @param c slist cursor which refers to a list
|
||||
* @return nummber of elements in the list
|
||||
*/
|
||||
size_t slist_size(slist_cursor_t* c)
|
||||
{
|
||||
return c->slcursor_list->slist_nelems;
|
||||
}
|
||||
|
||||
void slist_done(slist_cursor_t* c)
|
||||
{
|
||||
bool succp;
|
||||
void* data;
|
||||
|
||||
succp = slcursor_move_to_begin(c);
|
||||
|
||||
while (succp)
|
||||
{
|
||||
data = slcursor_get_data(c);
|
||||
MXS_FREE(data);
|
||||
succp = slcursor_step_ahead(c);
|
||||
}
|
||||
MXS_FREE(c->slcursor_list);
|
||||
MXS_FREE(c);
|
||||
}
|
||||
|
||||
|
||||
/** End of list implementation */
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <maxscale/spinlock.h>
|
||||
#include <maxscale/atomic.h>
|
||||
#include <time.h>
|
||||
#include <maxscale/skygw_debug.h>
|
||||
#include <maxscale/debug.h>
|
||||
|
||||
/**
|
||||
* Initialise a spinlock.
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#ifndef TEST_UTILS_H
|
||||
#define TEST_UTILS_H
|
||||
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -14,6 +14,7 @@
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/poll.h>
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/housekeeper.h>
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include <maxscale/gwdirs.h>
|
||||
#include <maxscale/adminusers.h>
|
||||
#include <maxscale/alloc.h>
|
||||
|
||||
#include <maxscale/skygw_utils.h>
|
||||
|
||||
/**
|
||||
* test1 default user
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
#include <maxscale/gwbitmask.h>
|
||||
|
||||
#include <maxscale/skygw_debug.h>
|
||||
#include <maxscale/debug.h>
|
||||
|
||||
/**
|
||||
* test1 Create a bitmap and mess around with it
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include <string.h>
|
||||
#include <maxscale/alloc.h>
|
||||
#include <maxscale/pcre2.h>
|
||||
#include <maxscale/skygw_debug.h>
|
||||
#include <maxscale/debug.h>
|
||||
|
||||
#define test_assert(a, b) if(!(a)){fprintf(stderr, b);return 1;}
|
||||
|
||||
|
@ -69,7 +69,7 @@ test1()
|
||||
|
||||
if (dcb->fd < 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
ss_dfprintf(stderr, "\nError on function call: socket() returned %d: %s\n", errno, strerror_r(errno, errbuf,
|
||||
sizeof(errbuf)));
|
||||
return 1;
|
||||
|
@ -60,7 +60,7 @@ int setnonblocking(int fd)
|
||||
|
||||
if ((fl = fcntl(fd, F_GETFL, 0)) == -1)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Can't GET fcntl for %i, errno = %d, %s.",
|
||||
fd,
|
||||
errno,
|
||||
@ -70,7 +70,7 @@ int setnonblocking(int fd)
|
||||
|
||||
if (fcntl(fd, F_SETFL, fl | O_NONBLOCK) == -1)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Can't SET fcntl for %i, errno = %d, %s",
|
||||
fd,
|
||||
errno,
|
||||
@ -346,7 +346,7 @@ static bool mkdir_all_internal(char *path, mode_t mask)
|
||||
}
|
||||
else
|
||||
{
|
||||
char err[STRERROR_BUFLEN];
|
||||
char err[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Failed to create directory '%s': %d, %s",
|
||||
path, errno, strerror_r(errno, err, sizeof(err)));
|
||||
}
|
||||
@ -355,7 +355,7 @@ static bool mkdir_all_internal(char *path, mode_t mask)
|
||||
}
|
||||
else
|
||||
{
|
||||
char err[STRERROR_BUFLEN];
|
||||
char err[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Failed to create directory '%s': %d, %s",
|
||||
path, errno, strerror_r(errno, err, sizeof(err)));
|
||||
}
|
||||
|
@ -1,3 +1,6 @@
|
||||
#pragma once
|
||||
#ifndef _GSSAPI_AUTH_H
|
||||
#define _GSSAPI_AUTH_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -11,13 +14,13 @@
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#ifndef _GSSAPI_AUTH_H
|
||||
#define _GSSAPI_AUTH_H
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <gssapi.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
/** Client auth plugin name */
|
||||
static const char auth_plugin_name[] = "auth_gssapi_client";
|
||||
|
||||
@ -48,4 +51,6 @@ void gssapi_auth_free(void *data);
|
||||
/** Report GSSAPI errors */
|
||||
void report_error(OM_uint32 major, OM_uint32 minor);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
9
server/modules/filter/cache/cache.h
vendored
9
server/modules/filter/cache/cache.h
vendored
@ -1,5 +1,6 @@
|
||||
#ifndef CACHE_H
|
||||
#define CACHE_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_FILTER_CACHE_CACHE_H
|
||||
#define _MAXSCALE_FILTER_CACHE_CACHE_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -15,6 +16,8 @@
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
#define CACHE_DEBUG_NONE 0
|
||||
#define CACHE_DEBUG_MATCHING 1
|
||||
#define CACHE_DEBUG_NON_MATCHING 2
|
||||
@ -35,4 +38,6 @@
|
||||
// Integer value
|
||||
#define CACHE_DEFAULT_DEBUG 0
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
11
server/modules/filter/cache/cache_storage_api.h
vendored
11
server/modules/filter/cache/cache_storage_api.h
vendored
@ -1,5 +1,6 @@
|
||||
#ifndef _MAXSCALE_FILTER_CACHE_CACHE_H
|
||||
#define _MAXSCALE_FILTER_CACHE_CACHE_H
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_FILTER_CACHE_CACHE_STORAGE_API_H
|
||||
#define _MAXSCALE_FILTER_CACHE_CACHE_STORAGE_API_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
@ -17,9 +18,9 @@
|
||||
#include <stdint.h>
|
||||
#include <maxscale/buffer.h>
|
||||
#include <maxscale/protocol/mysql.h>
|
||||
#include <maxscale/skygw_debug.h>
|
||||
#include <maxscale/debug.h>
|
||||
|
||||
EXTERN_C_BLOCK_BEGIN
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
typedef enum cache_result
|
||||
{
|
||||
@ -116,6 +117,6 @@ typedef struct cache_storage_api
|
||||
#define CACHE_STORAGE_ENTRY_POINT "CacheGetStorageAPI"
|
||||
typedef CACHE_STORAGE_API* (*CacheGetStorageAPIFN)();
|
||||
|
||||
EXTERN_C_BLOCK_END
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
2
server/modules/filter/cache/rules.c
vendored
2
server/modules/filter/cache/rules.c
vendored
@ -246,7 +246,7 @@ CACHE_RULES *cache_rules_load(const char *path, uint32_t debug)
|
||||
}
|
||||
else
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
|
||||
MXS_ERROR("Could not open rules file %s for reading: %s",
|
||||
path, strerror_r(errno, errbuf, sizeof(errbuf)));
|
||||
|
5
server/modules/filter/cache/rules.h
vendored
5
server/modules/filter/cache/rules.h
vendored
@ -1,3 +1,4 @@
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_FILTER_CACHE_RULES_H
|
||||
#define _MAXSCALE_FILTER_CACHE_RULES_H
|
||||
/*
|
||||
@ -13,12 +14,14 @@
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <stdbool.h>
|
||||
#include <jansson.h>
|
||||
#include <maxscale/buffer.h>
|
||||
#include <maxscale/session.h>
|
||||
#include <maxscale/pcre2.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
typedef enum cache_rule_attribute
|
||||
{
|
||||
@ -71,4 +74,6 @@ CACHE_RULES *cache_rules_parse(const char *json, uint32_t debug);
|
||||
bool cache_rules_should_store(CACHE_RULES *rules, const char *default_db, const GWBUF* query);
|
||||
bool cache_rules_should_use(CACHE_RULES *rules, const SESSION *session);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
6
server/modules/filter/cache/storage.h
vendored
6
server/modules/filter/cache/storage.h
vendored
@ -1,3 +1,4 @@
|
||||
#pragma once
|
||||
#ifndef _MAXSCALE_FILTER_CACHE_STORAGE_H
|
||||
#define _MAXSCALE_FILTER_CACHE_STORAGE_H
|
||||
/*
|
||||
@ -13,8 +14,11 @@
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include "cache_storage_api.h"
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
typedef struct cache_storage_module_t
|
||||
{
|
||||
void* handle;
|
||||
@ -24,4 +28,6 @@ typedef struct cache_storage_module_t
|
||||
CACHE_STORAGE_MODULE* cache_storage_open(const char *name);
|
||||
void cache_storage_close(CACHE_STORAGE_MODULE *module);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -14,6 +14,7 @@
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include "storage_rocksdb.h"
|
||||
#include <rocksdb/env.h>
|
||||
#include <rocksdb/version.h>
|
||||
|
@ -118,7 +118,7 @@ bool RocksDBStorage::Initialize()
|
||||
else if (errno != EEXIST)
|
||||
{
|
||||
initialized = false;
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
|
||||
MXS_ERROR("Failed to create storage directory %s: %s",
|
||||
u_storageDirectory.c_str(),
|
||||
|
@ -1,3 +1,4 @@
|
||||
#pragma once
|
||||
#ifndef _ROCKSDBSTORAGE_H
|
||||
#define _ROCKSDBSTORAGE_H
|
||||
/*
|
||||
@ -13,6 +14,7 @@
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include "storage_rocksdb.h"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
@ -1,3 +1,4 @@
|
||||
#pragma once
|
||||
#ifndef _STORAGE_ROCKSDB_H
|
||||
#define _STORAGE_ROCKSDB_H
|
||||
/*
|
||||
@ -14,6 +15,7 @@
|
||||
*/
|
||||
|
||||
#define MXS_MODULE_NAME "storage_rocksdb"
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
|
||||
#endif
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user