From 9d37c69a469c708327b907a9392d9322043f1274 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Tue, 23 Feb 2021 18:11:23 +0000
Subject: [PATCH] runtime: Communicate whether we're going to run in a Flatpak
 subsandbox

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 pressure-vessel/runtime.h | 4 ++++
 pressure-vessel/wrap.c    | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/pressure-vessel/runtime.h b/pressure-vessel/runtime.h
index c48735421..958577e5c 100644
--- a/pressure-vessel/runtime.h
+++ b/pressure-vessel/runtime.h
@@ -40,6 +40,8 @@
  * @PV_RUNTIME_FLAGS_IMPORT_VULKAN_LAYERS: Include host Vulkan layers
  * @PV_RUNTIME_FLAGS_COPY_RUNTIME: Copy the runtime and modify the copy
  * @PV_RUNTIME_FLAGS_UNPACK_ARCHIVE: Source is an archive, not a deployment
+ * @PV_RUNTIME_FLAGS_FLATPAK_SUBSANDBOX: The runtime will be used in a
+ *  Flatpak subsandbox
  * @PV_RUNTIME_FLAGS_NONE: None of the above
  *
  * Flags affecting how we set up the runtime.
@@ -53,6 +55,7 @@ typedef enum
   PV_RUNTIME_FLAGS_IMPORT_VULKAN_LAYERS = (1 << 4),
   PV_RUNTIME_FLAGS_COPY_RUNTIME = (1 << 5),
   PV_RUNTIME_FLAGS_UNPACK_ARCHIVE = (1 << 6),
+  PV_RUNTIME_FLAGS_FLATPAK_SUBSANDBOX = (1 << 7),
   PV_RUNTIME_FLAGS_NONE = 0
 } PvRuntimeFlags;
 
@@ -64,6 +67,7 @@ typedef enum
    | PV_RUNTIME_FLAGS_IMPORT_VULKAN_LAYERS \
    | PV_RUNTIME_FLAGS_COPY_RUNTIME \
    | PV_RUNTIME_FLAGS_UNPACK_ARCHIVE \
+   | PV_RUNTIME_FLAGS_FLATPAK_SUBSANDBOX \
    )
 
 typedef struct _PvRuntime PvRuntime;
diff --git a/pressure-vessel/wrap.c b/pressure-vessel/wrap.c
index 50ae8c38a..10bcdbe12 100644
--- a/pressure-vessel/wrap.c
+++ b/pressure-vessel/wrap.c
@@ -1899,6 +1899,9 @@ main (int argc,
       if (opt_copy_runtime)
         flags |= PV_RUNTIME_FLAGS_COPY_RUNTIME;
 
+      if (flatpak_subsandbox != NULL)
+        flags |= PV_RUNTIME_FLAGS_FLATPAK_SUBSANDBOX;
+
       if (opt_runtime != NULL)
         {
           /* already checked for mutually exclusive options */
-- 
GitLab