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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
c75d2c42
Commit
c75d2c42
authored
Aug 22, 2002
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup of waiting for pidfile in mysqladmin
client/mysqladmin.c: Cleanup of waiting for pidfile.
parent
85c41ebd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
19 deletions
+16
-19
client/mysqladmin.c
client/mysqladmin.c
+16
-19
No files found.
client/mysqladmin.c
View file @
c75d2c42
...
...
@@ -69,8 +69,8 @@ static void print_relative_header();
static
void
print_relative_line
();
static
void
truncate_names
();
static
my_bool
get_pidfile
(
MYSQL
*
mysql
,
char
*
pidfile
);
static
void
wait_pidfile
(
char
*
pidfile
,
my_bool
check_pidfile_status
,
time_t
last_modified
,
struct
stat
pidfile_status
);
static
void
wait_pidfile
(
char
*
pidfile
,
time_t
last_modified
,
struct
stat
*
pidfile_status
);
static
void
store_values
(
MYSQL_RES
*
result
);
/*
...
...
@@ -455,9 +455,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
{
char
pidfile
[
FN_REFLEN
];
my_bool
got_pidfile
=
0
;
time_t
last_modified
=
0
;
/* to keep compiler happy */
time_t
last_modified
=
0
;
struct
stat
pidfile_status
;
my_bool
check_pidfile_status
=
0
;
/*
Only wait for pidfile on local connections
...
...
@@ -465,10 +464,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
*/
if
(
mysql
->
unix_socket
&&
(
got_pidfile
=
!
get_pidfile
(
mysql
,
pidfile
))
&&
!
stat
(
pidfile
,
&
pidfile_status
))
{
check_pidfile_status
=
1
;
last_modified
=
pidfile_status
.
st_mtime
;
}
if
(
mysql_shutdown
(
mysql
))
{
...
...
@@ -483,8 +479,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
printf
(
"Shutdown signal sent to server; Waiting for pid file to disappear
\n
"
);
/* Wait until pid file is gone */
wait_pidfile
(
pidfile
,
check_pidfile_status
,
last_modified
,
pidfile_status
);
wait_pidfile
(
pidfile
,
last_modified
,
&
pidfile_status
);
}
break
;
}
...
...
@@ -1114,25 +1109,27 @@ static my_bool get_pidfile(MYSQL *mysql, char *pidfile)
}
static
void
wait_pidfile
(
char
*
pidfile
,
my_bool
check_pidfile_status
,
time_t
last_modified
,
struct
stat
pidfile_status
)
static
void
wait_pidfile
(
char
*
pidfile
,
time_t
last_modified
,
struct
stat
*
pidfile_status
)
{
char
buff
[
FN_REFLEN
];
int
fd
;
int
fd
=
-
1
;
uint
count
=
0
;
system_filename
(
buff
,
pidfile
);
while
(
(
fd
=
my_open
(
buff
,
O_RDONLY
,
MYF
(
0
)))
>=
0
&&
count
++
<
opt_shutdown_timeout
&&
!
interrupted
&&
(
!
check_pidfile_status
||
(
last_modified
==
pidfile_status
.
st_mtime
))
)
while
(
count
++
<=
opt_shutdown_timeout
&&
!
interrupted
&&
(
!
last_modified
||
(
last_modified
==
pidfile_status
->
st_mtime
))
&&
(
fd
=
my_open
(
buff
,
O_RDONLY
,
MYF
(
0
)))
>=
0
)
{
my_close
(
fd
,
MYF
(
0
));
sleep
(
1
);
if
(
stat
(
pidfile
,
&
pidfile_status
))
check_pidfile_status
=
0
;
if
(
last_modified
&&
stat
(
pidfile
,
pidfile_status
))
last_modified
=
0
;
}
if
(
check_pidfile_status
&&
(
last_modified
!=
pidfile_status
.
st_mtime
))
printf
(
"Warning; pid file changed while waiting for it to disappear!
\n
"
);
if
(
opt_verbose
&&
last_modified
&&
last_modified
!=
pidfile_status
->
st_mtime
)
printf
(
"Warning; pid file '%s' changed while waiting for it to disappear!
\n
"
,
buff
);
if
(
fd
>=
0
)
{
my_close
(
fd
,
MYF
(
0
));
...
...
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