Early aborts (Was: qq failure on HP-UX)

2000-03-09 Thread Harald Hanche-Olsen

+ Uwe Ohse <[EMAIL PROTECTED]>:

| On Wed, Mar 08, 2000 at 05:06:20PM +0100, Harald Hanche-Olsen wrote:
|  
| > <[EMAIL PROTECTED]>:
| > crt0: ERROR: mmap failed for dld (data) errno:00012
| > Unable to forward message: qq permanent problem (#5.3.0).
| 
| this can only happen "if ((exitcode >= 11) && (exitcode <= 40))",
| which qmail-queue doesn't return in case of "out of memory".

I assume this happened before the program entered main().

Which brings up a natural question:  What, in general, is supposed to
happen if a program is unable to proceed before it enters main(),
e.g., because the dynamic loader could not get the memory it needs?
Clearly, it is too late for the original process to return from
exec(), yet the programmer has no influence over what will happen.
For packages like qmail, it is important to recognize the situation so
it can be dealt with properly, yet this is clearly impossible unless
there is a documented behaviour one can rely on.

(My guess would have been that the process should commit suicide
rather than just exiting, perhaps by sending itself a SIGSEGV or
SIGABRT.)

- Harald



Re: Early aborts (Was: qq failure on HP-UX)

2000-03-09 Thread Pavel Kankovsky

On Thu, 9 Mar 2000, Harald Hanche-Olsen wrote:

> Which brings up a natural question:  What, in general, is supposed to
> happen if a program is unable to proceed before it enters main(),
> e.g., because the dynamic loader could not get the memory it needs?
...
> (My guess would have been that the process should commit suicide
> rather than just exiting, perhaps by sending itself a SIGSEGV or
> SIGABRT.)

Every dynamic linker I know (and I have seen having fatal problems during
startup) commits suicide with SIGKILL. This is probably the best thing you
can do.

--Pavel Kankovsky aka Peak  [ Boycott Microsoft--http://www.vcnet.com/bms ]
"Resistance is futile. Open your source code and prepare for assimilation."



Re: Early aborts (Was: qq failure on HP-UX)

2000-03-09 Thread Uwe Ohse

On Thu, Mar 09, 2000 at 05:57:23PM +0100, Harald Hanche-Olsen wrote:
 
> I assume this happened before the program entered main().

me too.

 
> Which brings up a natural question:  What, in general, is supposed to
> happen if a program is unable to proceed before it enters main(),

1003.1, 3.2 "Process Termination"
  There are two kinds of process termination:

(1) Normal termination occurs by a return from main() or when requested
with the exit() or _exit() functions.
(2) Abnormal termination occurs when requested by the abort() function
or when some signals are received (see 3.3.1.1).
  
  [...] the status made available to wait() or waitpid() by abort() shall
  be that of a process terminated by the SIGABRT signal.

Regards, Uwe