httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pavel Novy <>
Subject [PATCH] Apache 1.3.21-dev for NetWare builds (4)
Date Thu, 02 Aug 2001 16:12:56 GMT
here is the fourth problem I need to resolve in the CVS sources with GNU
builds of the Apache for NetWare:

4. an uninitialized data issues

a) It is expected that uninitialized variables are zeroed by default
(used uninitialized) in the Apache sources in most cases. I prefer
cross-platform programming, so I am working with variables very
carrefully. Unfortunatelly, some programmers still prefer that
UNIX-style behavior...

Tried to change all those variables to initialized by assigning initial
value (0, NULL, ...) and  I've succeeded with some external modules
(analysing weird abends and the sources),  but no luck with the core
module, because there are too many source files and too many variables
in there...

I found that a linker from CodeWarrior is placing all global variables
into one "segment" and all unitialized variables are zeroed in the NLM
file, so no problem here. I'm not using CW, so I don't know if it is a
normal behaviour or if it is an optional feature. However, a "nlmconv"
utility doesn't  allocate a space for uninitialized data in the file -
it is allocated on run-time, when module is loaded into memory - this
part of memory is not zeroed by loader (if loaded into a protected
address space it is probably a bit different, hence I've had less abends
then if loaded in OS address space...). A "ld" linker is called
externally by the nlmconv utility, but I don't know if it is possible to
call it with some options set to change something. If it is not
possible, then I can request an enhancement in the binutils package, but
I don't know many they are using this NLM stuff...

I'm fixing the issue by changes in  "libpre.c" and "libprews.c" files
(zeroing of uninitialized data added). Patches attached, not sure what
the CodeWarrior will say on this...

Additionally, it results to another problem:

b) If exporting some uninitialized variables then module created by GNU
stuff (nlmconv) can't be loaded due to a wrong offset (outside of data
segment) placed in module headers. Unfortunatelly, no warning produced
by nlmconv or ld. A "src/main/http_main.c" file is affected -
"ap_listenbacklog" and "ap_listeners" variables.

  SERVER-5.00-1554: Invalid public record offset in load file.
  Module APACHEC.NLM NOT loaded

I am solving this issue by changing these variables to initialized, so
GNU-linked apachec.nlm module can be loaded. Patch for "http_main.c"

The apache.nlm, htdigest.nlm, htpasswd.nlm, ... modules made with GNU
stuff would be potentially affected by the issue, but no problems seen
yes (prelude with run-time BSS segment zeroing is not used).

If somebody have any better idea how to fix these issues, let me know...
To not suppose that uninitialized variables are zeroed by default is the
best one, I think. No modified preludes (or other complicated stuff) are
not needed, then.


View raw message