/// <nodoc /> public SandboxedProcessUnix(SandboxedProcessInfo info, bool ignoreReportedAccesses = false, bool?overrideMeasureTime = null) : base(info) { Contract.Requires(info.FileAccessManifest != null); Contract.Requires(info.SandboxConnection != null); PipId = info.FileAccessManifest.PipId; SandboxConnection = info.SandboxConnection; ChildProcessTimeout = info.NestedProcessTerminationTimeout; AllowedSurvivingChildProcessNames = info.AllowedSurvivingChildProcessNames; ReportQueueProcessTimeoutForTests = info.ReportQueueProcessTimeoutForTests; IgnoreReportedAccesses = ignoreReportedAccesses; RootJailInfo = info.RootJailInfo; MeasureCpuTime = overrideMeasureTime.HasValue ? overrideMeasureTime.Value : info.SandboxConnection.MeasureCpuTimes; m_perfAggregator = new PerfAggregator(); m_perfCollector = new CancellableTimedAction( callback: UpdatePerfCounters, intervalMs: (int)PerfProbeInternal.TotalMilliseconds); m_reports = new SandboxedProcessReports( info.FileAccessManifest, info.PathTable, info.PipSemiStableHash, info.PipDescription, info.LoggingContext, info.DetoursEventListener, info.SidebandWriter, info.FileSystemView); var useSingleProducer = !(SandboxConnection.Kind == SandboxKind.MacOsHybrid || SandboxConnection.Kind == SandboxKind.MacOsDetours); var executionOptions = new ExecutionDataflowBlockOptions { EnsureOrdered = true, SingleProducerConstrained = useSingleProducer, BoundedCapacity = DataflowBlockOptions.Unbounded, MaxDegreeOfParallelism = 1 // Must be one, otherwise SandboxedPipExecutor will fail asserting valid reports }; m_pendingReports = new ActionBlock <AccessReport>(HandleAccessReport, executionOptions); // install a 'ProcessStarted' handler that informs the sandbox of the newly started process ProcessStarted += (pid) => OnProcessStartedAsync(info).GetAwaiter().GetResult(); }
/// <nodoc /> public SandboxedProcessMac(SandboxedProcessInfo info, bool ignoreReportedAccesses = false, bool?overrideMeasureTime = null) : base(info) { Contract.Requires(info.FileAccessManifest != null); Contract.Requires(info.SandboxConnection != null); IgnoreReportedAccesses = ignoreReportedAccesses; MeasureCpuTime = overrideMeasureTime.HasValue ? overrideMeasureTime.Value : info.SandboxConnection.MeasureCpuTimes; m_perfAggregator = new PerfAggregator(); m_perfTimer = new Timer( callback: UpdatePerfCounters, state: this, dueTime: Timeout.InfiniteTimeSpan, // don't automatically start the timer period: Timeout.InfiniteTimeSpan); m_reports = new SandboxedProcessReports( info.FileAccessManifest, info.PathTable, info.PipSemiStableHash, info.PipDescription, info.LoggingContext, info.DetoursEventListener); m_pendingReports = new ActionBlock <AccessReport>( HandleAccessReport, new ExecutionDataflowBlockOptions { EnsureOrdered = true, BoundedCapacity = DataflowBlockOptions.Unbounded, MaxDegreeOfParallelism = 1, // Must be one, otherwise SandboxedPipExecutor will fail asserting valid reports }); // install a 'ProcessStarted' handler that informs the sandbox of the newly started process ProcessStarted += () => OnProcessStartedAsync().GetAwaiter().GetResult(); }