Mon Nov 30 16:39:38 2009 :: boot_db() - wrote exodus.pid
Mon Nov 30 16:39:38 2009 :: Exodus is ready to rock on port 4000.
#0 0x7c8106f9 in KERNEL32!CreateThread ()
from /cygdrive/c/WINDOWS/system32/kernel32.dll
Cannot access memory at address 0x3
int fdsize;
//
// Akamai 01/24/00 - This function writes the process id of the Exodus
// main code to a file. Useful for special shutdown scripts.
//
// prototype
void exodus_pid ();
// function
void exodus_pid () {
char buf[MAX_INPUT_LENGTH];
char pidf[MAX_INPUT_LENGTH];
FILE *fp;
long pid = 0;
pid = (long) getpid ();
// sprintf(buf,"Exodus PID: %ld",pid);
sprintf (buf, "%ld", pid);
sprintf (pidf, "%s%s", BIN_DIR, EXODUS_PID);
if ((fp = fopen (pidf, "w")) != NULL) {
fprintf (fp, "%s", buf);
fclose (fp);
log_string ("boot_db() - wrote exodus.pid");
// log_string (buf);
} else {
bug ("Couldn't open exodus.pid file.", 0);
log_string (buf);
}
}
int main (int argc, char **argv) {
struct rlimit fd_limit;
//, stack_limit;
struct timeval now_time;
int port;
int control, whosock, areasock;
#if defined(MALLOC_DEBUG)
malloc_debug (2);
#endif /* */
init_signals (); /* For the use of the signal handler */
gettimeofday (&now_time, NULL);
current_time = (time_t) now_time.tv_sec;
strcpy (str_boot_time, ctime (¤t_time));
getrlimit (RLIMIT_NOFILE, &fd_limit);
fd_limit.rlim_cur = fd_limit.rlim_max - 8;
setrlimit (RLIMIT_NOFILE, &fd_limit);
@@ fdsize = fd_limit.rlim_cur;
// Shinowlan - debug attempt to fix 'save' recurse problem
// this, in general, does not work. So it's commented out.
/*
getrlimit(RLIMIT_STACK, &stack_limit);
log_buf[0]= '\0';
sprintf (log_buf, "STACK: intially at %ld bytes.", stack_limit.rlim_cur);
log_string(log_buf);
stack_limit.rlim_cur = stack_limit.rlim_max;
setrlimit(RLIMIT_STACK, &stack_limit);
log_buf[0]= '\0';
sprintf (log_buf, "STACK: Current stack is now set to %ld bytes", stack_limit.rlim_max);
log_string(log_buf);
getrlimit(RLIMIT_STACK, &stack_limit);
log_buf[0]= '\0';
sprintf (log_buf, "STACK: is at %ld bytes.", stack_limit.rlim_cur);
*/
if ((fpReserve = fopen (NULL_FILE, "r")) == NULL) {
perror (NULL_FILE);
exit (1);
}
port = 9000;
if (argc > 1) {
if (!is_number (argv[1])) {
fprintf (stderr, "Usage: %s [port #]\n", argv[0]);
exit (1);
} else if ((port = atoi (argv[1])) <= 1024) {
fprintf (stderr, "Port number must be above 1024.\n");
exit (1);
}
}
#if defined(unix)
if (port == 9000) {
whosock = init_socket (8999);
areasock = init_socket (8887);
} else {
whosock = -1;
areasock = -1;
}
control = init_socket (port);
boot_db ();
sprintf (log_buf, "Exodus is ready to rock on port %d.", port);
/*
signal (SIGUSR1, machine_reboot);
signal (SIGTERM, machine_reboot);
*/
exodus_pid ();
log_string (log_buf);
game_loop_unix (control, whosock, areasock);
close (control);
#endif /* */
log_string ("Normal termination of game.");
exit (0);
return 0;
}
Unfortunately, if it IS that kind of issue, the only thing you can really do is compare your code against a known working equivalent to try and spot anything unusual… fcntl() calls with obscure options, stuff like that.
If it hits there, then you know the problem lies further down and can continue leaving breadcrumbs. :)