ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/init.C
(Generate patch)

Comparing deliantra/server/server/init.C (file contents):
Revision 1.83 by root, Sat Apr 23 04:56:56 2011 UTC vs.
Revision 1.88 by root, Sat Nov 17 23:40:04 2018 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2017,2018 Marc Alexander Lehmann / the Deliantra team
4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 5 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team 6 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992 Frank Tore Johansen 7 * Copyright (©) 1992 Frank Tore Johansen
7 * 8 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 9 * Deliantra is free software: you can redistribute it and/or modify it under
9 * the terms of the Affero GNU General Public License as published by the 10 * the terms of the Affero GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your 11 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version. 12 * option) any later version.
12 * 13 *
13 * This program is distributed in the hope that it will be useful, 14 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 17 * GNU General Public License for more details.
17 * 18 *
18 * You should have received a copy of the Affero GNU General Public License 19 * You should have received a copy of the Affero GNU General Public License
19 * and the GNU General Public License along with this program. If not, see 20 * and the GNU General Public License along with this program. If not, see
20 * <http://www.gnu.org/licenses/>. 21 * <http://www.gnu.org/licenses/>.
21 * 22 *
22 * The authors can be reached via e-mail to <support@deliantra.net> 23 * The authors can be reached via e-mail to <support@deliantra.net>
23 */ 24 */
24 25
25#include <global.h> 26#include <global.h>
26#include <material.h> 27#include <material.h>
343 LOG (llevError, "SIGABRT received.\n"); 344 LOG (llevError, "SIGABRT received.\n");
344 cleanup ("SIGABRT received", 1); 345 cleanup ("SIGABRT received", 1);
345} 346}
346 347
347static void 348static void
349rec_sigquit (int i)
350{
351 signal (SIGQUIT, SIG_IGN);
352
353 LOG (llevInfo, "SIGQUIT received\n");
354 cleanup ("SIGQUIT received", 1);
355}
356
357static void
348rec_sigsegv (int i) 358rec_sigsegv (int i)
349{ 359{
350 signal (SIGSEGV, SIG_DFL); 360 signal (SIGSEGV, SIG_DFL);
351 361
352 LOG (llevError, "SIGSEGV received.\n"); 362 LOG (llevError, "SIGSEGV received.\n");
353 cleanup ("SIGSEGV received", 1); 363 cleanup ("SIGSEGV received", 1);
354} 364}
355 365
356static void 366static void
357rec_sigquit (int i)
358{
359 signal (SIGQUIT, SIG_IGN);
360
361 LOG (llevInfo, "SIGQUIT received\n");
362 cleanup ("SIGQUIT received", 1);
363}
364
365static void
366rec_sigbus (int i) 367rec_sigbus (int i)
367{ 368{
368 signal (SIGBUS, SIG_DFL); 369 signal (SIGBUS, SIG_DFL);
369 370
370 LOG (llevError, "SIGBUS received\n"); 371 LOG (llevError, "SIGBUS received\n");
371 cleanup ("SIGBUS received", 1); 372 cleanup ("SIGBUS received", 1);
373}
374
375static void
376rec_sigfpe (int i)
377{
378 signal (SIGFPE, SIG_DFL);
379
380 LOG (llevError, "SIGFPE received.\n");
381 cleanup ("SIGFPE received", 1);
372} 382}
373 383
374void 384void
375reset_signals () 385reset_signals ()
376{ 386{
377 signal (SIGABRT, SIG_DFL); 387 signal (SIGABRT, SIG_DFL);
378 signal (SIGQUIT, SIG_DFL); 388 signal (SIGQUIT, SIG_DFL);
379 signal (SIGSEGV, SIG_DFL); 389 signal (SIGSEGV, SIG_DFL);
390#ifdef SIGBUS
380 signal (SIGBUS , SIG_DFL); 391 signal (SIGBUS , SIG_DFL);
392#endif
393 signal (SIGFPE , SIG_DFL);
381 signal (SIGINT , SIG_DFL); 394 signal (SIGINT , SIG_DFL);
382 signal (SIGTERM, SIG_DFL); 395 signal (SIGTERM, SIG_DFL);
383} 396}
384 397
385void 398void
401 sa.sa_flags = SA_RESTART; 414 sa.sa_flags = SA_RESTART;
402 415
403 sa.sa_handler = SIG_IGN; sigaction (SIGPIPE, &sa, 0); 416 sa.sa_handler = SIG_IGN; sigaction (SIGPIPE, &sa, 0);
404 sa.sa_handler = rec_sigabrt; sigaction (SIGABRT, &sa, 0); 417 sa.sa_handler = rec_sigabrt; sigaction (SIGABRT, &sa, 0);
405 sa.sa_handler = rec_sigquit; sigaction (SIGQUIT, &sa, 0); 418 sa.sa_handler = rec_sigquit; sigaction (SIGQUIT, &sa, 0);
419#ifdef SIGBUS
406 sa.sa_handler = rec_sigbus; sigaction (SIGBUS, &sa, 0); 420 sa.sa_handler = rec_sigbus; sigaction (SIGBUS, &sa, 0);
421#endif
422 sa.sa_handler = rec_sigfpe; sigaction (SIGFPE, &sa, 0);
407 423
408 sa.sa_flags |= SA_ONSTACK; 424 sa.sa_flags |= SA_ONSTACK;
409 sa.sa_handler = rec_sigsegv; sigaction (SIGSEGV, &sa, 0); 425 sa.sa_handler = rec_sigsegv; sigaction (SIGSEGV, &sa, 0);
410} 426}
411 427

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines