tor/src
Alexander Færøy bb784cf4f3 Add Windows backend for the Process subsystem.
This patch adds support for Microsoft Windows in the Process subsystem.

Libevent does not support mixing different types of handles (sockets,
named pipes, etc.) on Windows in its core event loop code. This have
historically meant that Tor have avoided attaching any non-networking
handles to the event loop. This patch uses a slightly different approach
to roughly support the same features for the Process subsystem as we do
with the Unix backend.

In this patch we use Windows Extended I/O functions (ReadFileEx() and
WriteFileEx()) which executes asynchronously in the background and
executes a completion routine when the scheduled read or write operation
have completed. This is much different from the Unix backend where the
operating system signals to us whenever a file descriptor is "ready" to
either being read from or written to.

To make the Windows operating system execute the completion routines of
ReadFileEx() and WriteFileEx() we must get the Tor process into what
Microsoft calls an "alertable" state. To do this we execute SleepEx()
with a zero millisecond sleep time from a main loop timer that ticks
once a second.  This moves the process into the "alertable" state and
when we return from the zero millisecond timeout all the outstanding I/O
completion routines will be called and we can schedule the next reads
and writes.

The timer loop is also responsible for detecting whether our child
processes have terminated since the last timer tick.

See: https://bugs.torproject.org/28179
2018-12-17 16:39:28 -05:00
..
app Add new Process subsystem. 2018-12-17 16:39:28 -05:00
config Merge branch 'maint-0.3.5' 2018-11-11 11:57:54 -05:00
core Merge remote-tracking branch 'tor-github/pr/495' 2018-11-26 17:17:40 -05:00
ext Merge branch 'maint-0.2.9' into maint-0.3.2 2018-09-13 11:46:04 -04:00
feature Remove unused int pid member of managed_proxy_t. 2018-11-27 19:31:08 +01:00
lib Add Windows backend for the Process subsystem. 2018-12-17 16:39:28 -05:00
rust Merge branch 'maint-0.3.5' 2018-11-15 16:11:29 -05:00
test Add Windows backend for the Process subsystem. 2018-12-17 16:39:28 -05:00
tools Add missing library to build tor-print-ed-signing-cert. 2018-11-19 10:18:44 -05:00
trunnel Merge branch 'socks_trunnel4_squashed' into socks_trunnel4_squashed_merged 2018-07-12 11:47:25 -04:00
win32 Bump to 0.3.5.5-alpha-dev 2018-11-16 11:32:04 -05:00
include.am Move the code that knows our tor version into a lowest-level lib 2018-11-05 09:22:02 -05:00