Commit graph

3395 commits

Author SHA1 Message Date
Marc Olzheim
a0fca37ce1 Get rid of "s_char". No functional changes. 2005-03-15 18:59:24 +00:00
Ron Koenderink
6245ed4b73 (run_hook): Add fflush(NULL) to flush the stdio files before
starting the backup.
2005-03-15 18:23:21 +00:00
Ron Koenderink
9227a314c5 (service_stoppped,stop_service,loc_Ctrl_C_Handler,
empth_request_shutdown,loc_BlockMainThread,empth_init,
service_ctrl_handler) [_WIN32]: Remove the Windows Build UI and
replace with Ctrl-c signal trap.  The shutdown event that was used for
STOPPING the service is now used for both foreground and background
(service) modes of operation. Also move the shutdown event from service
code to empth_t library.
2005-03-15 18:19:07 +00:00
Marc Olzheim
d8938a1605 Don't try running 'cvs co' more than 5 times, since it might be a local
problem as well.  Document NIGHTLY_SKIP_STEP=PATCH.  Update to the currently
running script.
2005-03-15 18:05:16 +00:00
Marc Olzheim
c890dd759c Update for markus's prng patches. 2005-03-15 17:58:33 +00:00
Ron Koenderink
1bbd7e5342 (main,print_usage) [_WIN32]: Add the ability to enable
empire thread debugging for Windows build.

(empth_select) [_WIN32]: Fix empth_select() so can be aborted.
The bug was that a command would not be aborted during an update.
The problem was select() was not interrupt by the setting of the
signalling wakeup event.  Fix by replacing the select() with
WSAEventSelect().

(empth_exit) [_WIN32]:
Fix the shutdown sequence for Windows build to be running in
empth_t context.  Add a loc_RunThisThread() in empth_exit()
before starting the shutdown() sequence.
2005-03-13 21:53:23 +00:00
Ron Koenderink
1f9b34dfdd (log_error) [_WIN32]: Remove ; from the #define for vsnprintf.
This part of the for changes to logerror().
2005-03-12 19:33:18 +00:00
6b68f73ca8 Doc fix. 2005-03-12 18:06:31 +00:00
2c21e731f1 Remove files that no longer exist, add missing files, fix filenames. 2005-03-12 18:03:02 +00:00
c47cc38215 Don't suggest to run make in the background. 2005-03-12 18:01:05 +00:00
60baf257fb Remove advice on stuff that vanished from the distribution years ago. 2005-03-12 17:59:57 +00:00
Ron Koenderink
157395fcb2 (log_error) [_WIN32]: Add #define for vsnprintf to pick up
_vsnprintf from the WIN32 library for changes to logerror().

(main) [_WIN32]: Add typedef for pid_t to match WIN32 definition
for getpid().  This is required for the create_pidfile() changes.
2005-03-12 17:52:29 +00:00
63d8684cd0 Fix the previous rev. 2005-03-12 17:34:11 +00:00
8169a0a031 A backup script for pre_update_hook. 2005-03-12 17:31:55 +00:00
7d71984932 (pre_update_hook): New configuration key.
(update_wait): Implement it.
(run_hook): New.
2005-03-12 17:24:57 +00:00
f12649c3da Write pid file, like a good daemon. Thanks to Daniel O'Connor for the
initial patch.
(create_pidfile, pidfname): New.
(start_server): Create pid file.
(finish_server): Remove pid file.

