Remove dependency on skygw_utils.h
- STRERROR_BUFLEN moved to cdefs.h and renamed to MXS_STRERROR_BUFLEN. Better would be to provide a 'const char* mxs_strerror(int errno)' that would have a thread specific buffer for the error message. - MIN and MAX also moved to defs.h as MXS_MIN and MXS_MAX. - Now only mlist.h of the headers depend upon skygw_utils.h.
This commit is contained in:
@ -568,7 +568,7 @@ createInstance(SERVICE *service, char **options)
|
||||
mkdir_rval = mkdir(inst->binlogdir, 0700);
|
||||
if (mkdir_rval == -1)
|
||||
{
|
||||
char err_msg[STRERROR_BUFLEN];
|
||||
char err_msg[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Service %s, Failed to create binlog directory '%s': [%d] %s",
|
||||
service->name,
|
||||
inst->binlogdir,
|
||||
@ -1628,7 +1628,7 @@ errorReply(ROUTER *instance,
|
||||
ROUTER_INSTANCE *router = (ROUTER_INSTANCE *)instance;
|
||||
int error;
|
||||
socklen_t len;
|
||||
char msg[STRERROR_BUFLEN + 1 + 5] = "";
|
||||
char msg[MXS_STRERROR_BUFLEN + 1 + 5] = "";
|
||||
char *errmsg;
|
||||
unsigned long mysql_errno;
|
||||
|
||||
@ -1688,7 +1688,7 @@ errorReply(ROUTER *instance,
|
||||
getsockopt(router->master->fd, SOL_SOCKET, SO_ERROR, &error, &len) == 0 &&
|
||||
error != 0)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
char errbuf[MXS_STRERROR_BUFLEN];
|
||||
sprintf(msg, "%s ", strerror_r(error, errbuf, sizeof(errbuf)));
|
||||
}
|
||||
else
|
||||
|
@ -244,7 +244,7 @@ blr_file_create(ROUTER_INSTANCE *router, char *file)
|
||||
}
|
||||
|
||||
int created = 0;
|
||||
char err_msg[STRERROR_BUFLEN];
|
||||
char err_msg[MXS_STRERROR_BUFLEN];
|
||||
|
||||
char path[PATH_MAX + 1] = "";
|
||||
|
||||
@ -366,7 +366,7 @@ blr_write_binlog_record(ROUTER_INSTANCE *router, REP_HEADER *hdr, uint32_t size,
|
||||
if ((n = pwrite(router->binlog_fd, buf, size,
|
||||
router->last_written)) != size)
|
||||
{
|
||||
char err_msg[STRERROR_BUFLEN];
|
||||
char err_msg[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("%s: Failed to write binlog record at %lu of %s, %s. "
|
||||
"Truncating to previous record.",
|
||||
router->service->name, router->last_written,
|
||||
@ -594,7 +594,7 @@ blr_read_binlog(ROUTER_INSTANCE *router, BLFILE *file, unsigned long pos, REP_HE
|
||||
break;
|
||||
case -1:
|
||||
{
|
||||
char err_msg[STRERROR_BUFLEN];
|
||||
char err_msg[MXS_STRERROR_BUFLEN];
|
||||
snprintf(errmsg, BINLOG_ERROR_MSG_LEN, "Failed to read binlog file '%s'; (%s), event at %lu",
|
||||
file->binlogname, strerror_r(errno, err_msg, sizeof(err_msg)), pos);
|
||||
|
||||
@ -677,7 +677,7 @@ blr_read_binlog(ROUTER_INSTANCE *router, BLFILE *file, unsigned long pos, REP_HE
|
||||
break;
|
||||
case -1:
|
||||
{
|
||||
char err_msg[STRERROR_BUFLEN];
|
||||
char err_msg[MXS_STRERROR_BUFLEN];
|
||||
snprintf(errmsg, BINLOG_ERROR_MSG_LEN,
|
||||
"Failed to reread header in binlog file '%s'; (%s), event at %lu",
|
||||
file->binlogname, strerror_r(errno, err_msg, sizeof(err_msg)), pos);
|
||||
@ -737,7 +737,7 @@ blr_read_binlog(ROUTER_INSTANCE *router, BLFILE *file, unsigned long pos, REP_HE
|
||||
{
|
||||
if (n == -1)
|
||||
{
|
||||
char err_msg[STRERROR_BUFLEN];
|
||||
char err_msg[MXS_STRERROR_BUFLEN];
|
||||
snprintf(errmsg, BINLOG_ERROR_MSG_LEN,
|
||||
"Error reading the binlog event at %lu in binlog file '%s';"
|
||||
"(%s), expected %d bytes.",
|
||||
@ -1906,7 +1906,7 @@ blr_file_write_master_config(ROUTER_INSTANCE *router, char *error)
|
||||
|
||||
char filename[len + sizeof('/') + sizeof(MASTER_INI)]; // sizeof includes NULL
|
||||
char tmp_file[len + sizeof('/') + sizeof(MASTER_INI) + sizeof('.') + sizeof(TMP)];
|
||||
char err_msg[STRERROR_BUFLEN];
|
||||
char err_msg[MXS_STRERROR_BUFLEN];
|
||||
char *ssl_ca;
|
||||
char *ssl_cert;
|
||||
char *ssl_key;
|
||||
|
@ -1291,7 +1291,7 @@ blr_handle_binlog_record(ROUTER_INSTANCE *router, GWBUF *pkt)
|
||||
|
||||
if (router->master_chksum)
|
||||
{
|
||||
uint32_t size = MIN(len - extra_bytes - semisync_bytes,
|
||||
uint32_t size = MXS_MIN(len - extra_bytes - semisync_bytes,
|
||||
router->checksum_size);
|
||||
|
||||
router->stored_checksum = crc32(router->stored_checksum,
|
||||
@ -1342,7 +1342,7 @@ blr_handle_binlog_record(ROUTER_INSTANCE *router, GWBUF *pkt)
|
||||
size = len - (check_packet_len + MYSQL_CHECKSUM_LEN);
|
||||
}
|
||||
|
||||
size = MIN(size, router->checksum_size);
|
||||
size = MXS_MIN(size, router->checksum_size);
|
||||
|
||||
if (router->checksum_size > 0)
|
||||
{
|
||||
@ -2454,7 +2454,7 @@ GWBUF
|
||||
break;
|
||||
case -1:
|
||||
{
|
||||
char err_msg[STRERROR_BUFLEN];
|
||||
char err_msg[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Reading saved events: failed to read binlog "
|
||||
"file %s at position %llu"
|
||||
" (%s).", router->binlog_name,
|
||||
@ -2514,7 +2514,7 @@ GWBUF
|
||||
{
|
||||
if (n == -1)
|
||||
{
|
||||
char err_msg[STRERROR_BUFLEN];
|
||||
char err_msg[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Reading saved events: the event at %llu in %s. "
|
||||
"%s, expected %d bytes.",
|
||||
pos, router->binlog_name,
|
||||
@ -2806,7 +2806,7 @@ blr_write_data_into_binlog(ROUTER_INSTANCE *router, uint32_t data_len, uint8_t *
|
||||
if ((n = pwrite(router->binlog_fd, buf, data_len,
|
||||
router->last_written)) != data_len)
|
||||
{
|
||||
char err_msg[STRERROR_BUFLEN];
|
||||
char err_msg[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("%s: Failed to write binlog record at %lu of %s, %s. "
|
||||
"Truncating to previous record.",
|
||||
router->service->name, router->last_written,
|
||||
@ -2934,7 +2934,7 @@ bool blr_send_event(blr_thread_role_t role,
|
||||
while (rval && len > 0)
|
||||
{
|
||||
uint64_t payload_len = first ? MYSQL_PACKET_LENGTH_MAX - 1 :
|
||||
MIN(MYSQL_PACKET_LENGTH_MAX, len);
|
||||
MXS_MIN(MYSQL_PACKET_LENGTH_MAX, len);
|
||||
|
||||
if (blr_send_packet(slave, buf, payload_len, first))
|
||||
{
|
||||
|
@ -874,7 +874,7 @@ blr_slave_query(ROUTER_INSTANCE *router, ROUTER_SLAVE *slave, GWBUF *queue)
|
||||
|
||||
if (removed_cfg == -1)
|
||||
{
|
||||
char err_msg[STRERROR_BUFLEN];
|
||||
char err_msg[MXS_STRERROR_BUFLEN];
|
||||
snprintf(error_string, BINLOG_ERROR_MSG_LEN,
|
||||
"Error removing %s, %s, errno %u", path,
|
||||
strerror_r(errno, err_msg, sizeof(err_msg)), errno);
|
||||
|
Reference in New Issue
Block a user