Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
610f60a0
Commit
610f60a0
authored
Jan 23, 2007
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Print meaningfull error text for abonormal process exit on Win32, rather
than hex codes, using FormatMessage().
parent
b97b8664
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
15 deletions
+60
-15
src/backend/postmaster/postmaster.c
src/backend/postmaster/postmaster.c
+21
-5
src/include/port/win32.h
src/include/port/win32.h
+20
-7
src/port/exec.c
src/port/exec.c
+19
-3
No files found.
src/backend/postmaster/postmaster.c
View file @
610f60a0
...
...
@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.51
0 2007/01/22 19:38:05
momjian Exp $
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.51
1 2007/01/23 01:45:11
momjian Exp $
*
* NOTES
*
...
...
@@ -2430,14 +2430,30 @@ LogChildExit(int lev, const char *procname, int pid, int exitstatus)
(
errmsg
(
"%s (PID %d) was terminated by signal %d"
,
procname
,
pid
,
WTERMSIG
(
exitstatus
))));
#else
ereport
(
lev
,
{
static
char
last_system_error
[
512
];
if
(
WERRORCODE
(
exitstatus
)
==
0
||
FormatMessage
(
FORMAT_MESSAGE_IGNORE_INSERTS
|
FORMAT_MESSAGE_FROM_SYSTEM
,
NULL
,
WERRORCODE
(
exitstatus
),
MAKELANGID
(
LANG_ENGLISH
,
SUBLANG_DEFAULT
),
last_system_error
,
sizeof
(
last_system_error
)
-
1
,
NULL
)
==
0
)
snprintf
(
last_system_error
,
sizeof
(
last_system_error
)
-
1
,
"Unknown error %X."
,
WEXITSTATUS
(
exitstatus
));
ereport
(
lev
,
/*------
translator: %s is a noun phrase describing a child process, such as
"server process" */
(
errmsg
(
"%s (PID %d) was terminated by exception %X"
,
procname
,
pid
,
WTERMSIG
(
exitstatus
)),
errhint
(
"See http://source.winehq.org/source/include/ntstatus.h for a description of the hex value."
)));
(
errmsg
(
"%s (PID %d) was terminated by the operating system"
,
procname
,
pid
),
errdetail
(
"%s"
,
last_system_error
)));
}
#endif
else
ereport
(
lev
,
...
...
src/include/port/win32.h
View file @
610f60a0
/* $PostgreSQL: pgsql/src/include/port/win32.h,v 1.6
7 2007/01/22 18:32:57
momjian Exp $ */
/* $PostgreSQL: pgsql/src/include/port/win32.h,v 1.6
8 2007/01/23 01:45:11
momjian Exp $ */
#if defined(_MSC_VER) || defined(__BORLANDC__)
#define WIN32_ONLY_COMPILER
...
...
@@ -140,13 +140,26 @@ int semop(int semId, struct sembuf * sops, int flag);
* Descriptions - http://www.comp.nus.edu.sg/~wuyongzh/my_doc/ntstatus.txt
* MS SDK - http://www.nologs.com/ntstatus.html
*
* Some day we might want to print descriptions for the most common
* exceptions, rather than printing a URL.
* Because FormatMessage only handles NT_ERROR strings, and assumes they
* do not have the 0xC prefix, we strip it to match this list:
* http://msdn2.microsoft.com/en-us/library/ms681381.aspx
*
* When using FormatMessage():
*
* On MinGW, system() returns STATUS_* values. MSVC might be
* different. To test, create a binary that does *(NULL), and
* then create a second binary that calls it via system(),
* and check the return value of system(). On MinGW, it is
* 0xC0000005 == STATUS_ACCESS_VIOLATION, and 0x5 is a value
* FormatMessage() can look up. GetLastError() does not work;
* always zero.
*/
#define WIFEXITED(w) (((w) & 0XFFFFFF00) == 0)
#define WIFSIGNALED(w) (!WIFEXITED(w))
#define WEXITSTATUS(w) (w)
#define WTERMSIG(w) (w)
#define STATUS_ERROR_MASK 0xC0000000
#define WIFEXITED(w) (((w) & 0XFFFFFF00) == 0)
#define WIFSIGNALED(w) (!WIFEXITED(w))
#define WEXITSTATUS(w) (w)
#define WERRORCODE(w) ((((w) & STATUS_ERROR_MASK) == STATUS_ERROR_MASK) ? \
((w) & ~STATUS_ERROR_MASK) : 0)
#define sigmask(sig) ( 1 << ((sig)-1) )
...
...
src/port/exec.c
View file @
610f60a0
...
...
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/port/exec.c,v 1.4
5 2007/01/22 18:31:5
1 momjian Exp $
* $PostgreSQL: pgsql/src/port/exec.c,v 1.4
6 2007/01/23 01:45:1
1 momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -586,8 +586,24 @@ pclose_check(FILE *stream)
log_error
(
_
(
"child process was terminated by signal %d"
),
WTERMSIG
(
exitstatus
));
#else
log_error
(
_
(
"child process was terminated by exception %X
\n
See http://source.winehq.org/source/include/ntstatus.h for a description
\n
of the hex value."
),
WTERMSIG
(
exitstatus
));
{
static
char
last_system_error
[
512
];
if
(
WERRORCODE
(
exitstatus
)
==
0
||
FormatMessage
(
FORMAT_MESSAGE_IGNORE_INSERTS
|
FORMAT_MESSAGE_FROM_SYSTEM
,
NULL
,
WERRORCODE
(
exitstatus
),
MAKELANGID
(
LANG_ENGLISH
,
SUBLANG_DEFAULT
),
last_system_error
,
sizeof
(
last_system_error
)
-
1
,
NULL
)
==
0
)
snprintf
(
last_system_error
,
sizeof
(
last_system_error
)
-
1
,
"Unknown error %X."
,
WEXITSTATUS
(
exitstatus
));
log_error
(
_
(
"child process was terminated by the operating system
\n
%s"
),
last_system_error
);
}
#endif
else
log_error
(
_
(
"child process exited with unrecognized status %d"
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment