libuv/test
Jason Madden fd7ce57f2b unix: make loops and watchers usable after fork()
Added the uv_loop_fork() API that must be called in a child process to
continue using an existing loop. Internally this calls a uv__io_fork
function for each supported platform, similar to the way
uv__platform_loop_init works.

After this call, existing and new IO, async and signal watchers will
contiue working as before on all platforms, as will the
threadpool (although any threads it was using are of course gone).

On Linux and BSDs that use kqueue, existing and new fsevent watchers
will also continue to work as expected. On OS X, though, directory
fsevents will not be able to use the optimized CoreFoundation path if
they had already been used in the parent process, instead falling back
to the kqueue path used on other BSDs.

Existing fsevent watchers will not function on AIX or SunOS. This
could be relatively easily fixed by someone with AIX knowledge in the
future, but SunOS will require some additional work to keep track if
the watchers.

A new test file, test/test-fork.c, was added to contain fork-related
tests to verify functionality in the child process.

PR-URL: https://github.com/libuv/libuv/pull/846
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2017-03-21 12:23:44 +01:00
..
fixtures
benchmark-async-pummel.c
benchmark-async.c
benchmark-fs-stat.c unix,windows: allow NULL loop for sync fs requests 2015-08-18 15:39:21 +02:00
benchmark-getaddrinfo.c test: remove LOG and LOGF variadic macros 2015-04-12 18:44:34 +02:00
benchmark-list.h
benchmark-loop-count.c test: remove LOG and LOGF variadic macros 2015-04-12 18:44:34 +02:00
benchmark-million-async.c
benchmark-million-timers.c test: remove LOG and LOGF variadic macros 2015-04-12 18:44:34 +02:00
benchmark-multi-accept.c
benchmark-ping-pongs.c test: remove LOG and LOGF variadic macros 2015-04-12 18:44:34 +02:00
benchmark-pound.c test: remove LOG and LOGF variadic macros 2015-04-12 18:44:34 +02:00
benchmark-pump.c test: remove LOG and LOGF variadic macros 2015-04-12 18:44:34 +02:00
benchmark-sizes.c test: remove LOG and LOGF variadic macros 2015-04-12 18:44:34 +02:00
benchmark-spawn.c test: remove LOG and LOGF variadic macros 2015-04-12 18:44:34 +02:00
benchmark-tcp-write-batch.c
benchmark-thread.c
benchmark-udp-pummel.c
blackhole-server.c
dns-server.c
echo-server.c unix,windows: allow NULL loop for sync fs requests 2015-08-18 15:39:21 +02:00
run-benchmarks.c test: remove LOG and LOGF variadic macros 2015-04-12 18:44:34 +02:00
run-tests.c test: improve spawn_setuid_setgid test 2016-09-03 10:16:59 +02:00
runner-unix.c unix: expand range of values for usleep 2016-08-24 09:58:49 +01:00
runner-unix.h
runner-win.c test: improve formatting of diagnostic messages 2016-06-10 10:08:13 +02:00
runner-win.h win: use the MSVC provided snprintf where possible 2015-09-29 09:01:33 +02:00
runner.c test: improve tap output on test failures 2016-08-24 10:47:14 +01:00
runner.h test: improve formatting of diagnostic messages 2016-06-10 10:08:13 +02:00
task.h test: remove unused RETURN_TODO macro 2016-06-10 10:08:15 +02:00
test-active.c
test-async-null-cb.c
test-async.c
test-barrier.c Revert "test: make barrier test more rigorous" 2014-07-02 00:16:50 +02:00
test-callback-order.c
test-callback-stack.c
test-close-fd.c unix: set non-block mode in uv_{pipe,tcp,udp}_open 2015-01-14 19:46:54 +01:00
test-close-order.c
test-condvar.c test: fix deadlocks in uv_cond_wait 2016-03-03 09:29:39 +01:00
test-connection-fail.c
test-cwd-and-chdir.c test: fix cwd_and_chdir test on Unix 2014-12-16 08:12:46 +01:00
test-default-loop-close.c test: add test for closing and recreating default loop 2014-09-15 21:34:09 +02:00
test-delayed-accept.c
test-dlerror.c test: check dlerror is "no error" in no error case 2014-12-14 20:33:43 +01:00
test-eintr-handling.c test: fixup eintr_handling 2016-01-06 08:30:49 +01:00
test-embed.c build: GNU/kFreeBSD support 2016-08-20 08:55:30 +02:00
test-emfile.c zos: add support for new platform 2016-08-19 01:34:29 +02:00
test-env-vars.c unix: return UV_EINVAL for NULL env name 2017-03-14 08:28:46 +01:00
test-error.c win: define ERROR_ELEVATION_REQUIRED for MinGW 2017-01-30 12:07:14 -05:00
test-fail-always.c
test-fork.c unix: make loops and watchers usable after fork() 2017-03-21 12:23:44 +01:00
test-fs-event.c win, test: fix fs_event_watch_dir_recursive 2016-09-20 00:14:36 +02:00
test-fs-poll.c unix, win: consistently null-terminate buffers 2016-03-03 09:20:41 +01:00
test-fs.c fs: fix crash in uv_fs_scandir_next 2017-01-17 21:15:43 -06:00
test-get-currentexe.c linux: fix uv_exepath(size=1) UV_EINVAL error 2015-01-03 23:40:31 +01:00
test-get-loadavg.c test: fix -Wtautological-pointer-compare warnings 2015-11-18 22:37:16 +01:00
test-get-memory.c
test-get-passwd.c test: handle root home directories 2016-04-08 11:08:46 -04:00
test-getaddrinfo.c win: fix free() on bad input in uv_getaddrinfo() 2017-01-08 16:29:37 -05:00
test-getnameinfo.c test: fix -Wtautological-pointer-compare warnings 2015-11-18 22:37:16 +01:00
test-getsockname.c unix, win: add send_queue_size and send_queue_count to uv_udp_t 2014-07-04 18:28:18 +02:00
test-handle-fileno.c test: remove LOG and LOGF variadic macros 2015-04-12 18:44:34 +02:00
test-homedir.c test: handle root home directories 2016-04-08 11:08:46 -04:00
test-hrtime.c
test-idle.c test: remove LOG and LOGF variadic macros 2015-04-12 18:44:34 +02:00
test-ip4-addr.c
test-ip6-addr.c test: remove LOG and LOGF variadic macros 2015-04-12 18:44:34 +02:00
test-ipc-send-recv.c test: account for multiple handles in one ipc read 2016-07-18 10:26:04 +01:00
test-ipc.c test,freebsd: fix ipc_listen_xx_write tests 2015-09-08 10:45:10 +02:00
test-list.h unix: make loops and watchers usable after fork() 2017-03-21 12:23:44 +01:00
test-loop-alive.c
test-loop-close.c unix: preserve loop->data across loop init/done 2016-07-30 10:49:19 +02:00
test-loop-configure.c linux: fix epoll_pwait() sigmask size calculation 2014-12-25 14:37:02 +01:00
test-loop-handles.c test: remove LOG and LOGF variadic macros 2015-04-12 18:44:34 +02:00
test-loop-stop.c
test-loop-time.c windows: add uv_backend_timeout 2014-08-04 23:18:38 +02:00
test-multiple-listen.c
test-mutexes.c test: fix self-deadlocks in thread_rwlock_trylock 2015-12-11 23:12:53 +01:00
test-osx-select.c test: remove LOG and LOGF variadic macros 2015-04-12 18:44:34 +02:00
test-pass-always.c
test-ping-pong.c test: skip ipv6 tests when ipv6 is not supported 2014-12-29 17:14:48 +01:00
test-pipe-bind-error.c
test-pipe-close-stdout-read-stdin.c test: fix race condition in pipe-close-stdout 2016-01-21 09:08:41 +01:00
test-pipe-connect-error.c
test-pipe-connect-multiple.c win: fix replacing pipe handle for pipe servers 2015-08-24 23:20:35 +02:00
test-pipe-connect-prepare.c unix: don't block for io if any io handle is primed 2015-05-12 07:37:26 +02:00
test-pipe-getsockname.c test: don't close CRT fd handed off to uv_pipe_t 2016-08-11 09:33:43 +01:00
test-pipe-pending-instances.c win: fix setting pipe pending instances after bind 2015-08-24 23:20:35 +02:00
test-pipe-sendmsg.c
test-pipe-server-close.c
test-pipe-set-non-blocking.c test: fix race condition in multithreaded test 2015-03-11 15:42:34 +01:00
test-platform-output.c test: silence build warnings 2016-06-03 01:18:17 +02:00
test-poll-close-doesnt-corrupt-stack.c test: silence build warnings 2016-06-03 01:18:17 +02:00
test-poll-close.c
test-poll-closesocket.c test: silence build warnings 2016-06-03 01:18:17 +02:00
test-poll.c test: fix tests on OpenBSD 2017-02-07 17:47:17 +01:00
test-process-title.c zos: use built-in proctitle implementation 2017-01-27 18:08:28 +01:00
test-queue-foreach-delete.c unix: fix uv_fs_event_stop() from fs_event_cb 2015-12-08 10:03:01 +01:00
test-ref.c zos: add support for new platform 2016-08-19 01:34:29 +02:00
test-run-nowait.c
test-run-once.c
test-semaphore.c
test-shutdown-close.c
test-shutdown-eof.c
test-shutdown-twice.c
test-signal-multiple-loops.c test: Fix two memory leaks 2015-08-11 13:35:34 +02:00
test-signal.c signal: add uv_signal_start_oneshot method 2017-02-28 14:16:54 +01:00
test-socket-buffer-size.c unix, windows: add uv_recv_buffer_size and uv_send_buffer_size 2014-08-09 11:36:35 +02:00
test-spawn.c test: improve spawn_setuid_setgid test 2016-09-03 10:16:59 +02:00
test-stdio-over-pipes.c
test-tcp-alloc-cb-fail.c unix,win: make on_alloc_cb failures more resilient 2016-08-17 09:57:55 +02:00
test-tcp-bind6-error.c test: skip ipv6 tests when ipv6 is not supported 2014-12-29 17:14:48 +01:00
test-tcp-bind-error.c
test-tcp-close-accept.c test: close server before initiating new connection 2016-07-18 10:22:36 +01:00
test-tcp-close-while-connecting.c test: fix tcp_close_while_connecting CI failures 2016-10-14 01:57:15 +02:00
test-tcp-close.c
test-tcp-connect6-error.c
test-tcp-connect-error-after-write.c
test-tcp-connect-error.c
test-tcp-connect-timeout.c tests: skip some tests when network is unreachable 2015-07-13 10:28:46 +02:00
test-tcp-create-socket-early.c test: skip early bind tests if no IPv6 is supported 2016-04-10 09:53:25 -03:00
test-tcp-flags.c
test-tcp-oob.c Revert "test: fix tcp_oob occassionally timing out" 2015-04-07 11:15:49 +02:00
test-tcp-open.c Revert "stream: squelch ECONNRESET error if already closed" 2015-08-07 14:19:08 +02:00
test-tcp-read-stop.c
test-tcp-shutdown-after-write.c
test-tcp-try-write.c stream: support empty uv_try_write on unix 2015-10-04 18:06:08 -04:00
test-tcp-unexpected-read.c
test-tcp-write-after-connect.c unix: fix tcp write after bad connect freezing 2014-08-21 16:23:43 +02:00
test-tcp-write-fail.c win, test: fix compilation warning 2015-09-29 09:57:27 +02:00
test-tcp-write-queue-order.c unix,win: make on_alloc_cb failures more resilient 2016-08-17 09:57:55 +02:00
test-tcp-write-to-half-open-connection.c
test-tcp-writealot.c test: fix test-tcp-writealot flakiness on arm 2016-09-12 08:33:41 +02:00
test-thread-equal.c unix, windows: add uv_thread_equal 2014-10-20 09:51:49 +02:00
test-thread.c test: fix threadpool_multiple_event_loops on PPC 2016-02-27 18:06:17 +01:00
test-threadpool-cancel.c test: fix -Wformat warning 2017-02-08 12:47:50 +01:00
test-threadpool.c
test-timer-again.c test: remove LOG and LOGF variadic macros 2015-04-12 18:44:34 +02:00
test-timer-from-check.c
test-timer.c win: wait for full timeout duration 2015-12-16 12:08:46 +01:00
test-tmpdir.c test: add missing copyright header 2016-03-24 13:17:31 -04:00
test-tty.c win,test: don't write uninitialized buffer to tty 2017-01-30 00:54:35 -08:00
test-udp-alloc-cb-fail.c unix,win: make on_alloc_cb failures more resilient 2016-08-17 09:57:55 +02:00
test-udp-bind.c
test-udp-create-socket-early.c test: skip early bind tests if no IPv6 is supported 2016-04-10 09:53:25 -03:00
test-udp-dgram-too-big.c
test-udp-ipv6.c build: GNU/kFreeBSD support 2016-08-20 08:55:30 +02:00
test-udp-multicast-interface6.c build: GNU/kFreeBSD support 2016-08-20 08:55:30 +02:00
test-udp-multicast-interface.c tests: skip some tests when network is unreachable 2015-07-13 10:28:46 +02:00
test-udp-multicast-join6.c build: GNU/kFreeBSD support 2016-08-20 08:55:30 +02:00
test-udp-multicast-join.c tests: skip some tests when network is unreachable 2015-07-13 10:28:46 +02:00
test-udp-multicast-ttl.c tests: skip some tests when network is unreachable 2015-07-13 10:28:46 +02:00
test-udp-open.c unix, win: prevent replacing fd in uv_{udp,tcp,pipe}_t 2015-06-19 09:36:41 +02:00
test-udp-options.c zos: add support for new platform 2016-08-19 01:34:29 +02:00
test-udp-send-and-recv.c unix, win: add send_queue_size and send_queue_count to uv_udp_t 2014-07-04 18:28:18 +02:00
test-udp-send-immediate.c unix: remove incorrect assert 2014-07-11 22:53:59 +02:00
test-udp-send-unreachable.c windows: fix buffer leak after failed udp send 2014-08-28 08:41:43 +02:00
test-udp-try-send.c unix, win: add uv_udp_try_send 2014-07-04 18:30:33 +02:00
test-walk-handles.c
test-watcher-cross-stop.c zos: add support for new platform 2016-08-19 01:34:29 +02:00