Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
bb8e5b62
Commit
bb8e5b62
authored
Feb 13, 2005
by
petr@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
various fixes
parent
6b50b5b0
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
21 deletions
+38
-21
server-tools/instance-manager/buffer.cc
server-tools/instance-manager/buffer.cc
+4
-4
server-tools/instance-manager/buffer.h
server-tools/instance-manager/buffer.h
+2
-1
server-tools/instance-manager/commands.cc
server-tools/instance-manager/commands.cc
+8
-8
server-tools/instance-manager/instance_options.cc
server-tools/instance-manager/instance_options.cc
+2
-4
server-tools/instance-manager/manager.cc
server-tools/instance-manager/manager.cc
+8
-1
server-tools/instance-manager/parse_output.cc
server-tools/instance-manager/parse_output.cc
+14
-3
No files found.
server-tools/instance-manager/buffer.cc
View file @
bb8e5b62
...
@@ -81,10 +81,10 @@ int Buffer::reserve(uint position, uint len_arg)
...
@@ -81,10 +81,10 @@ int Buffer::reserve(uint position, uint len_arg)
if
(
position
+
len_arg
>=
buffer_size
)
if
(
position
+
len_arg
>=
buffer_size
)
{
{
buffer
=
(
char
*
)
realloc
(
buffer
,
buffer
=
(
char
*
)
my_
realloc
(
buffer
,
min
(
MAX_BUFFER_SIZE
,
min
(
MAX_BUFFER_SIZE
,
max
((
uint
)
(
buffer_size
*
1.5
),
max
((
uint
)
(
buffer_size
*
1.5
),
position
+
len_arg
)
));
position
+
len_arg
)),
MYF
(
0
));
if
(
buffer
==
NULL
)
if
(
buffer
==
NULL
)
goto
err
;
goto
err
;
buffer_size
=
(
uint
)
(
buffer_size
*
1.5
);
buffer_size
=
(
uint
)
(
buffer_size
*
1.5
);
...
...
server-tools/instance-manager/buffer.h
View file @
bb8e5b62
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_global.h>
#include <my_global.h>
#include <my_sys.h>
#ifdef __GNUC__
#ifdef __GNUC__
#pragma interface
#pragma interface
...
@@ -45,7 +46,7 @@ public:
...
@@ -45,7 +46,7 @@ public:
/*
/*
As append() will invokes realloc() anyway, it's ok if malloc returns 0
As append() will invokes realloc() anyway, it's ok if malloc returns 0
*/
*/
if
(
!
(
buffer
=
(
char
*
)
m
alloc
(
buffer_size
)))
if
(
!
(
buffer
=
(
char
*
)
m
y_malloc
(
buffer_size
,
MYF
(
0
)
)))
buffer_size
=
0
;
buffer_size
=
0
;
}
}
...
...
server-tools/instance-manager/commands.cc
View file @
bb8e5b62
...
@@ -184,8 +184,8 @@ int Show_instance_status::do_command(struct st_net *net,
...
@@ -184,8 +184,8 @@ int Show_instance_status::do_command(struct st_net *net,
}
}
if
(
my_net_write
(
net
,
send_buff
.
buffer
,
(
uint
)
position
)
||
if
(
send_buff
.
is_error
(
)
||
send_buff
.
is_error
(
))
my_net_write
(
net
,
send_buff
.
buffer
,
(
uint
)
position
))
goto
err
;
goto
err
;
}
}
...
@@ -271,8 +271,8 @@ int Show_instance_options::do_command(struct st_net *net,
...
@@ -271,8 +271,8 @@ int Show_instance_options::do_command(struct st_net *net,
store_to_string
(
&
send_buff
,
store_to_string
(
&
send_buff
,
(
char
*
)
instance
->
options
.
mysqld_path
,
(
char
*
)
instance
->
options
.
mysqld_path
,
&
position
);
&
position
);
if
(
my_net_write
(
net
,
send_buff
.
buffer
,
(
uint
)
position
)
||
if
(
send_buff
.
is_error
(
)
||
send_buff
.
is_error
(
))
my_net_write
(
net
,
send_buff
.
buffer
,
(
uint
)
position
))
goto
err
;
goto
err
;
}
}
...
@@ -281,8 +281,8 @@ int Show_instance_options::do_command(struct st_net *net,
...
@@ -281,8 +281,8 @@ int Show_instance_options::do_command(struct st_net *net,
position
=
0
;
position
=
0
;
store_to_string
(
&
send_buff
,
(
char
*
)
"nonguarded"
,
&
position
);
store_to_string
(
&
send_buff
,
(
char
*
)
"nonguarded"
,
&
position
);
store_to_string
(
&
send_buff
,
""
,
&
position
);
store_to_string
(
&
send_buff
,
""
,
&
position
);
if
(
my_net_write
(
net
,
send_buff
.
buffer
,
(
uint
)
position
)
||
if
(
send_buff
.
is_error
(
)
||
send_buff
.
is_error
(
))
my_net_write
(
net
,
send_buff
.
buffer
,
(
uint
)
position
))
goto
err
;
goto
err
;
}
}
...
@@ -299,8 +299,8 @@ int Show_instance_options::do_command(struct st_net *net,
...
@@ -299,8 +299,8 @@ int Show_instance_options::do_command(struct st_net *net,
store_to_string
(
&
send_buff
,
option_value
+
1
,
&
position
);
store_to_string
(
&
send_buff
,
option_value
+
1
,
&
position
);
/* join name and the value into the same option again */
/* join name and the value into the same option again */
*
option_value
=
'='
;
*
option_value
=
'='
;
if
(
my_net_write
(
net
,
send_buff
.
buffer
,
(
uint
)
position
)
||
if
(
send_buff
.
is_error
(
)
||
send_buff
.
is_error
(
))
my_net_write
(
net
,
send_buff
.
buffer
,
(
uint
)
position
))
goto
err
;
goto
err
;
}
}
}
}
...
...
server-tools/instance-manager/instance_options.cc
View file @
bb8e5b62
...
@@ -80,9 +80,7 @@ void Instance_options::get_pid_filename(char *result)
...
@@ -80,9 +80,7 @@ void Instance_options::get_pid_filename(char *result)
char
datadir
[
MAX_PATH_LEN
];
char
datadir
[
MAX_PATH_LEN
];
if
(
mysqld_datadir
==
NULL
)
if
(
mysqld_datadir
==
NULL
)
{
get_default_option
(
datadir
,
sizeof
(
datadir
),
"--datadir"
);
get_default_option
(
datadir
,
sizeof
(
datadir
),
"--datadir"
);
}
else
else
strxnmov
(
datadir
,
MAX_PATH_LEN
-
1
,
strchr
(
mysqld_datadir
,
'='
)
+
1
,
strxnmov
(
datadir
,
MAX_PATH_LEN
-
1
,
strchr
(
mysqld_datadir
,
'='
)
+
1
,
"/"
,
NullS
);
"/"
,
NullS
);
...
@@ -106,8 +104,8 @@ pid_t Instance_options::get_pid()
...
@@ -106,8 +104,8 @@ pid_t Instance_options::get_pid()
FILE
*
pid_file_stream
;
FILE
*
pid_file_stream
;
/* get the pid */
/* get the pid */
if
(
pid_file_stream
=
my_fopen
(
pid_file_with_path
,
if
(
(
pid_file_stream
=
my_fopen
(
pid_file_with_path
,
O_RDONLY
|
O_BINARY
,
MYF
(
0
)))
O_RDONLY
|
O_BINARY
,
MYF
(
0
)))
!=
NULL
)
{
{
pid_t
pid
;
pid_t
pid
;
...
...
server-tools/instance-manager/manager.cc
View file @
bb8e5b62
...
@@ -171,7 +171,14 @@ void manager(const Options &options)
...
@@ -171,7 +171,14 @@ void manager(const Options &options)
while
(
!
shutdown_complete
)
while
(
!
shutdown_complete
)
{
{
sigwait
(
&
mask
,
&
signo
);
int
status
=
0
;
if
(
status
=
my_sigwait
(
&
mask
,
&
signo
))
{
log_error
(
"sigwait() failed"
);
goto
err
;
}
switch
(
signo
)
switch
(
signo
)
{
{
case
THR_SERVER_ALARM
:
case
THR_SERVER_ALARM
:
...
...
server-tools/instance-manager/parse_output.cc
View file @
bb8e5b62
...
@@ -36,6 +36,10 @@
...
@@ -36,6 +36,10 @@
DESCRIPTION
DESCRIPTION
Parse output of the "command". Find the "word" and return the next one
Parse output of the "command". Find the "word" and return the next one
RETURN
0 - ok
1 - error occured
*/
*/
int
parse_output_and_get_value
(
const
char
*
command
,
const
char
*
word
,
int
parse_output_and_get_value
(
const
char
*
command
,
const
char
*
word
,
...
@@ -49,7 +53,8 @@ int parse_output_and_get_value(const char *command, const char *word,
...
@@ -49,7 +53,8 @@ int parse_output_and_get_value(const char *command, const char *word,
wordlen
=
strlen
(
word
);
wordlen
=
strlen
(
word
);
output
=
popen
(
command
,
"r"
);
if
((
output
=
popen
(
command
,
"r"
))
==
NULL
)
goto
err
;
/*
/*
We want fully buffered stream. We also want system to
We want fully buffered stream. We also want system to
...
@@ -69,15 +74,18 @@ int parse_output_and_get_value(const char *command, const char *word,
...
@@ -69,15 +74,18 @@ int parse_output_and_get_value(const char *command, const char *word,
these are '/', '-' and '.' in the path expressions and filenames)
these are '/', '-' and '.' in the path expressions and filenames)
*/
*/
get_word
((
const
char
**
)
&
linep
,
&
lineword_len
,
NONSPACE
);
get_word
((
const
char
**
)
&
linep
,
&
lineword_len
,
NONSPACE
);
if
(
!
strncmp
(
word
,
linep
,
wordlen
)
&&
*
result
!=
'\0'
)
if
(
!
strncmp
(
word
,
linep
,
wordlen
))
{
{
/*
/*
If we have found the word, return the next one. This is usually
If we have found the word, return the next one. This is usually
an option value.
an option value.
*/
*/
linep
+=
lineword_len
;
/* swallow the previous one */
get_word
((
const
char
**
)
&
linep
,
&
lineword_len
,
NONSPACE
);
get_word
((
const
char
**
)
&
linep
,
&
lineword_len
,
NONSPACE
);
DBUG_ASSERT
(
result_len
>
lineword_len
);
if
(
result_len
<=
lineword_len
)
goto
err
;
strncpy
(
result
,
linep
,
lineword_len
);
strncpy
(
result
,
linep
,
lineword_len
);
result
[
lineword_len
]
=
'\0'
;
goto
pclose
;
goto
pclose
;
}
}
}
}
...
@@ -87,4 +95,7 @@ pclose:
...
@@ -87,4 +95,7 @@ pclose:
return
1
;
return
1
;
return
0
;
return
0
;
err:
return
1
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment