From c7d3e3a39ad576251d7193ea8bd149df65ef27a4 Mon Sep 17 00:00:00 2001
From: Duncan Coutts <duncan@well-typed.com>
Date: Mon, 25 Mar 2024 22:55:47 +0000
Subject: [PATCH] Include the default I/O manager in the +RTS --info output

Document the extra +RTS --info output in the user guide
---
 docs/users_guide/runtime_control.rst | 6 ++++++
 rts/RtsUtils.c                       | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/docs/users_guide/runtime_control.rst b/docs/users_guide/runtime_control.rst
index 1377db771d0a..efd549ba1122 100644
--- a/docs/users_guide/runtime_control.rst
+++ b/docs/users_guide/runtime_control.rst
@@ -1555,6 +1555,7 @@ Getting information about the RTS
         ,("Compiler unregisterised", "NO")
         ,("Tables next to code", "YES")
         ,("Flag -with-rtsopts", "")
+        ,("I/O manager default", "select")
         ]
 
     The information is formatted such that it can be read as a of type
@@ -1608,3 +1609,8 @@ Getting information about the RTS
 
     ``Flag -with-rtsopts``
         The value of the GHC flag :ghc-flag:`-with-rtsopts=⟨opts⟩` at compile/link time.
+
+    ``I/O manager default``
+        The name of the I/O manager subsystem that will be used by default
+        for this program. This can be overridden with the
+        :rts-flag:`--io-manager=(name)` RTS flag.
diff --git a/rts/RtsUtils.c b/rts/RtsUtils.c
index 6a1faf7a3079..f842c1cc3c43 100644
--- a/rts/RtsUtils.c
+++ b/rts/RtsUtils.c
@@ -14,6 +14,7 @@
 #include "Ticky.h"
 #include "Schedule.h"
 #include "RtsFlags.h"
+#include "IOManager.h"
 
 #include <time.h>
 
@@ -385,6 +386,8 @@ void printRtsInfo(const RtsConfig rts_config) {
     mkRtsInfoPair("Tables next to code",     TablesNextToCode);
     mkRtsInfoPair("Flag -with-rtsopts",      /* See #15261 */
         rts_config.rts_opts != NULL ? rts_config.rts_opts : "");
+    selectIOManager(); /* resolve the io-manager, accounting for flags  */
+    mkRtsInfoPair("I/O manager default",     showIOManager());
     printf(" ]\n");
 }
 
-- 
GitLab