MCPcopy Create free account
hub / github.com/FEX-Emu/FEX / GetServerMountFolder

Function GetServerMountFolder

Source/Common/FEXServerClient.cpp:102–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102fextl::string GetServerMountFolder() {
103 // We need a FEXServer mount directory that has some tricky requirements.
104 // - We don't want to use `/tmp/` if possible.
105 // - systemd services use `PrivateTmp` feature to gives services their own tmp.
106 // - We will use this as a fallback path /only/.
107 // - Can't be `[$XDG_DATA_HOME,$HOME]/.fex-emu/`
108 // - Might be mounted with a filesystem (sshfs) which can't handle mount points inside it.
109 //
110 // Directories it can be in:
111 // - $XDG_RUNTIME_DIR if set
112 // - Is typically `/run/user/<UID>/`
113 // - systemd `PrivateTmp` feature doesn't touch this.
114 // - If this path doesn't exist then fallback to `/tmp/` as a last resort.
115 // - pressure-vessel explicitly creates an internal XDG_RUNTIME_DIR inside its chroot.
116 // - This is okay since pressure-vessel rbinds the FEX rootfs from the host to `/run/pressure-vessel/interpreter-root`.
117 auto Folder = GetTempFolder();
118
119 if (FEXCore::Config::FindContainer() == "pressure-vessel") {
120 // In pressure-vessel the mount point changes location.
121 // This is due to pressure-vesssel being a chroot environment.
122 // It by default maps the host-filesystem to `/run/host/` so we need to redirect.
123 // After pressure-vessel is fully set up it will set the `FEX_ROOTFS` environment variable,
124 // which the FEXInterpreter will pick up on.
125 Folder = "/run/host/" + Folder;
126 }
127
128 return Folder;
129}
130
131fextl::string GetServerSocketName() {
132 FEX_CONFIG_OPT(ServerSocketPath, SERVERSOCKETPATH);

Callers 1

MountRootFSImagePathFunction · 0.85

Calls 2

GetTempFolderFunction · 0.85
FindContainerFunction · 0.85

Tested by

no test coverage detected