(main) [__linux__ && _EMPTH_POSIX]: Don't hack pid into argv[0].
Recent versions of Linux pthreads no longer show multiple PIDs, and
deities can get the PID fro the pid file anyway.
2005-03-12 16:45:43 +00:00
3f472fc729 (finish_server): New, factored out of termination code. Fixes two
places in service_main() that lacked close_files().
(close_files, loc_NTTerm): Static linkage.
2005-03-12 16:28:28 +00:00
Ron Koenderink
b915edd13c (start_server) [_WIN32]: Put #ifndef _WIN32 around act.
This was missed with the [!POSIXSIGNALS]: changes.
2005-03-12 16:10:49 +00:00
0595ff4d4e Indentation fixes. 2005-03-12 15:05:23 +00:00
d8daa5f67d (init_server, start_server): Move start log message to start_server(),
where it belongs.
2005-03-12 15:04:37 +00:00
7eb2fe571e (logerror): Log to stderr as well. Fix potential buffer overflows.
(oops): Let logerror() supply the newline.
2005-03-12 15:03:31 +00:00
8f40f5ad6d [DO_EFF_MEM_CHECKING]: Dead for some ten years. Bury. 2005-03-12 13:40:24 +00:00
590cfe674a [GODZILLA]: Incomplete, unused, remove. 2005-03-12 13:27:13 +00:00
0e68d68390 (main, empth_start): Don't bother to catch SIGUSR1. Use SIGINT or
SIGTERM to shutdown the server.
2005-03-12 12:30:58 +00:00
09b481b30a [!POSIXSIGNALS]: Thoroughly obsolete, remove. This also gets rid of
an odd case where signals were not catched when debugging.

