diff --git a/photon/libc/sys/horizon/launch.c b/photon/libc/sys/horizon/launch.c index ae24786..2b2e6e6 100644 --- a/photon/libc/sys/horizon/launch.c +++ b/photon/libc/sys/horizon/launch.c @@ -78,6 +78,10 @@ struct cleanup { size_t inherited_ns_len; int *fd; + + /* this is used to send STDIO handles to the interpreter. + * the same handles are sent in both messages. */ + mx_handle_t stdio[LAUNCH_MAX_FDS]; }; static void set_error_msg(const char *s, ...) @@ -366,6 +370,7 @@ static int collect_handles(const struct launch_info *info, struct cleanup *clean b_idx++; cleanup->auto_handles[auto_idx++] = fd_handle; + cleanup->stdio[i] = fd_handle; } if (info->flags & LAUNCH_INHERIT_NS) { @@ -1034,6 +1039,9 @@ static int send_interp_bootstrap_message(const struct launch_info *args, struct ARG_HANDLE(cleanup->exec.remote_exec_vmar, MX_B_HND(MX_B_VMAR_EXEC, 0)), ARG_HANDLE(vdso_vmo, MX_B_HND(MX_B_VMO_VDSO, 0)), ARG_HANDLE(ldsvc, MX_B_HND(MX_B_TUNNEL_LDSVC, cleanup->ldsvc_version)), + ARG_HANDLE(cleanup->stdio[0], MX_B_HND(MX_B_FD, 0)), + ARG_HANDLE(cleanup->stdio[1], MX_B_HND(MX_B_FD, 1)), + ARG_HANDLE(cleanup->stdio[2], MX_B_HND(MX_B_FD, 2)), }; static size_t handle_count = sizeof handles / sizeof handles[0];