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
0c33b59b
Commit
0c33b59b
authored
20 years ago
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge tulin@bk-internal.mysql.com:/home/bk/mysql-4.1
into poseidon.(none):/home/tomas/mysql-4.1
parents
cba27e4a
9cf1542e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
76 additions
and
57 deletions
+76
-57
ndb/src/kernel/main.cpp
ndb/src/kernel/main.cpp
+76
-57
No files found.
ndb/src/kernel/main.cpp
View file @
0c33b59b
...
@@ -41,7 +41,9 @@
...
@@ -41,7 +41,9 @@
extern
EventLogger
g_eventLogger
;
extern
EventLogger
g_eventLogger
;
void
catchsigs
(
bool
ignore
);
// for process signal handling
void
catchsigs
(
bool
ignore
);
// for process signal handling
extern
"C"
void
handler
(
int
signo
);
// for process signal handling
extern
"C"
void
handler_shutdown
(
int
signum
);
// for process signal handling
extern
"C"
void
handler_error
(
int
signum
);
// for process signal handling
// Shows system information
// Shows system information
void
systemInfo
(
const
Configuration
&
conf
,
void
systemInfo
(
const
Configuration
&
conf
,
...
@@ -248,74 +250,91 @@ systemInfo(const Configuration & config, const LogLevel & logLevel){
...
@@ -248,74 +250,91 @@ systemInfo(const Configuration & config, const LogLevel & logLevel){
}
}
static
void
handler_register
(
int
signum
,
sighandler_t
handler
,
bool
ignore
)
{
if
(
ignore
)
{
if
(
signum
!=
SIGCHLD
)
signal
(
signum
,
SIG_IGN
);
}
else
signal
(
signum
,
handler
);
}
void
void
catchsigs
(
bool
ignore
){
catchsigs
(
bool
ignore
){
#if ! defined NDB_SOFTOSE && !defined NDB_OSE
#if ! defined NDB_SOFTOSE && !defined NDB_OSE
#if defined SIGRTMIN
static
const
int
signals_shutdown
[]
=
{
#define MAX_SIG_CATCH SIGRTMIN
#ifdef SIGBREAK
#elif defined NSIG
SIGBREAK
,
#define MAX_SIG_CATCH NSIG
#else
#error "neither SIGRTMIN or NSIG is defined on this platform, please report bug at bugs.mysql.com"
#endif
#endif
SIGHUP
,
// Makes the main process catch process signals, eg installs a
SIGINT
,
// handler named "handler". "handler" will then be called is instead
#if defined SIGPWR
// of the defualt process signal handler)
SIGPWR
,
if
(
ignore
){
#elif defined SIGINFO
for
(
int
i
=
1
;
i
<
MAX_SIG_CATCH
;
i
++
){
SIGINFO
,
if
(
i
!=
SIGCHLD
)
signal
(
i
,
SIG_IGN
);
}
}
else
{
for
(
int
i
=
1
;
i
<
MAX_SIG_CATCH
;
i
++
){
signal
(
i
,
handler
);
}
}
#endif
#endif
}
SIGQUIT
,
SIGTERM
,
extern
"C"
#ifdef SIGTSTP
void
SIGTSTP
,
handler
(
int
sig
){
#endif
switch
(
sig
){
SIGTTIN
,
case
SIGHUP
:
/* 1 - Hang up */
SIGTTOU
case
SIGINT
:
/* 2 - Interrupt */
};
case
SIGQUIT
:
/* 3 - Quit */
case
SIGTERM
:
/* 15 - Terminate */
static
const
int
signals_error
[]
=
{
#ifdef SIGPWR
SIGABRT
,
case
SIGPWR
:
/* 19 - Power fail */
SIGALRM
,
#ifdef SIGBUS
SIGBUS
,
#endif
SIGCHLD
,
SIGFPE
,
SIGILL
,
#ifdef SIGIO
SIGIO
,
#endif
#endif
#ifdef SIGPOLL
#ifdef SIGPOLL
case
SIGPOLL
:
/* 22 */
SIGPOLL
,
#endif
#endif
case
SIGSTOP
:
/* 23 */
SIGSEGV
,
case
SIGTSTP
:
/* 24 */
#ifdef SIGTRAP
case
SIGTTIN
:
/* 26 */
SIGTRAP
case
SIGTTOU
:
/* 27 */
globalData
.
theRestartFlag
=
perform_stop
;
break
;
#ifdef SIGWINCH
case
SIGWINCH
:
#endif
#endif
case
SIGPIPE
:
};
/**
#endif
* Can happen in TCP Transporter
*
static
const
int
signals_ignore
[]
=
{
* Just ignore
SIGPIPE
*/
};
break
;
default:
for
(
size_t
i
=
0
;
i
<
sizeof
(
signals_shutdown
)
/
sizeof
(
signals_shutdown
[
0
]);
i
++
)
// restart the system
handler_register
(
signals_shutdown
[
i
],
handler_shutdown
,
ignore
);
char
errorData
[
40
];
for
(
size_t
i
=
0
;
i
<
sizeof
(
signals_error
)
/
sizeof
(
signals_error
[
0
]);
i
++
)
snprintf
(
errorData
,
40
,
"Signal %d received"
,
sig
);
handler_register
(
signals_error
[
i
],
handler_error
,
ignore
);
ERROR_SET
(
fatal
,
0
,
errorData
,
__FILE__
);
for
(
size_t
i
=
0
;
i
<
sizeof
(
signals_ignore
)
/
sizeof
(
signals_ignore
[
0
]);
i
++
)
break
;
handler_register
(
signals_ignore
[
i
],
SIG_IGN
,
ignore
);
}
}
extern
"C"
void
handler_shutdown
(
int
signum
){
g_eventLogger
.
info
(
"Received signal %d. Performing stop."
,
signum
);
globalData
.
theRestartFlag
=
perform_stop
;
}
extern
"C"
void
handler_error
(
int
signum
){
g_eventLogger
.
info
(
"Received signal %d. Running error handler."
,
signum
);
// restart the system
char
errorData
[
40
];
snprintf
(
errorData
,
40
,
"Signal %d received"
,
signum
);
ERROR_SET
(
fatal
,
0
,
errorData
,
__FILE__
);
}
}
...
...
This diff is collapsed.
Click to expand it.
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