master
md 18 lines 924 Bytes
Rendered Raw
1 # Relay
2
3 Relay is a WSL2 Linux process created by a [session leader](session-leader.md). Its job is to create a Linux process on behalf of the user, and relay its output back to Windows.
4
5 ## Creating a user process
6
7 A relay is created when a `LxInitMessageCreateProcessUtilityVm` message is sent to a [session leader](session-leader.md). Once created, the `relay` creates multiple `hvsocket` channels with [wslservice.exe](wslservice.exe.md).
8
9 These channels are used to:
10
11 - Relay standard file descriptors (stdin, stdout, stderr)
12 - Relay information about the terminal (for instance when the terminal window is resized from Windows)
13 - Notify Windows when the Linux process exits
14
15 Once those channels are configured, the `relay` forks() into two processes:
16
17 - The parent, which will read & write to the child's standard file descriptors and relay it to Windows
18 - The child, which calls `exec()` and starts the user process