libuv/src/unix
Andrew Paprocki 4a972bf0e5 aix: Fix broken cmpxchgi() XL C++ specialization.
The preprocessor was used to select a special implementation when
building on AIX using XL C++ (strangely, not XL C).  This code
implemented `cmpxchgi()` by directly reading the old value and then
calling `__compare_and_swap()`, an intrinsic that does not provide
any sort of memory barrier guarantees.  The return value was not
used, and the value read prior to the `__compare_and_swap()` call
was returned.  There is no way that this code could provide the
required semantics of the function and it causes observable data
races and strange library failures in production under load.

XL C/C++ for AIX has provided support for the GCC intrinsic used in
the GCC/Clang cases since version 12.1 of the compiler.  This
version of the compiler is old enough that it doesn't warrant a
version check.  (The compiler was released 8-Jun-2012, maintenance
ended 9-Jul-2019, and service ends 30-Apr-2020.)

This change fixes all observed atomic issues and unifies XL C/C++
with GCC/Clang.

Relevant XL C/C++ for AIX V12.1 documentation links:
  - [__compare_and_swap](https://www.ibm.com/support/knowledgecenter/en/SSGH3R_12.1.0/com.ibm.xlcpp121.aix.doc/compiler_ref/bif_compare_and_swap_compare_and_swaplp.html)
  - [__sync_val_compare_and_swap](https://www.ibm.com/support/knowledgecenter/en/SSGH3R_12.1.0/com.ibm.xlcpp121.aix.doc/compiler_ref/bif_gcc_atomic_val_comp_swap.html)

PR-URL: https://github.com/libuv/libuv/pull/2455
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2019-09-06 10:17:12 +02:00
..
aix-common.c src: move uv_free_cpu_info to uv-common.c 2019-08-19 23:01:17 +02:00
aix.c unix,win: add uv_get_constrained_memory() 2019-05-15 11:35:05 -04:00
android-ifaddrs.c core: move all include files except uv.h to uv/ 2018-06-14 18:39:32 +02:00
async.c unix: fix race condition in uv_async_send() 2019-04-22 16:22:36 +02:00
atomic-ops.h aix: Fix broken cmpxchgi() XL C++ specialization. 2019-09-06 10:17:12 +02:00
bsd-ifaddrs.c build, core, unix: add support for Haiku 2019-06-07 09:57:06 +02:00
bsd-proctitle.c core,bsd: refactor process_title functions 2018-10-18 10:11:40 +02:00
core.c build: fix ios build error 2019-09-05 20:46:48 +02:00
cygwin.c src: move uv_free_cpu_info to uv-common.c 2019-08-19 23:01:17 +02:00
darwin-proctitle.c Revert "darwin: speed up uv_set_process_title()" 2019-08-03 21:23:43 +02:00
darwin.c src: move uv_free_cpu_info to uv-common.c 2019-08-19 23:01:17 +02:00
dl.c misc: remove unnecessary null pointer checks 2015-11-17 09:18:55 +01:00
freebsd.c src: move uv_free_cpu_info to uv-common.c 2019-08-19 23:01:17 +02:00
fs.c unix: fix unused-function warning on BSD 2019-08-07 13:49:51 -04:00
fsevents.c unix: fall back to kqueue on older macOS systems 2019-05-15 11:28:19 -04:00
getaddrinfo.c test,sunos: fix statement not reached warnings 2019-03-16 13:22:16 -04:00
getnameinfo.c unix,win: limit concurrent DNS calls to nthreads/2 2018-08-21 10:48:24 +02:00
haiku.c src: move uv_free_cpu_info to uv-common.c 2019-08-19 23:01:17 +02:00
ibmi.c unix,win: add uv_get_constrained_memory() 2019-05-15 11:35:05 -04:00
internal.h unix: make uv_cwd() report UV_ENOBUFS 2019-06-20 12:04:16 +02:00
kqueue.c unix: fall back to kqueue on older macOS systems 2019-05-15 11:28:19 -04:00
linux-core.c src: move uv_free_cpu_info to uv-common.c 2019-08-19 23:01:17 +02:00
linux-inotify.c linux: get rid of strncpy() call 2018-12-04 17:08:20 +01:00
linux-syscalls.c unix: don't make statx system call on Android 2019-05-13 21:42:52 -04:00
linux-syscalls.h linux: use statx() to obtain file birth time 2019-02-12 11:16:44 +01:00
loop-watcher.c include,src: introduce UV__ERR() macro 2018-02-08 22:38:02 -05:00
loop.c unix,win: merge handle flags 2018-06-29 22:24:52 +02:00
netbsd.c src: move uv_free_cpu_info to uv-common.c 2019-08-19 23:01:17 +02:00
no-fsevents.c include,src: introduce UV__ERR() macro 2018-02-08 22:38:02 -05:00
no-proctitle.c include,src: introduce UV__ERR() macro 2018-02-08 22:38:02 -05:00
openbsd.c src: move uv_free_cpu_info to uv-common.c 2019-08-19 23:01:17 +02:00
os390-syscalls.c zos: use correct pointer type in strnlen 2018-06-29 04:38:28 -07:00
os390-syscalls.h linux: remove epoll syscall wrappers 2018-09-06 13:07:13 +02:00
os390.c src: move uv_free_cpu_info to uv-common.c 2019-08-19 23:01:17 +02:00
pipe.c udp: add support for UDP connected sockets 2019-03-16 12:05:37 -04:00
poll.c unix: catch some cases of watching fd twice 2018-05-30 13:24:19 +02:00
posix-hrtime.c unix: factor out reusable POSIX hrtime impl 2017-03-03 15:52:42 +01:00
posix-poll.c unix: don't attempt to invalidate invalid fd 2019-02-10 10:11:19 -05:00
process.c unix: remove redundant cast in process.c 2019-06-24 22:00:03 -04:00
procfs-exepath.c include,src: introduce UV__ERR() macro 2018-02-08 22:38:02 -05:00
proctitle.c Revert "darwin: speed up uv_set_process_title()" 2019-08-03 21:23:43 +02:00
pthread-fixes.c unix: fix bug in barrier fallback implementation 2016-04-26 09:35:47 +02:00
signal.c unix,signal: keep handle active if pending signal 2019-08-19 22:39:06 +02:00
spinlock.h unix: add spinlock.h 2013-10-20 13:58:34 +02:00
stream.c aix: replace ECONNRESET with EOF if already closed 2019-09-06 09:59:54 +02:00
sunos.c src: move uv_free_cpu_info to uv-common.c 2019-08-19 23:01:17 +02:00
sysinfo-loadavg.c unix: factor out reusable sysinfo loadavg impl 2017-05-21 16:12:16 +02:00
sysinfo-memory.c unix: factor out reusable sysinfo memory lookup 2017-05-21 16:12:14 +02:00
tcp.c tcp: add uv_tcp_close_reset method 2019-08-19 23:41:15 +02:00
thread.c build: fix compile error with uClibc 2019-07-02 11:58:15 +02:00
tty.c stream: autodetect direction 2018-09-19 18:19:28 +02:00
udp.c udp: use sockaddr_storage instead of union 2019-08-23 21:12:47 +02:00