Add Windows support for --server.
authorjames rizzo <james.rizzo@broadcom.com>
Thu, 16 Dec 2021 22:08:50 +0000 (15:08 -0700)
committerjames rizzo <james.rizzo@broadcom.com>
Thu, 16 Dec 2021 22:08:50 +0000 (15:08 -0700)
commitf8fef4c68889f8a7ae7d556d9a747b60c71b1b43
tree17a74d1b59bcd8c13b9c2e451960ea75e1d62dab
parent4fd07b23121e45fa4e7e434d23f3257c8a0ef588
Add Windows support for --server.

This required working around two calls to fork()

The first fork() was in accept_loop() where it creates a new process
to work on handle_connection(). This change set uses Window's
CreateProcess() in place of fork(). In order to support this,
it duplicates the socket connection via WSADuplicateSocket()
and passes the resulting WSAPROTOCOL_INFO to the process via a
named pipe. The pipe name is then passed to the process via a
new command line argument(--server-internal).

The second fork() was in handle_run_cmd() where it creates a new
process to work on fio_backend_thread(). This change set runs
fio_backend_thread() as a thread via pthread_create() instead of a
forked process.

There is also some supporting work in the monitoring of
spawned processes/threads in fio_server_check_conns() and
fio_server_check_jobs().

Signed-off-by: james rizzo <james.rizzo@broadcom.com>
init.c
os/os-windows.h
os/windows/posix.c
server.c
server.h