postgresql/src/include/port
Tom Lane 26e9d4d4ef Convert elog.c's useful_strerror() into a globally-used strerror wrapper.
elog.c has long had a private strerror wrapper that handles assorted
possible failures or deficiencies of the platform's strerror.  On Windows,
it also knows how to translate Winsock error codes, which the native
strerror does not.  Move all this code into src/port/strerror.c and
define strerror() as a macro that invokes it, so that both our frontend
and backend code will have all of this behavior.

I believe this constitutes an actual bug fix on Windows, since AFAICS
our frontend code did not report Winsock error codes properly before this.
However, the main point is to lay the groundwork for implementing %m
in src/port/snprintf.c: the behavior we want %m to have is this one,
not the native strerror's.

Note that this throws away the prior use of src/port/strerror.c,
which was to implement strerror() on platforms lacking it.  That's
been dead code for nigh twenty years now, since strerror() was
already required by C89.

We should likewise cause strerror_r to use this behavior, but
I'll tackle that separately.

Patch by me, reviewed by Michael Paquier

Discussion: https://postgr.es/m/2975.1526862605@sss.pgh.pa.us
2018-09-26 11:06:42 -04:00
..
atomics Fix and improve pg_atomic_flag fallback implementation. 2018-04-06 19:55:32 -07:00
win32 Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
win32_msvc Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
aix.h Attempt to work around a 32bit xlc compiler bug from a different place. 2015-08-08 01:19:02 +02:00
atomics.h Remove overzeleous assertions in pg_atomic_flag code. 2018-04-07 18:30:15 -07:00
cygwin.h Remove checks for now long outdated compilers. 2012-09-28 19:43:50 -04:00
darwin.h Refer to OS X as "macOS", except for the port name which is still "darwin". 2016-09-25 15:40:57 -04:00
freebsd.h Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
hpux.h Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
linux.h pgindent run for 9.4 2014-05-06 12:12:18 -04:00
netbsd.h Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
openbsd.h Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
pg_bswap.h Fix misc typos, mostly in comments. 2018-07-18 16:17:32 +03:00
pg_crc32c.h Use ARMv8 CRC instructions where available. 2018-04-04 12:22:45 +03:00
solaris.h Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
win32.h Remove outdated/removed Win32 URLs in C comments 2018-01-09 18:33:21 -05:00
win32_port.h Convert elog.c's useful_strerror() into a globally-used strerror wrapper. 2018-09-26 11:06:42 -04:00