Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit882b994

Browse files
committed
Back out use of FormatMessage(), does error values, not exception
values. Point to /include/ntstatus.h for an exception list, rather thana URL.
1 parent610f60a commit882b994

File tree

3 files changed

+16
-60
lines changed

3 files changed

+16
-60
lines changed

‎src/backend/postmaster/postmaster.c

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.511 2007/01/2301:45:11 momjian Exp $
40+
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.512 2007/01/2303:28:49 momjian Exp $
4141
*
4242
* NOTES
4343
*
@@ -2430,30 +2430,14 @@ LogChildExit(int lev, const char *procname, int pid, int exitstatus)
24302430
(errmsg("%s (PID %d) was terminated by signal %d",
24312431
procname,pid,WTERMSIG(exitstatus))));
24322432
#else
2433-
{
2434-
staticcharlast_system_error[512];
2435-
2436-
if (WERRORCODE(exitstatus)==0||
2437-
FormatMessage(FORMAT_MESSAGE_IGNORE_INSERTS |
2438-
FORMAT_MESSAGE_FROM_SYSTEM,
2439-
NULL,
2440-
WERRORCODE(exitstatus),
2441-
MAKELANGID(LANG_ENGLISH,SUBLANG_DEFAULT),
2442-
last_system_error,
2443-
sizeof(last_system_error)-1,
2444-
NULL)==0)
2445-
snprintf(last_system_error,sizeof(last_system_error)-1,
2446-
"Unknown error %X.",WEXITSTATUS(exitstatus));
2447-
24482433
ereport(lev,
2449-
2434+
24502435
/*------
24512436
translator: %s is a noun phrase describing a child process, such as
24522437
"server process" */
2453-
(errmsg("%s (PID %d) was terminated by the operating system",
2454-
procname,pid),
2455-
errdetail("%s",last_system_error)));
2456-
}
2438+
(errmsg("%s (PID %d) was terminated by exception %X",
2439+
procname,pid,WTERMSIG(exitstatus)),
2440+
errhint("See /include/ntstatus.h for a description of the hex value.")));
24572441
#endif
24582442
else
24592443
ereport(lev,

‎src/include/port/win32.h

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/include/port/win32.h,v 1.68 2007/01/2301:45:11 momjian Exp $ */
1+
/* $PostgreSQL: pgsql/src/include/port/win32.h,v 1.69 2007/01/2303:28:49 momjian Exp $ */
22

33
#if defined(_MSC_VER)|| defined(__BORLANDC__)
44
#defineWIN32_ONLY_COMPILER
@@ -140,26 +140,14 @@ intsemop(int semId, struct sembuf * sops, int flag);
140140
*Descriptions - http://www.comp.nus.edu.sg/~wuyongzh/my_doc/ntstatus.txt
141141
*MS SDK - http://www.nologs.com/ntstatus.html
142142
*
143-
*Because FormatMessage only handles NT_ERROR strings, and assumes they
144-
*do not have the 0xC prefix, we strip it to match this list:
145-
*http://msdn2.microsoft.com/en-us/library/ms681381.aspx
146-
*
147-
*When using FormatMessage():
148-
*
149-
*On MinGW, system() returns STATUS_* values. MSVC might be
150-
*different. To test, create a binary that does *(NULL), and
151-
*then create a second binary that calls it via system(),
152-
*and check the return value of system(). On MinGW, it is
153-
*0xC0000005 == STATUS_ACCESS_VIOLATION, and 0x5 is a value
154-
*FormatMessage() can look up. GetLastError() does not work;
155-
*always zero.
143+
*Some day we might want to print descriptions for the most common
144+
*exceptions, rather than printing a URL. FormatMessage() can print
145+
*the text of error values, but not exception values.
156146
*/
157-
#defineSTATUS_ERROR_MASK0xC0000000
158-
#defineWIFEXITED(w)(((w) & 0XFFFFFF00) == 0)
159-
#defineWIFSIGNALED(w)(!WIFEXITED(w))
160-
#defineWEXITSTATUS(w)(w)
161-
#defineWERRORCODE(w)((((w) & STATUS_ERROR_MASK) == STATUS_ERROR_MASK) ? \
162-
((w) & ~STATUS_ERROR_MASK) : 0)
147+
#defineWIFEXITED(w) (((w) & 0XFFFFFF00) == 0)
148+
#defineWIFSIGNALED(w) (!WIFEXITED(w))
149+
#defineWEXITSTATUS(w) (w)
150+
#defineWTERMSIG(w) (w)
163151

164152
#definesigmask(sig) ( 1 << ((sig)-1) )
165153

‎src/port/exec.c

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/port/exec.c,v 1.46 2007/01/2301:45:11 momjian Exp $
12+
* $PostgreSQL: pgsql/src/port/exec.c,v 1.47 2007/01/2303:28:49 momjian Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -586,24 +586,8 @@ pclose_check(FILE *stream)
586586
log_error(_("child process was terminated by signal %d"),
587587
WTERMSIG(exitstatus));
588588
#else
589-
{
590-
staticcharlast_system_error[512];
591-
592-
if (WERRORCODE(exitstatus)==0||
593-
FormatMessage(FORMAT_MESSAGE_IGNORE_INSERTS |
594-
FORMAT_MESSAGE_FROM_SYSTEM,
595-
NULL,
596-
WERRORCODE(exitstatus),
597-
MAKELANGID(LANG_ENGLISH,SUBLANG_DEFAULT),
598-
last_system_error,
599-
sizeof(last_system_error)-1,
600-
NULL)==0)
601-
snprintf(last_system_error,sizeof(last_system_error)-1,
602-
"Unknown error %X.",WEXITSTATUS(exitstatus));
603-
604-
log_error(_("child process was terminated by the operating system\n%s"),
605-
last_system_error);
606-
}
589+
log_error(_("child process was terminated by exception %X\nSee /include/ntstatus.h for a description\nof the hex value."),
590+
WTERMSIG(exitstatus));
607591
#endif
608592
else
609593
log_error(_("child process exited with unrecognized status %d"),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp