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.36 by root, Fri Jan 19 15:15:50 2007 UTC vs.
Revision 1.37 by root, Fri Jan 19 19:07:05 2007 UTC

979 } 979 }
980 980
981 close_and_delete (fp, comp); 981 close_and_delete (fp, comp);
982} 982}
983 983
984
985/* 984/*
986 * init() is called only once, when starting the program. 985 * init() is called only once, when starting the program.
987 */ 986 */
988 987
989void 988void
990init (int argc, char **argv) 989init (int argc, char **argv)
991{ 990{
991 init_done = 0; /* Must be done before init_signal() */
992 rndm.seed (time (0)); 992 rndm.seed (time (0));
993 993
994 init_done = 0; /* Must be done before init_signal() */
995 logfile = stderr; 994 logfile = stderr;
996 parse_args (argc, argv, 1); /* First arg pass - right now it does 995 parse_args (argc, argv, 1); /* First arg pass - right now it does
997 * nothing, but in future specifying the 996 * nothing, but in future specifying the
998 * LibDir in this pass would be reasonable*/ 997 * LibDir in this pass would be reasonable*/
999 998
1252} 1251}
1253 1252
1254void 1253void
1255init_signals (void) 1254init_signals (void)
1256{ 1255{
1257 signal (SIGPIPE, SIG_IGN); 1256 // large stack, but it's important data we want to save, and it is not usually
1258 signal (SIGABRT, rec_sigabrt); 1257 // being physically allocated anyways
1259 signal (SIGQUIT, rec_sigquit); 1258 const size_t stacksize = 8 * 1024 * 1024 + SIGSTKSZ;
1260 signal (SIGSEGV, rec_sigsegv); 1259
1261 signal (SIGBUS, rec_sigbus); 1260 stack_t ss;
1261 ss.ss_sp = malloc (stacksize);
1262 ss.ss_flags = 0;
1263 ss.ss_size = stacksize;
1264 sigaltstack (&ss, 0);
1265
1266 struct sigaction sa;
1267
1268 sigfillset (&sa.sa_mask);
1269 sa.sa_flags = SA_ONSTACK | SA_RESTART;
1270
1271 sa.sa_handler = SIG_IGN; sigaction (SIGPIPE, &sa, 0);
1272 sa.sa_handler = rec_sigabrt; sigaction (SIGABRT, &sa, 0);
1273 sa.sa_handler = rec_sigquit; sigaction (SIGQUIT, &sa, 0);
1274 sa.sa_handler = rec_sigsegv; sigaction (SIGSEGV, &sa, 0);
1275 sa.sa_handler = rec_sigbus; sigaction (SIGBUS, &sa, 0);
1262} 1276}
1263 1277
1264/* init_races() - reads the races file in the lib/ directory, then 1278/* init_races() - reads the races file in the lib/ directory, then
1265 * overwrites old 'race' entries. This routine allow us to quickly 1279 * overwrites old 'race' entries. This routine allow us to quickly
1266 * re-configure the 'alignment' of monsters, objects. Useful for 1280 * re-configure the 'alignment' of monsters, objects. Useful for

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines