Changeset: 2b93b59b4f67 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/2b93b59b4f67
Modified Files:
gdk/gdk_utils.c
tools/mserver/mserver5.c
Branch: Jun2023
Log Message:
Move setting of SIGHUP for tracer to GDK; use sigaction instead of signal.
diffs (71 lines):
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -402,9 +402,38 @@ BATSIGabort(int nr)
static void
BATSIGinit(void)
{
+#ifdef HAVE_SIGACTION
+ struct sigaction sa;
+ sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+#ifdef SIGPIPE
+ sa.sa_handler = SIG_IGN;
+ sigaction(SIGPIPE, &sa, NULL);
+#endif
+#ifdef SIGHUP
+ sa.sa_handler = GDKtracer_reinit_basic;
+ sigaction(SIGHUP, &sa, NULL);
+#endif
+#ifdef WIN32
+ sa.sa_handler = BATSIGabort;
+ sigaction(SIGABRT, &sa, NULL);
+#endif
+#else
#ifdef SIGPIPE
(void) signal(SIGPIPE, SIG_IGN);
#endif
+#ifdef SIGHUP
+ // Register signal to GDKtracer (logrotate)
+ (void) signal(SIGHUP, GDKtracer_reinit_basic);
+#endif
+#ifdef WIN32
+ (void) signal(SIGABRT, BATSIGabort);
+#endif
+#endif
+#if defined(WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
+ _set_abort_behavior(0, _CALL_REPORTFAULT | _WRITE_ABORT_MSG);
+ _set_error_mode(_OUT_TO_STDERR);
+#endif
}
#endif /* NATIVE_WIN32 */
@@ -988,13 +1017,6 @@ GDKinit(opt *set, int setlen, bool embed
#ifndef NATIVE_WIN32
BATSIGinit();
#endif
-#ifdef WIN32
- (void) signal(SIGABRT, BATSIGabort);
-#if !defined(__MINGW32__) && !defined(__CYGWIN__)
- _set_abort_behavior(0, _CALL_REPORTFAULT | _WRITE_ABORT_MSG);
- _set_error_mode(_OUT_TO_STDERR);
-#endif
-#endif
MT_init();
/* now try to lock the database: go through all farms, and if
diff --git a/tools/mserver/mserver5.c b/tools/mserver/mserver5.c
--- a/tools/mserver/mserver5.c
+++ b/tools/mserver/mserver5.c
@@ -814,11 +814,6 @@ main(int argc, char **av)
free(err);
}
-#ifdef SIGHUP
- // Register signal to GDKtracer (logrotate)
- signal(SIGHUP, GDKtracer_reinit_basic);
-#endif
-
#ifdef _MSC_VER
printf("# MonetDB server is started. To stop server press Ctrl-C.\n");
#endif
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]