aboutsummaryrefslogtreecommitdiff
path: root/src/zencompute/macrunner.h
blob: 167a99b57482135907a19023c4a9b639808a0ce8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright Epic Games, Inc. All Rights Reserved.

#pragma once

#include "localrunner.h"

#if ZEN_WITH_COMPUTE_SERVICES && ZEN_PLATFORM_MAC

namespace zen::compute {

/** Native macOS process runner for executing Mac worker executables directly.

	Subclasses LocalProcessRunner, reusing sandbox management, worker manifesting,
	input/output handling, and monitor thread infrastructure. Overrides only the
	platform-specific methods: process spawning, sweep, and cancellation.

	When Sandboxed is true, child processes are isolated using macOS Seatbelt
	(sandbox_init): no network access and no filesystem access outside the
	explicitly allowed sandbox and worker directories. This requires no elevation.
 */
class MacProcessRunner : public LocalProcessRunner
{
public:
	MacProcessRunner(ChunkResolver&				  Resolver,
					 const std::filesystem::path& BaseDir,
					 DeferredDirectoryDeleter&	  Deleter,
					 WorkerThreadPool&			  WorkerPool,
					 bool						  Sandboxed = false);

	[[nodiscard]] SubmitResult SubmitAction(Ref<RunnerAction> Action) override;
	void					   SweepRunningActions() override;
	void					   CancelRunningActions() override;

private:
	bool m_Sandboxed = false;
};

}  // namespace zen::compute

#endif