(main, empth_start): Using sa_handler with SA_SIGINFO is wrong.
Simply don't set SA_SIGINFO; the additional signal information is not
used anyway.
2005-03-12 12:20:50 +00:00
Ron Koenderink
014d005c69 (service_main,main,shutdown) [_WIN32]: Add missing loc_NTTerm().
(service_main,main,shutdown,empth_exit,service_stopped) [_WIN32]:
Add shutdown Event to allow the service to shutdown.
When SERVICE_STOPPED is passed to SetServiceStatus() all
threads are kills this prevents shutdown() from executing.
The shutdown Event is used to block the service_main thread until
the stopping of the service is started.  After the shutdown() is
complete then the SetServiceStatus() is called.
2005-03-12 04:35:09 +00:00
6c7f707b76 [hpux] (srandom, random): HP-UX has had these for ages. Remove. 2005-03-11 17:05:19 +00:00
9cd463f8bc (main): Fix seeding of PRNG broken in rev. 1.22. 2005-03-11 17:03:07 +00:00
256724c39f (multifire, new): Reseeding the PRNG with the current time is not a
good idea.  Letting players trigger it is an extraordinarily bad idea.
Remove.
2005-03-11 17:01:38 +00:00
8ba9ca5869 Remove qsort_func_t, belatedly. 2005-03-11 07:36:13 +00:00
Ron Koenderink
6fb90fb62c (newe): Remove wforce, not used anymore. 2005-03-10 22:25:58 +00:00
ed7adb7cf6 (loginit): Working directory is the data directory; simplify.
(loginit, logerror): Use plain char * instead of s_char *.
2005-03-10 19:33:12 +00:00
21088661d6 (emp_config): The previous rev. broke the documented feature that
missing default econfig means default configuration.  Fix.
2005-03-10 19:19:46 +00:00
7f000ce9cc Fix ugly line breaks. 2005-03-10 19:17:15 +00:00
a53c6e74c4 Update for recent pconfig changes. 2005-03-10 19:12:51 +00:00
5b57f4c222 Merge pre-4-2-20-invasive. Summary of changes:
* Acquire resources before daemonizing, fail in foreground
* Initialize threads and signals after daemonizing
* Make most file names relative to data directory
* emp_server and files make it their working directory
* emp_config() no longer screws up some file names
* Missing or incorrect econfig is now fatal
* Don't log to default log file when econfig changes it
2005-03-10 18:35:27 +00:00
Ron Koenderink
98f3d6efca (main,service_main) [_WIN32]: Change startup errors to stderr from
logerror() as log file is not open yet.
2005-03-10 18:00:40 +00:00
Ron Koenderink
f03de3f9a5 (service_main) [_WIN32]: Remove init_server() as it has already been done. 2005-03-10 16:15:30 +00:00
Ron Koenderink
b961414862 (main) [_WIN32]: Add extern file for chdir().
(main) [_WIN32]: Add #ifdef for tbuf as it is only used in LINUX and
EMPTH_POSIX.
2005-03-10 16:13:51 +00:00
d20fb6ba39 (init_server, start_server): Move signal and thread initialization
from init_server() to start_server(), and service startup next to its
Unix equivalent disassoc().  This way, threading is always initialized
after daemonizing, which is simpler and more portable.
2005-03-09 19:37:48 +00:00
ba7d26b2ba (disassoc): src/lib/player/accept.c rev. 1.18.2.1 broke the server
when it runs as daemon, because it relies on player_socket remaining
open across disassoc().  Change disassoc() to only close file
descriptors 0..2 instead of 0..9.  By the way, it should really
redirect 0..2 to /dev/null instead.
2005-03-09 19:25:20 +00:00
fcf064625d (main): Non-zero flags imply !daemonize. Make explicit. 2005-03-09 18:57:53 +00:00
29da4b6cf4 (empfile, teldir, motdfil, downfil, disablefil, telfil, annfil)
(banfil, authfil, timestampfil): Make file names relative to DATADIR.
(main): emp_server and files change to the data directory.  fairland
has to write newcap_script to the initial current directory, so it
keeps it and makes file names relative to DATADIR absolute.
(fixup_files): Nothing to do, remove.  This fixes the following bug:
fixup_files() formed file names by appending ep->name instead of the
base name of ep->file to datadir.  Thus, fixup_files() changed file
names even when datadir had the compiled-in value.  When emp_config()
couldn't open econfig, it failed to call fixup_files(), and different
file names got used.  Note that with this revision the file names
revert to the names used before fixup_files() was introduced.  Closes
#1146080.
(print_config): Printing file names as comments is not really useful,
remove.
(otherfiles, ofiles): Unused, remove.
(emp_config, main): Previously, pconfig had to call emp_config() even
when it didn't want to read econfig, just to run fixup_files().  This
is no longer necessary.  Simplify.
2005-03-09 18:44:50 +00:00
1583d0c6a2 (dflt_econfig): New.
(emp_config): Use it when argument is NULL.  This simplifies callers
except pconfig's main(), which now has to suppress reading the default
file.  Also fix callers to check the return value.  Previously, a typo
could easily start a grossly misconfigured program, with potentially
disastrous results.
2005-03-09 17:11:58 +00:00
12518b82dd Fix missing include. 2005-03-09 16:56:39 +00:00
6309973d07 Fix typos, update paths that changed since this was written. 2005-03-09 16:46:45 +00:00
84b8189c13 (daemon, daemonize): Rename to avoid name clash with BSD's daemon().
(daemonize): Supply missing declaration.
2005-03-09 14:45:41 +00:00
30f2b2c4ea (player_init, player_accept): Move socket bind and listen from
player_accept() to player_init().  Acquiring resources during
initialization allows to exit unsuccessfully on errors.  Previously,
the daemon detached itself (exiting successfully), then failed in the
background.
(player_socket): New.
2005-03-08 16:51:19 +00:00
Ron Koenderink
0b172c6553 (NS_ALL) [_WIN32]: Change NS_EVERYTHING back to NS_ALL, #undef NS_ALL to prevent conflict with winsock2.h 2005-03-08 00:04:43 +00:00
Ron Koenderink
ab2bea5810 (service_main) [_WIN32]: Remove the command line processing.
The secondary command line processing was adding significant
complexity for minimial gain.  Now all the command line arguments
can be prequalified during the installation of the service.

(service_main) [_WIN32]: Move the initialization (init_server())
so logerror() will go to the file instead of stderr.
2005-03-06 20:58:48 +00:00