(lwpNewContext) [MAKECONTEXT_SP_HIGH]: Work around makecontext()
lossage.
(IRIX5CFLAGS, SOLCFLAGS): Define MAKECONTEXT_SP_HIGH. This is wrong
for Solaris 10.
Redesign interface to machine-dependent code to cleanse lwp.c of
machine-dependencies:
(lwpNewContext): New, factored out of lwpCreate().
(lwpSwitchContext): New, factored out of lwpReschedule().
(LWP_EXTRASTACK, STKALIGN, lwpInitContext, lwpSave, lwpRestore): Move
to arch.c. Remove for UCONTEXT, else static linkage unless macro or
AIX32.
(lwpReschedule): Skip lwpStatus() when not actually switching.
(LwpStackGrowsDown): New.
(lwpInitSystem): Initialize it.
(lwpStackCheck, lwpStackCheckUsed): Use it.
(lwpProc): Members lowmark and himark are confusing, replace by
ustack, usize.
(lwpCreate): Initialize them.
(lwpStackCheckInit, lwpStackCheck, lwpStackCheckUsed): Rewrite using
them. lwpStackCheckUsed() was off by LWP_REDZONE when stack grows
down.
(lwpDestroy): Don't bother to clear memory to be freed.
(lwpCreate) [UCONTEXT]: ss_sp is the (base) address of the stack area,
not the initial stack pointer. Fix. ss_size was wrong as well.
Amazing that this ever worked.
(lwpCreate): Used to allocate one byte more than necessary. The fix
won't save memory (malloc() will add the byte back), it's just clearer
this way.
(lwpCreate): Clean up computation of sp. Rename parameter size to
stacksz.
(lwpCreate): Always compute newp->lowmark and newp->highmark from sp,
not from s. Old code misaligned newp->himark for stacks growing
upward when stack size argument wasn't aligned.
(lwpProc, lwpSem): Declare as incomplete type in include/lwp.h. Move
complete declaration to src/lib/lwp/lwpint.h.
(lwpQueue): Move to src/lib/lwp/lwpint.h.
(empth_main, empth_flags): New.
(empth_init): Initialize them.
(empth_create, empth_exit): Use them instead of lwpProc members.
Remove LWP code for targets we no longer support: VAX/MIPS Ultrix
(dropped in Make.sysdefs rev. 1.12), 386 USL/Unixware (unclear, long
ago), 386BSD (never been?)
Clean up the incomprehensible #ifdef jungle a bit. Didn't compile if
both UCONTEXT and one of the other recognized preprocessor symbols was
defined; fix to prefer UCONTEXT.
Less rigid field separators, support comments:
(skipfs): New.
(xuflds, xundump): Use it. Update field scanf stop-sets accordingly.
(xuflds): Update test for good field separator.
(xundump): Fail silently if nothing can be read and no specific table
is expected.
Plug memory leaks:
(freeflds): New.
(xundump): Call it.
(xuloadrow): Leave freeing storage to freeflds().
(xuflds): Ensure values[] is terminated with a VAL_NOTUSED element
even on error.
Ron Koenderink [Tue, 29 Nov 2005 23:55:17 +0000 (23:55 +0000)]
(xuflds, xunsymbol, xuloadrow): Split VAL_SYMBOL into
VAL_SYMBOL and VAL_SYMBOL_SET. Identify SYMBOL_SET
by the '(' and ')'. Switch SYMBOL_SET separator from '|' to a space.
(plane_bomb, land_bomb): Apply collateral damage to target sector
instead of where the targeted plane/land unit is after the attack.
Different if the target retreats. Can't happen for planes. Reported
by Greg German.
Ron Koenderink [Tue, 29 Nov 2005 03:57:44 +0000 (03:57 +0000)]
(close_files, finish_server, panic):
Rename close_files() to ef_close_srv() and move to fileinit.c.
Replace calls to close_files() with ef_fin_srv().
Call ef_close_srv() from ef_fin_srv().
(ef_close_srv, ef_fin_srv): New.
(init_files, init_server, ef_init_srv):
Rename init_files() to ef_open_srv() and move to fileinit.c.
Remove call to init_files() from init_server() and replace
with a call to ef_open_srv() from ef_init_srv().
(ef_open_srv): New.
(ef_load, init_server, ef_init_srv):
Move the call to ef_load() from init_server() to ef_init_srv().
(global_init, init_server, ef_init_srv):
Move the call to global_init() from init_server() to ef_init_srv().
(nullify_objects, global_init, init_server):
Split nullify_objects() into init_lchr() and init_dchr().
Locate init_lchr() and init_dchr() in init.c.
Add calls to init_lchr() and to init_dchr() from global_init().
(fillcache, do_write, io_input, io_output): Portability fix: always
check both EAGAIN and EWOULDBLOCK. These are distinct on some
systems, e.g. HP-UX.
(io_output) [hpux]: Used to treat all errors as EWOULDBLOCK. This
looks like a inept attempt to `fix' the above. Remove.
Ron Koenderink [Mon, 21 Nov 2005 18:25:49 +0000 (18:25 +0000)]
(natbyname): Do not look up a non-active country.
Previously a blank country name or deleted country name would
return a pointer to non-active countries.
This creates a security problem where some one can successfully
login into the server without country or password. Closes #1219569.
(dchrstr, pchrstr, rptstr): New member d_uid, p_uid, r_uid.
(dchr, bigcity_dchr, pchr, rpt): Initialize it.
(dchr_ca, pchr_ca, rpt_ca): New selector uid for it.
(laun, launch_as, launch_missile, launch_sat): When an argument is
bad, do not loop prompting, just fail. That's what the vast majority
of commands do.
(launch_as, launch_missile, launch_sat): Don't zap the target
argument. If the target is given as argument, launch all missiles at
that target. Previously, missiles after the first prompted for
another target.
Ron Koenderink [Thu, 17 Nov 2005 03:21:32 +0000 (03:21 +0000)]
(cens, desi, dump, do_desi, doland, file_sct_init, grow_continents)
(grow_islands, set_coastal, update_coastal_flag, coast_sea_to_land)
(coast_land_to_sea): Determine sct_coastal flag when the sector type
is set. Old method only updated the sct_coastal flag when doing
cens() or a dump(). Other uses of sct_coastal could get stale values,
including selector coastal. Rework set_coastal() into NEW functions
update_coastal_flag(), coast_sea_to_land(), coast_land_to_sea() and
set_coastal(). Fix a bug where the deity designation would not
properly set the coastal flag. Fix a bug where the one sector lake
would not properly compute coastal flag. Fix a bug that makes
fairland treat the last sector it adds to an island as non-coastal.
Ron Koenderink [Mon, 14 Nov 2005 13:52:12 +0000 (13:52 +0000)]
(fuel, load, prod, max_population, shp_nav_one_sector,
nav_loadship, upd_buildeff): Identify BIG_CITY
(IS_BIG_CITY) by using packing type of UPKG instead of
opt_BIG_CITY and sector type of SCT_CAPITAL.