1
0
mirror of https://github.com/MariaDB/server.git synced 2025-09-02 09:41:40 +03:00

Polishing:

- change some return types from int to bool;
  - add [ERROR] tag to log_error() output;
  - add [INFO] tag to log_info() output;
  - change log messages to be more consistent.


server-tools/instance-manager/IMService.cpp:
  Log polishing.
server-tools/instance-manager/commands.cc:
  Log polishing.
server-tools/instance-manager/commands.h:
  Eliminate warnings.
server-tools/instance-manager/instance.cc:
  Log polishing.
server-tools/instance-manager/instance_map.cc:
  Log polishing.
server-tools/instance-manager/instance_options.cc:
  1) Log polishing.
  2) Change int-return type to bool.
server-tools/instance-manager/instance_options.h:
  Change int-return type to bool.
server-tools/instance-manager/listener.cc:
  Log polishing.
server-tools/instance-manager/log.cc:
  Log polishing.
server-tools/instance-manager/log.h:
  Log polishing.
server-tools/instance-manager/manager.cc:
  Log polishing.
server-tools/instance-manager/mysql_connection.cc:
  Log polishing.
server-tools/instance-manager/mysql_connection.h:
  Change int-return type to bool.
server-tools/instance-manager/mysqlmanager.cc:
  Log polishing.
server-tools/instance-manager/priv.cc:
  Log polishing.
server-tools/instance-manager/thread_registry.cc:
  1. Print pthread_t as (unsigned long), not as (signed long)
  to avoid negative identifiers in output.
  2. Print thread id after it will be initialized, not before.
server-tools/instance-manager/user_map.cc:
  Log polishing.
This commit is contained in:
unknown
2006-11-21 17:47:14 +03:00
parent cbfff7304d
commit 7c35c3d5e6
17 changed files with 270 additions and 210 deletions

View File

@@ -36,7 +36,7 @@
/* Create "mysqld ..." command in the buffer */
static inline int create_mysqld_command(Buffer *buf,
static inline bool create_mysqld_command(Buffer *buf,
const LEX_STRING *mysqld_path,
const LEX_STRING *option)
{
@@ -55,9 +55,9 @@ static inline int create_mysqld_command(Buffer *buf,
/* here the '\0' character is copied from the option string */
buf->append(position, option->str, option->length + 1);
return buf->is_error();
return buf->is_error() ? TRUE : FALSE;
}
return 1;
return TRUE;
}
@@ -152,27 +152,36 @@ err:
Get mysqld version string from "mysqld --version" output.
RETURN
0 - ok
1 - error occured
FALSE - ok
TRUE - error occured
*/
int Instance_options::fill_instance_version()
bool Instance_options::fill_instance_version()
{
char result[MAX_VERSION_LENGTH];
LEX_STRING version_option=
{ C_STRING_WITH_LEN(" --no-defaults --version") };
int rc= 1;
Buffer cmd(mysqld_path.length + version_option.length + 1);
if (create_mysqld_command(&cmd, &mysqld_path, &version_option))
goto err;
{
log_error("Failed to get version of '%s': out of memory.",
(const char *) mysqld_path.str);
return TRUE;
}
bzero(result, MAX_VERSION_LENGTH);
rc= parse_output_and_get_value(cmd.buffer, "Ver", result,
MAX_VERSION_LENGTH, GET_LINE);
if (parse_output_and_get_value(cmd.buffer, "Ver", result,
MAX_VERSION_LENGTH, GET_LINE))
{
log_error("Failed to get version of '%s': unexpected output.",
(const char *) mysqld_path.str);
return TRUE;
}
DBUG_ASSERT(*result != '\0');
if (*result != '\0')
{
char *start;
/* chop the newline from the end of the version string */
@@ -184,11 +193,8 @@ int Instance_options::fill_instance_version()
mysqld_version= strdup_root(&alloc, start);
}
err:
if (rc)
log_error("fill_instance_version: Failed to get version of '%s'",
(const char *) mysqld_path.str);
return rc;
return FALSE;
}
@@ -207,28 +213,37 @@ err:
script(for example libtool) or a symlink.
RETURN
0 - ok
1 - error occured
FALSE - ok
TRUE - error occured
*/
int Instance_options::fill_mysqld_real_path()
bool Instance_options::fill_mysqld_real_path()
{
char result[FN_REFLEN];
LEX_STRING help_option=
{ C_STRING_WITH_LEN(" --no-defaults --help") };
int rc= 1;
Buffer cmd(mysqld_path.length + help_option.length);
if (create_mysqld_command(&cmd, &mysqld_path, &help_option))
goto err;
{
log_error("Failed to get real path of '%s': out of memory.",
(const char *) mysqld_path.str);
return TRUE;
}
bzero(result, FN_REFLEN);
rc= parse_output_and_get_value(cmd.buffer, "Usage: ",
if (parse_output_and_get_value(cmd.buffer, "Usage: ",
result, FN_REFLEN,
GET_LINE);
GET_LINE))
{
log_error("Failed to get real path of '%s': unexpected output.",
(const char *) mysqld_path.str);
return TRUE;
}
DBUG_ASSERT(*result != '\0');
if (*result != '\0')
{
char* options_str;
/* chop the path of at [OPTIONS] */
@@ -237,10 +252,8 @@ int Instance_options::fill_mysqld_real_path()
mysqld_real_path.str= strdup_root(&alloc, result);
mysqld_real_path.length= strlen(mysqld_real_path.str);
}
err:
if (rc)
log_error("fill_mysqld_real_path: Failed to get real path of mysqld");
return rc;
return FALSE;
}
@@ -257,11 +270,11 @@ err:
file name and placement.
RETURN
0 - ok
1 - error occured
FALSE - ok
TRUE - error occured
*/
int Instance_options::fill_log_options()
bool Instance_options::fill_log_options()
{
Buffer buff;
enum { MAX_LOG_OPTION_LENGTH= 256 };
@@ -287,7 +300,7 @@ int Instance_options::fill_log_options()
if (mysqld_datadir == NULL)
{
if (get_default_option(datadir, MAX_LOG_OPTION_LENGTH, "--datadir"))
goto err;
return TRUE;
}
else
{
@@ -325,7 +338,7 @@ int Instance_options::fill_log_options()
if ((MAX_LOG_OPTION_LENGTH - strlen(full_name)) <=
strlen(log_files->default_suffix))
goto err;
return TRUE;
strmov(full_name + strlen(full_name), log_files->default_suffix);
@@ -345,15 +358,13 @@ int Instance_options::fill_log_options()
datadir, "", MY_UNPACK_FILENAME | MY_SAFE_PATH);
if (!(*(log_files->value)= strdup_root(&alloc, full_name)))
goto err;
return TRUE;
}
}
}
}
return 0;
err:
return 1;
return FALSE;
}