Re: Win32 WEXITSTATUS too simplistic

Поиск
Список
Период
Сортировка
От ITAGAKI Takahiro
Тема Re: Win32 WEXITSTATUS too simplistic
Дата
Msg-id 20061227100932.6100.ITAGAKI.TAKAHIRO@oss.ntt.co.jp
обсуждение исходный текст
Ответ на Win32 WEXITSTATUS too simplistic  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> wrote:

>     server process exited with exit code -1073741819
> from what I suspect is really the equivalent of a SIGSEGV trap,
> ie, attempted access to already-deallocated memory.  My calculator
> says the above is equivalent to hex C0000005, and I say that this
> makes it pretty clear that *some* parts of Windows put flag bits into
> the process exit code.  Anyone want to run down what we should really
> be using instead of the above macros?

C0000005 equals to EXCEPTION_ACCESS_VIOLATION. The value returned by
GetExceptionCode() seems to be the exit code in unhandeled exception cases.

AFAICS, all EXCEPTION_xxx (or STATUS_xxx) values are defined as 0xCxxxxxxx.
I think we can use the second high bit to distinguish exit by exception
from normal exits.

#define WEXITSTATUS(w)  ((int) ((w) & 0x40000000))
#define WIFEXITED(w)    ((w) & 0x40000000) == 0)
#define WIFSIGNALED(w)  ((w) & 0x40000000) != 0)
#define WTERMSIG(w)     (w) // or ((w) & 0x3FFFFFFF)

However, it comes from reverse engineering of the headers of Windows.
I cannot find any official documentation.

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center




В списке pgsql-hackers по дате отправления:

Предыдущее
От:
Дата:
Сообщение: SPAR Simple PostgreSQL AddOn Replication System
Следующее
От: Gavin Sherry
Дата:
Сообщение: Re: Bitmap index thoughts